提供: Minecraft Modding Wiki
2013年1月14日 (月) 11:28時点におけるMozipi (トーク | 投稿記録)による版
移動先: 案内検索

この記事は"Minecraft Forge6.5.x"を前提MODとしています。


Craftingした時の処理

Craftingした時の処理はICraftingHandlerを実装(implements)するとできるようになります。

ICraftingHandler.java

package sample;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.ICraftingHandler; 

public class CraftingEvent implements ICraftingHandler {

 	@Override
	public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
                //ここにクラフティングされた時の処理を記載
        }

	@Override
	public void onSmelting(EntityPlayer player, ItemStack item) {
                //ここにかまどで焼かれた時の処理を記載
	}

}

登録は@Mod.Init内で

GameRegistry.registerCraftingHandler(ICraftingHandler);

で行います。