use of net.minecraft.creativetab.CreativeTabs in project BetterWithAddons by DaedalusGame.
the class ModItems method load.
public static void load(FMLPreInitializationEvent event) {
ironSpade = (ItemSpade) registerItem("iron_spade", new ItemSpade(Item.ToolMaterial.IRON));
ironMatchPick = (ItemMatchPick) registerItem("iron_matchpick", new ItemMatchPick(Item.ToolMaterial.IRON));
ironMachete = (ItemMachete) registerItem("iron_machete", new ItemMachete(Item.ToolMaterial.IRON));
ironKukri = (ItemKukri) registerItem("iron_kukri", new ItemKukri(Item.ToolMaterial.IRON, 8.0f, -3.1f));
ironCarpenterSaw = (ItemCarpenterSaw) registerItem("iron_carpentersaw", new ItemCarpenterSaw(Item.ToolMaterial.IRON, 8.0f, -3.1f));
ironMasonPick = (ItemMasonPick) registerItem("iron_masonpick", new ItemMasonPick(Item.ToolMaterial.IRON));
goldSpade = (ItemSpade) registerItem("gold_spade", new ItemSpade(Item.ToolMaterial.GOLD));
goldMatchPick = (ItemMatchPick) registerItem("gold_matchpick", new ItemMatchPick(Item.ToolMaterial.GOLD));
goldMachete = (ItemMachete) registerItem("gold_machete", new ItemMachete(Item.ToolMaterial.GOLD));
goldKukri = (ItemKukri) registerItem("gold_kukri", new ItemKukri(Item.ToolMaterial.GOLD, 6.0f, -3.0f));
goldCarpenterSaw = (ItemCarpenterSaw) registerItem("gold_carpentersaw", new ItemCarpenterSaw(Item.ToolMaterial.GOLD, 6.0f, -3.0f));
goldMasonPick = (ItemMasonPick) registerItem("gold_masonpick", new ItemMasonPick(Item.ToolMaterial.GOLD));
diamondSpade = (ItemSpade) registerItem("diamond_spade", new ItemSpade(Item.ToolMaterial.DIAMOND));
diamondMatchPick = (ItemMatchPick) registerItem("diamond_matchpick", new ItemMatchPick(Item.ToolMaterial.DIAMOND));
diamondMachete = (ItemMachete) registerItem("diamond_machete", new ItemMachete(Item.ToolMaterial.DIAMOND));
diamondKukri = (ItemKukri) registerItem("diamond_kukri", new ItemKukri(Item.ToolMaterial.DIAMOND, 8.0f, -3.0f));
diamondCarpenterSaw = (ItemCarpenterSaw) registerItem("diamond_carpentersaw", new ItemCarpenterSaw(Item.ToolMaterial.DIAMOND, 8.0f, -3.0f));
diamondMasonPick = (ItemMasonPick) registerItem("diamond_masonpick", new ItemMasonPick(Item.ToolMaterial.DIAMOND));
steelSpade = (ItemSpade) registerItem("steel_spade", new ItemSpade(BWMItems.SOULFORGED_STEEL) {
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
return ItemUtil.matchesOreDict(repair, "ingotSoulforgedSteel") || super.getIsRepairable(toRepair, repair);
}
});
steelMatchPick = (ItemMatchPick) registerItem("steel_matchpick", new ItemMatchPick(BWMItems.SOULFORGED_STEEL) {
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
return ItemUtil.matchesOreDict(repair, "ingotSoulforgedSteel") || super.getIsRepairable(toRepair, repair);
}
});
steelMachete = (ItemMachete) registerItem("steel_machete", new ItemMachete(BWMItems.SOULFORGED_STEEL) {
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
return ItemUtil.matchesOreDict(repair, "ingotSoulforgedSteel") || super.getIsRepairable(toRepair, repair);
}
});
steelKukri = (ItemKukri) registerItem("steel_kukri", new ItemKukri(BWMItems.SOULFORGED_STEEL, 8.0F, -3.0F) {
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
return ItemUtil.matchesOreDict(repair, "ingotSoulforgedSteel") || super.getIsRepairable(toRepair, repair);
}
});
steelCarpenterSaw = (ItemCarpenterSaw) registerItem("steel_carpentersaw", new ItemCarpenterSaw(BWMItems.SOULFORGED_STEEL, 8.0F, -3.0F) {
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
return ItemUtil.matchesOreDict(repair, "ingotSoulforgedSteel") || super.getIsRepairable(toRepair, repair);
}
});
steelMasonPick = (ItemMasonPick) registerItem("steel_masonpick", new ItemMasonPick(BWMItems.SOULFORGED_STEEL) {
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
return ItemUtil.matchesOreDict(repair, "ingotSoulforgedSteel") || super.getIsRepairable(toRepair, repair);
}
});
material = (ItemMaterial) registerItem("material", new ItemMaterial(new String[] { "arrowhead", "midori", "midori_popped", "thornrose", "stone_brick", "bone_ingot", "ender_cream" }));
worldShard = (ItemWorldScale) registerItem("worldshard", new ItemWorldScale());
greatbow = (ItemGreatbow) registerItem("greatbow", new ItemGreatbow());
greatarrow = (ItemGreatarrow) registerItem("greatarrow", new ItemGreatarrow());
greatarrowLightning = (ItemGreatarrow) registerItem("greatarrow_lightning", new ItemGreatarrowLightning());
greatarrowDestruction = (ItemGreatarrow) registerItem("greatarrow_destruction", new ItemGreatarrowDestruction());
monument = (ItemMonument) registerItem("monument", new ItemMonument());
// Food
bakedMushroom = (ItemFood) registerItem("food_mushroom_baked", new ItemFood(3, 0.2F, false));
bakedAmanita = (ItemFood) registerItem("food_amanita_baked", new ItemFood(3, 0.2F, false).setPotionEffect(new PotionEffect(MobEffects.POISON, 100, 0), 1.0F));
cookedBeetroot = (ItemFood) registerItem("food_beetroot_cooked", new ItemFood(4, 0.5F, false));
bakedBeetroot = (ItemFood) registerItem("food_beetroot_baked", new ItemFood(5, 0.4F, false));
cookedCarrot = (ItemFood) registerItem("food_carrot_cooked", new ItemFood(3, 0.6F, false));
bakedCarrot = (ItemFood) registerItem("food_carrot_baked", new ItemFood(4, 0.5F, false));
cookedPotato = (ItemFood) registerItem("food_potato_cooked", new ItemFood(4, 0.7F, false));
cookedEgg = (ItemFood) registerItem("food_egg_cooked", new ItemFood(4, 0.3F, false));
meatballs = (ItemFood) registerItem("food_meatballs", new ItemFood(3, 0.6F, true));
groundMeat = (ItemFood) registerItem("food_ground_meat", new ItemFood(1, 0.1F, true));
pieMushroom = (ItemFood) registerItem("food_pie_mushroom", new ItemFood(8, 0.3F, false));
pieAmanita = (ItemFood) registerItem("food_pie_amanita", new ItemFood(8, 0.3F, false).setPotionEffect(new PotionEffect(MobEffects.POISON, 100, 0), 1.0F));
pieMeat = (ItemFood) registerItem("food_pie_meat", new ItemFood(9, 0.5F, true));
pieMelon = (ItemFood) registerItem("food_pie_melon", new ItemFood(8, 0.4F, false));
cookedClownfish = (ItemFood) registerItem("food_clownfish_cooked", new ItemFood(6, 0.5F, false));
cookedPuffer = (ItemFood) registerItem("food_pufferfish_baked", new ItemFood(6, 0.6F, false).setPotionEffect(new PotionEffect(MobEffects.POISON, 500, 1), 0.1F));
preparedPuffer = (ItemFood) registerItem("food_pufferfish_prepared", new ItemFood(2, 0.1F, false));
preparedCookedPuffer = (ItemFood) registerItem("food_pufferfish_cooked", new ItemFood(4, 0.5F, false));
fuguSac = (ItemFood) registerItem("food_fugu_sac", new ItemFood(2, 0.1F, false).setPotionEffect(new PotionEffect(MobEffects.WITHER, 2000, 1), 1.0F));
sashimi = (ItemFood) registerItem("food_sashimi", new ItemFood(2, 0.1F, false));
mulberry = (ItemFood) registerItem("food_mulberry", new ItemFood(1, 0.2F, false));
rice = (ItemFood) registerItem("food_cooked_rice", new ItemFood(2, 0.3F, false));
riceBowl = (ItemFood) registerItem("food_bowl_rice", new ItemFood(9, 0.6F, false).setMaxStackSize(1));
laxative = registerItem("laxative", new Item());
soulSandPile = registerItem("soulsand_pile", new Item());
rottenFood = (ItemFood) registerItem("rotten_food", new ItemFood(1, 0.1f, false).setPotionEffect(new PotionEffect(MobEffects.HUNGER, 2000, 1), 1.0F));
wool = (ItemColored) registerItem("wool", new ItemColored());
/*bowls = (ItemMaterial) registerItem("bowl", new ItemMaterial(
new String[]{"salt"}
));*/
salts = (ItemMaterial) registerItem("salt", new ItemMaterial(new String[] { "crystal" }));
artifactFrame = (ItemArtifactFrame) registerItem("artifact_frame", new ItemArtifactFrame());
brokenArtifact = (ItemToolShard) registerItem("tool_shard", new ItemToolShard().setMaxStackSize(1));
stainedBrick = (ItemStainedBrick) registerItem("brick_stained", new ItemStainedBrick());
shinai = (ItemShinai) registerItem("shinai", new ItemShinai());
katana = (ItemKatana) registerItem("katana", new ItemKatana());
wakizashi = (ItemWakizashi) registerItem("wakizashi", new ItemWakizashi());
tanto = (ItemTanto) registerItem("tanto", new ItemTanto());
yumi = (ItemYumi) registerItem("yumi", new ItemYumi());
ya = (ItemYa) registerItem("ya", new ItemYa());
ancestryBottle = (ItemAncestryBottle) registerItem("ancestry_bottle", new ItemAncestryBottle());
materialJapan = (ItemMaterial) registerItem("japanmat", new ItemMaterial(new String[] { "rice", "soaked_rice", "rice_stalk", "rice_hay", "rice_ash", "rush", "soaked_bamboo", "bamboo_slats", "soaked_mulberry", "mulberry_paste", "mulberry_sheet", "washi", "iron_scales", "lamellar", "paper_lamellar", "tsuka", "half_katana_blade", "ya_head", "yumi_top", "yumi_bottom", "tamahagane", "tamahagane_heated", "tamahagane_folded", "tamahagane_reheated", "tamahagane_finished", "tamahagane_wrapped", "hocho_tetsu", "hocho_tetsu_heated", "hocho_tetsu_fold_1", "hocho_tetsu_fold_2", "hocho_tetsu_finished", "helmet_undecorated", "chest_undecorated", "legs_undecorated", "boots_undecorated", "bark_sakura", "bark_mulberry" }));
samuraiHelm = (ItemSamuraiArmor) registerItem("helmet_samurai", new ItemSamuraiArmor(EntityEquipmentSlot.HEAD));
samuraiChestplate = (ItemSamuraiArmor) registerItem("chest_samurai", new ItemSamuraiArmor(EntityEquipmentSlot.CHEST));
samuraiLeggings = (ItemSamuraiArmor) registerItem("legs_samurai", new ItemSamuraiArmor(EntityEquipmentSlot.LEGS));
samuraiBoots = (ItemSamuraiArmor) registerItem("boots_samurai", new ItemSamuraiArmor(EntityEquipmentSlot.FEET));
materialBag = (ItemMaterial) registerItem("bag", new ItemMaterial(new String[] { "seed", "seed_hemp", "seed_melon", "seed_pumpkin", "seed_beets", "cocoa", "redstone", "glowstone", "sugar", "gunpowder", "flour", "sulfur", "nitre", "sawdust", "sawdust_soul", "potash", "hellfire", "kibble" }));
materialCrate = (ItemMaterial) registerItem("crate", new ItemMaterial(new String[] { "pork", "pork_raw", "chicken", "chicken_raw", "steak", "steak_raw", "mutton", "mutton_raw", "rabbit", "rabbit_raw", "egg", "slime", "enderpearl", "cactus", "inksac" }));
materialCongealed = (ItemMaterial) registerItem("congealed", new ItemMaterial(new String[] { "bone", "flesh", "eye", "amanita", "mushroom", "wart" }));
materialBolt = (ItemMaterial) registerItem("bolt", new ItemMaterial(new String[] { "fabric", "vine", "paper", "leather", "scoured_leather", "tanned_leather", "string" }));
materialBundle = (ItemMaterial) registerItem("bundle", new ItemMaterial(new String[] { "feather", "arrows", "blazerods", "oak", "birch", "spruce", "jungle", "acacia", "darkoak" }));
materialDeco = (ItemMaterial) registerItem("decomat", new ItemMaterial(new String[] { "hemp_oil", "wood_bleach", "wood_stain", "glass_chunk" }));
materialTweak = (ItemMaterial) registerItem("tweakmat", new ItemMaterial(new String[] { "ash", "ink_and_quill" }));
materialWheat = (ItemMaterial) registerItem("wheatmat", new ItemMaterial(new String[] { "hay" }));
explosion = registerItem("explosion", new Item() {
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
return;
}
});
}
use of net.minecraft.creativetab.CreativeTabs in project malmo by Microsoft.
the class CraftingHelper method dumpItemProperties.
/**
* Little utility method for dumping out a list of all the Minecraft items, plus as many useful attributes as
* we can find for them. This is primarily used by decision_tree_test.py but might be useful for real-world applications too.
* @param filename location to save the dumped list.
* @throws IOException
*/
public static void dumpItemProperties(String filename) throws IOException {
FileOutputStream fos = new FileOutputStream("..//..//build//install//Python_Examples//item_database.json");
OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
BufferedWriter writer = new BufferedWriter(osw);
JsonArray itemTypes = new JsonArray();
for (ResourceLocation i : Item.REGISTRY.getKeys()) {
Item item = Item.REGISTRY.getObject(i);
if (item != null) {
JsonObject json = new JsonObject();
json.addProperty("type", Item.REGISTRY.getNameForObject(item).toString().replace("minecraft:", ""));
json.addProperty("damageable", item.isDamageable());
json.addProperty("rendersIn3D", item.isFull3D());
json.addProperty("repairable", item.isRepairable());
CreativeTabs tab = item.getCreativeTab();
json.addProperty("tab", ((tab != null) ? item.getCreativeTab().getTabLabel() : "none"));
ItemStack is = item.getDefaultInstance();
json.addProperty("stackable", is.isStackable());
json.addProperty("enchantable", is.isItemEnchantable());
// Enum has four types, but only two (COMMON and RARE) appear to be used.
json.addProperty("rare", (is.getRarity() == EnumRarity.RARE));
json.addProperty("action", is.getItemUseAction().toString());
json.addProperty("hasSubtypes", item.getHasSubtypes());
json.addProperty("maxDamage", is.getMaxDamage());
json.addProperty("maxUseDuration", is.getMaxItemUseDuration());
json.addProperty("block", item instanceof ItemBlock);
json.addProperty("hasContainerItem", item.hasContainerItem());
if (item instanceof ItemBlock) {
ItemBlock ib = (ItemBlock) item;
Block b = ib.getBlock();
IBlockState bs = b.getDefaultState();
json.addProperty("slipperiness", b.slipperiness);
json.addProperty("hardness", bs.getBlockHardness(null, null));
json.addProperty("causesSuffocation", bs.causesSuffocation());
json.addProperty("canProvidePower", bs.canProvidePower());
json.addProperty("translucent", bs.isTranslucent());
Material mat = bs.getMaterial();
if (mat != null) {
json.addProperty("canBurn", mat.getCanBurn());
json.addProperty("isLiquid", mat.isLiquid());
json.addProperty("blocksMovement", mat.blocksMovement());
json.addProperty("needsNoTool", mat.isToolNotRequired());
json.addProperty("isReplaceable", mat.isReplaceable());
json.addProperty("pistonPushable", mat.getMobilityFlag() == EnumPushReaction.NORMAL);
json.addProperty("woodenMaterial", mat == Material.WOOD);
json.addProperty("ironMaterial", mat == Material.IRON);
json.addProperty("glassyMaterial", mat == Material.GLASS);
json.addProperty("clothMaterial", mat == Material.CLOTH);
}
boolean hasDirection = false;
boolean hasColour = false;
boolean hasVariant = false;
for (IProperty prop : bs.getProperties().keySet()) {
System.out.println(Item.REGISTRY.getNameForObject(item).toString() + " -- " + prop);
if (prop instanceof PropertyDirection)
hasDirection = true;
if (prop instanceof PropertyEnum && prop.getName().equals("color"))
hasColour = true;
if (prop instanceof PropertyEnum && prop.getName().equals("variant")) {
hasVariant = true;
json.addProperty("variant", bs.getValue(prop).toString());
}
}
json.addProperty("hasDirection", hasDirection);
json.addProperty("hasColour", hasColour);
json.addProperty("hasVariant", hasVariant);
}
itemTypes.add(json);
}
}
writer.write(itemTypes.toString());
writer.close();
}
Aggregations