提供: Minecraft Modding Wiki
2013年1月28日 (月) 11:35時点におけるKegare (トーク | 投稿記録)による版
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

この記事は"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 itemstack, IInventory craftMatrix) {
                //ここにクラフティングされた時の処理を記載
        }

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

}

登録は@Mod.Init内で

GameRegistry.registerCraftingHandler(new CraftingEvent());

で行います。