+
|
オファレンMOD |
package nahama.ofalenmod;
/*略*/
/** @author Akasata Nahama */
@Mod(modid = OfalenModCore.MODID, name = OfalenModCore.MODNAME, version = OfalenModCore.VERSION)
public class OfalenModCore {
public static final String MODID = "OfalenMod";
public static final String MODNAME = "Ofalen Mod";
public static final String VERSION = "[1.7.10]1.0.0";
/*略*/
/** 最初に行われる処理。アイテム・ブロックの追加などを行う */
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
/*略*/
// アイテムを設定するメソッドを実行
OfalenModItemCore.registerItem();
/*略*/
}
/*略*/
}
package nahama.ofalenmod.core;
/*略*/
public class OfalenModItemCore {
/*略*/
//アーマーの定義
public static Item helmetOfalen;
public static Item chestplateOfalen;
public static Item leggingsOfalen;
public static Item bootsOfalen;
/*略*/
/**アイテムを設定する*/
public static void registerItem () {
/*略*/
//アーマーの設定
helmetOfalen = new OfalenArmor(OfalenModMaterialCore.OFALENA, 0, 1)
.setUnlocalizedName("helmetOfalen")
.setTextureName("ofalenmod:ofalen_helmet");
GameRegistry.registerItem(helmetOfalen, "helmetOfalen");
chestplateOfalen = new OfalenArmor(OfalenModMaterialCore.OFALENA, 1, 1)
.setUnlocalizedName("chestplateOfalen")
.setTextureName("ofalenmod:ofalen_chestplate");
GameRegistry.registerItem(chestplateOfalen, "chestplateOfalen");
leggingsOfalen = new OfalenArmor(OfalenModMaterialCore.OFALENA, 2, 1)
.setUnlocalizedName("leggingsOfalen")
.setTextureName("ofalenmod:ofalen_leggings");
GameRegistry.registerItem(leggingsOfalen, "leggingsOfalen");
bootsOfalen = new OfalenArmor(OfalenModMaterialCore.OFALENA, 3, 1)
.setUnlocalizedName("bootsOfalen")
.setTextureName("ofalenmod:ofalen_boots");
GameRegistry.registerItem(bootsOfalen, "bootsOfalen");
/*略*/
}
}
- OfalenModMaterialCore.java
package nahama.ofalenmod.core;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraftforge.common.util.EnumHelper;
public class OfalenModMaterialCore {
//ツールマテリアルの定義
public static ToolMaterial OFALENT = EnumHelper.addToolMaterial("OFALENT", 4, 1561, 8.0F, 3.0F, 10);
public static ToolMaterial OFALENG2T = EnumHelper.addToolMaterial("OFALENG2T", 4, 3123, 16.0F, 6.0F, 20);
public static ToolMaterial OFALENG3T = EnumHelper.addToolMaterial("OFALENG3T", 4, 6247, 32.0F, 12.0F, 40);
public static ToolMaterial PERFECTT = EnumHelper.addToolMaterial("PERFECTT", 5, 12495, OfalenModConfigCore.efficiencyPerfectTool, 24.0F, 80);
//アーマーマテリアルの定義
public static ArmorMaterial OFALENA = EnumHelper.addArmorMaterial("OFALENA", 33, new int[]{3, 8, 6, 3}, 10);
public static ArmorMaterial OFALENG2A = EnumHelper.addArmorMaterial("OFALENG2A", 66, new int[] {3, 8, 6, 3}, 20);
public static ArmorMaterial OFALENG3A = EnumHelper.addArmorMaterial("OFALENG3A", 132, new int[] {3, 8, 6, 3}, 40);
public static ArmorMaterial PERFECTA = EnumHelper.addArmorMaterial("PERFECTA", 264, new int[] {3, 8, 6, 3}, 80);
}
package nahama.ofalenmod.item.armor;
import nahama.ofalenmod.OfalenModCore;
import nahama.ofalenmod.core.OfalenModItemCore;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class OfalenArmor extends ItemArmor {
private int grade = 0;
public OfalenArmor(ArmorMaterial material, int type, int grade) {
super(material, 0, type);
this.setCreativeTab(OfalenModCore.tabOfalen);
this.grade = grade;
}
/**テクスチャを指定する*/
@Override
public String getArmorTexture(ItemStack itemStack, Entity entity, int slot, String type) {
int i = 1;
if (this.armorType == 2) i = 2;
if (this.grade == 4) return "ofalenmod:textures/models/armor/ofalen_P_layer_" + i + ".png";
return "ofalenmod:textures/models/armor/ofalen_G" + grade + "_layer_" + i + ".png";
}
/*略*/
}
|