提供: Minecraft Modding Wiki
89行目: | 89行目: | ||
Block.pumpkin, | Block.pumpkin, | ||
Block.pumpkinLantern}; | Block.pumpkinLantern}; | ||
− | // | + | // 詳しい情報は、ItemSpade.java ItemPickaxe.java ItemAxe.javaを参照 |
public ItemCustomModelTools(int par1ID, EnumToolMaterial par2EnumToolMaterial) | public ItemCustomModelTools(int par1ID, EnumToolMaterial par2EnumToolMaterial) | ||
{ | { | ||
super(par1ID, damageFloat, par2EnumToolMaterial, setBleakingList); | super(par1ID, damageFloat, par2EnumToolMaterial, setBleakingList); | ||
+ | } | ||
+ | @Override | ||
+ | public boolean canHarvestBlock(Block par1Block) | ||
+ | { | ||
+ | return par1Block == Block.snow ? true : par1Block == Block.blockSnow : //雪 | ||
+ | (par1Block == Block.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : //黒曜石 | ||
+ | (par1Block != Block.blockDiamond && par1Block != Block.oreDiamond ? //ダイヤモンド | ||
+ | (par1Block != Block.oreEmerald && par1Block != Block.blockEmerald ? //エメラルド | ||
+ | (par1Block != Block.blockGold && par1Block != Block.oreGold ? //金 | ||
+ | (par1Block != Block.blockIron && par1Block != Block.oreIron ? //鉄 | ||
+ | (par1Block != Block.blockLapis && par1Block != Block.oreLapis ? //ラピスラズリ | ||
+ | (par1Block != Block.oreRedstone && par1Block != Block.oreRedstoneGlowing ? //レッドストーン | ||
+ | (par1Block.blockMaterial == Material.rock ? true : //マテリアル属性 石 | ||
+ | (par1Block.blockMaterial == Material.iron ? true : //マテリアル属性 鉄 | ||
+ | par1Block.blockMaterial == Material.anvil)) //マテリアル属性 金床 | ||
+ | this.toolMaterial.getHarvestLevel() >= 2) : //マテリアルレベル 2 | ||
+ | this.toolMaterial.getHarvestLevel() >= 1) : //マテリアルレベル 1 | ||
+ | this.toolMaterial.getHarvestLevel() >= 1) : //マテリアルレベル 1 | ||
+ | this.toolMaterial.getHarvestLevel() >= 2) : //マテリアルレベル 2 | ||
+ | this.toolMaterial.getHarvestLevel() >= 2) : //マテリアルレベル 2 | ||
+ | this.toolMaterial.getHarvestLevel() >= 2)); //マテリアルレベル 2 | ||
+ | } | ||
+ | @Override | ||
+ | public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) | ||
+ | { | ||
+ | return par2Block != null && | ||
+ | (par2Block.blockMaterial == Material.iron || //マテリアル属性 鉄 | ||
+ | par2Block.blockMaterial == Material.anvil || //マテリアル属性 金床 | ||
+ | par2Block.blockMaterial == Material.rock) ? //マテリアル属性 石 | ||
+ | this.efficiencyOnProperMaterial : | ||
+ | super.getStrVsBlock(par1ItemStack, par2Block); | ||
} | } | ||
} | } |
2014年1月5日 (日) 02:49時点における版
1.6のモデル付きカスタムツール追加
このアイテムは、(つるはし)(ショベル)(斧)の三つ(鉄製)にモデルを付けて追加するものです。
ソース
- CustomModelTools.java
package custom.tool.item; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod( modid = "CustomModelTools", name = "Custom Model Tools", version = "1" ) @NetworkMod( clientSideRequired = CustomModelTools.clientSideRequiredBoolean, serverSideRequired = CustomModelTools.serverSideRequiredBoolean ) public class CustomModelTools { public static final boolean clientSideRequiredBoolean = true; public static final boolean serverSudeRequiredBoolean = false; public static ItemTool mainItem; @EventHabdler public void mainLoading(FMLPreInitializationEvent event) { mainItem = new } }
- ItemCustomModelTools.java
package custom.tool.item; import net.minecraft.block.Block; public class ItemCustomModelTools extends ItemTool { private static final Block[] setBleakingList = new Block[] {// ItemSpade.java Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium // ItemPickaxe.java Block.cobblestone, Block.stoneDoubleSlab, Block.stoneSingleSlab, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockIron, Block.oreCoal, Block.blockGold, Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis, Block.oreRedstone, Block.oreRedstoneGlowing, Block.rail, Block.railDetector, Block.railPowered, Block.railActivator // ItemAxe.java Block.planks, Block.bookShelf, Block.wood, Block.chest, Block.stoneDoubleSlab, Block.stoneSingleSlab, Block.pumpkin, Block.pumpkinLantern}; // 詳しい情報は、ItemSpade.java ItemPickaxe.java ItemAxe.javaを参照 public ItemCustomModelTools(int par1ID, EnumToolMaterial par2EnumToolMaterial) { super(par1ID, damageFloat, par2EnumToolMaterial, setBleakingList); } @Override public boolean canHarvestBlock(Block par1Block) { return par1Block == Block.snow ? true : par1Block == Block.blockSnow : //雪 (par1Block == Block.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : //黒曜石 (par1Block != Block.blockDiamond && par1Block != Block.oreDiamond ? //ダイヤモンド (par1Block != Block.oreEmerald && par1Block != Block.blockEmerald ? //エメラルド (par1Block != Block.blockGold && par1Block != Block.oreGold ? //金 (par1Block != Block.blockIron && par1Block != Block.oreIron ? //鉄 (par1Block != Block.blockLapis && par1Block != Block.oreLapis ? //ラピスラズリ (par1Block != Block.oreRedstone && par1Block != Block.oreRedstoneGlowing ? //レッドストーン (par1Block.blockMaterial == Material.rock ? true : //マテリアル属性 石 (par1Block.blockMaterial == Material.iron ? true : //マテリアル属性 鉄 par1Block.blockMaterial == Material.anvil)) //マテリアル属性 金床 this.toolMaterial.getHarvestLevel() >= 2) : //マテリアルレベル 2 this.toolMaterial.getHarvestLevel() >= 1) : //マテリアルレベル 1 this.toolMaterial.getHarvestLevel() >= 1) : //マテリアルレベル 1 this.toolMaterial.getHarvestLevel() >= 2) : //マテリアルレベル 2 this.toolMaterial.getHarvestLevel() >= 2) : //マテリアルレベル 2 this.toolMaterial.getHarvestLevel() >= 2)); //マテリアルレベル 2 } @Override public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) { return par2Block != null && (par2Block.blockMaterial == Material.iron || //マテリアル属性 鉄 par2Block.blockMaterial == Material.anvil || //マテリアル属性 金床 par2Block.blockMaterial == Material.rock) ? //マテリアル属性 石 this.efficiencyOnProperMaterial : super.getStrVsBlock(par1ItemStack, par2Block); } }
未完成