diff --git a/src/main/java/biomesoplenty/api/item/BOPItems.java b/src/main/java/biomesoplenty/api/item/BOPItems.java index 3551f6d3e..9621899f3 100644 --- a/src/main/java/biomesoplenty/api/item/BOPItems.java +++ b/src/main/java/biomesoplenty/api/item/BOPItems.java @@ -12,20 +12,32 @@ import net.minecraft.item.Item; public class BOPItems { + + public static Item berries; + public static Item shroompowder; + public static Item wildcarrots; + public static Item peach; + public static Item saladfruit; + public static Item saladveggie; + public static Item saladshroom; + public static Item earth; + public static Item persimmon; + public static Item filled_honeycomb; + public static Item ambrosia; + public static Item turnip; + public static Item pear; + public static Item ricebowl; + public static Item fleshchunk; public static Item mudball; - public static Item turnip; public static Item turnip_seeds; - public static Item persimmon; - public static Item peach; - public static Item pear; public static Item crystal_shard; public static Item honeycomb; - public static Item filled_honeycomb; public static Item gem; public static Item ash; - public static Item berries; - public static Item wildcarrots; + + public static Item dart; + public static Item dart_blower; public static Item sacred_oak_door; public static Item cherry_door; @@ -73,9 +85,6 @@ public class BOPItems public static Item gold_scythe; public static Item diamond_scythe; public static Item amethyst_scythe; - - public static Item dart; - public static Item dart_blower; - + } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/init/ModItems.java b/src/main/java/biomesoplenty/common/init/ModItems.java index 1b5ed70eb..d83b6f17d 100644 --- a/src/main/java/biomesoplenty/common/init/ModItems.java +++ b/src/main/java/biomesoplenty/common/init/ModItems.java @@ -17,6 +17,7 @@ import java.util.List; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; @@ -25,10 +26,12 @@ import net.minecraft.item.ItemFood; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSeeds; +import net.minecraft.item.ItemSoup; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemSword; +import net.minecraft.potion.Potion; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -36,6 +39,8 @@ import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.common.command.BOPCommand; +import biomesoplenty.common.item.ItemAmbrosia; +import biomesoplenty.common.item.ItemBOPFood; import biomesoplenty.common.item.ItemBOPScythe; import biomesoplenty.common.item.ItemDart; import biomesoplenty.common.item.ItemDartBlower; @@ -49,20 +54,37 @@ public class ModItems { public static void init() { + // food + ambrosia = registerItem(new ItemAmbrosia(), "ambrosia"); + berries = registerItem(new ItemBOPFood(1, 0.1F, 8), "berries"); + shroompowder = registerItem(new ItemFood(1, 0.1F, false), "shroompowder"); + ((ItemFood)shroompowder).setAlwaysEdible(); + ((ItemFood)shroompowder).setPotionEffect(Potion.confusion.id, 225, 0, 0.6F); + wildcarrots = registerItem(new ItemFood(3, 0.5F, false), "wildcarrots"); + peach = registerItem(new ItemFood(5, 0.2F, false), "peach"); + persimmon = registerItem(new ItemFood(5, 0.2F, false), "persimmon"); + filled_honeycomb = registerItem(new ItemBOPFood(3, 0.4F, 16), "filled_honeycomb"); + turnip = registerItem(new ItemFood(3, 0.4F, false), "turnip"); + pear = registerItem(new ItemFood(5, 0.3F, false), "pear"); + saladfruit = registerItem(new ItemSoup(6), "saladfruit"); + ((ItemFood)saladfruit).setPotionEffect(Potion.digSpeed.id, 775, 1, 0.05F); + saladveggie = registerItem(new ItemSoup(6), "saladveggie"); + ((ItemFood)saladveggie).setPotionEffect(Potion.nightVision.id, 1100, 1, 0.05F); // TODO: Is this the right potion effect for veggie salad? + saladshroom = registerItem(new ItemSoup(6), "saladshroom"); + ((ItemFood)saladshroom).setPotionEffect(Potion.jump.id, 550, 1, 0.05F); + ricebowl = registerItem(new ItemSoup(2), "ricebowl"); + // TODO: eating earth is supposed to kill you isn't it? + earth = registerItem(new ItemFood(0, 0.0F, false), "earth", null); // no creative tab + + fleshchunk = registerItem(new Item(), "fleshchunk"); mudball = registerItem(new ItemMudball(), "mudball"); turnip_seeds = registerItem(new ItemSeeds(BOPBlocks.turnip_block, Blocks.farmland), "turnip_seeds"); - turnip = registerItem(new ItemFood(3, 0.4F, false), "turnip"); - persimmon = registerItem(new ItemFood(5, 0.2F, false), "persimmon"); - peach = registerItem(new ItemFood(5, 0.5F, false), "peach"); - pear = registerItem(new ItemFood(5, 0.3F, false), "pear"); crystal_shard = registerItem(new Item(), "crystal_shard"); honeycomb = registerItem(new Item(), "honeycomb"); - filled_honeycomb = registerItem(new ItemFood(3, 0.4F, false), "filled_honeycomb"); gem = registerItem(new ItemGem(), "gem"); ash = registerItem(new Item(), "ash"); - berries = registerItem(new ItemFood(1, 0.1F, false), "berries"); - wildcarrots = registerItem(new ItemFood(3, 0.5F, false), "wildcarrots"); + dart = registerItem(new ItemDart(), "dart"); dart_blower = registerItem(new ItemDartBlower(), "dart_blower"); @@ -158,8 +180,17 @@ public class ModItems } public static Item registerItem(Item item, String name) + { + return registerItem(item, name, CreativeTabBOP.instance); + } + + public static Item registerItem(Item item, String name, CreativeTabs tab) { - item.setUnlocalizedName(name).setCreativeTab(CreativeTabBOP.instance); + item.setUnlocalizedName(name); + if (tab != null) + { + item.setCreativeTab(CreativeTabBOP.instance); + } GameRegistry.registerItem(item,name); BOPCommand.itemCount++; diff --git a/src/main/java/biomesoplenty/common/item/ItemAmbrosia.java b/src/main/java/biomesoplenty/common/item/ItemAmbrosia.java new file mode 100644 index 000000000..065b50ef1 --- /dev/null +++ b/src/main/java/biomesoplenty/common/item/ItemAmbrosia.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright 2014, the Biomes O' Plenty Team + * + * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. + * + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + ******************************************************************************/ + +package biomesoplenty.common.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; + +public class ItemAmbrosia extends ItemFood +{ + + public ItemAmbrosia() + { + super(6, 0.8F, false); + // can drink even when full + this.setAlwaysEdible(); + // dont' stack + this.setMaxStackSize(1); + } + + // Ambrosia takes twice as long as usual to finish + @Override + public int getMaxItemUseDuration(ItemStack stack) + { + return 64; + } + + // Use drink action/sound instead of eat + @Override + public EnumAction getItemUseAction(ItemStack stack) + { + return EnumAction.DRINK; + } + + // Loads of potion effects + @Override + protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) + { + if (worldIn.isRemote) {return;} + player.addPotionEffect(new PotionEffect(Potion.absorption.id, 5000, 4)); + player.addPotionEffect(new PotionEffect(Potion.saturation.id, 100, 1)); + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 500, 2)); + player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 500, 2)); + player.addPotionEffect(new PotionEffect(Potion.resistance.id, 600, 1)); + } + + // keep the empty bottle after finishing + @Override + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) + { + super.onItemUseFinish(stack, worldIn, playerIn); + return new ItemStack(Items.glass_bottle); + } + +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/item/ItemBOPFood.java b/src/main/java/biomesoplenty/common/item/ItemBOPFood.java new file mode 100644 index 000000000..4440c1fe6 --- /dev/null +++ b/src/main/java/biomesoplenty/common/item/ItemBOPFood.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright 2014, the Biomes O' Plenty Team + * + * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. + * + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + ******************************************************************************/ + +package biomesoplenty.common.item; + +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; + +public class ItemBOPFood extends ItemFood +{ + public int eatDuration; + + public ItemBOPFood(int amount, float saturation, int eatDuration) + { + super(amount, saturation, false); + this.eatDuration = eatDuration; + } + + @Override + public int getMaxItemUseDuration(ItemStack stack) + { + return this.eatDuration; + } + +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/util/inventory/CreativeTabBOP.java b/src/main/java/biomesoplenty/common/util/inventory/CreativeTabBOP.java index 8f2d40d84..88f44357c 100644 --- a/src/main/java/biomesoplenty/common/util/inventory/CreativeTabBOP.java +++ b/src/main/java/biomesoplenty/common/util/inventory/CreativeTabBOP.java @@ -8,11 +8,10 @@ package biomesoplenty.common.util.inventory; +import biomesoplenty.api.item.BOPItems; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; -//TODO: Fix icon public class CreativeTabBOP extends CreativeTabs { public static final CreativeTabs instance = new CreativeTabBOP(CreativeTabs.getNextID(), "tabBiomesOPlenty"); @@ -25,6 +24,6 @@ public class CreativeTabBOP extends CreativeTabs @Override public Item getTabIconItem() { - return Item.getItemFromBlock(Blocks.sapling); + return BOPItems.earth; } } diff --git a/src/main/resources/assets/biomesoplenty/models/item/ambrosia.json b/src/main/resources/assets/biomesoplenty/models/item/ambrosia.json new file mode 100644 index 000000000..368a6655b --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/ambrosia.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:items/ambrosia" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/earth.json b/src/main/resources/assets/biomesoplenty/models/item/earth.json new file mode 100644 index 000000000..3300645f0 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/earth.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:items/earth" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/ricebowl.json b/src/main/resources/assets/biomesoplenty/models/item/ricebowl.json new file mode 100644 index 000000000..413145659 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/ricebowl.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:items/ricebowl" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/saladfruit.json b/src/main/resources/assets/biomesoplenty/models/item/saladfruit.json new file mode 100644 index 000000000..ace7b0dd5 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/saladfruit.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:items/saladfruit" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/saladshroom.json b/src/main/resources/assets/biomesoplenty/models/item/saladshroom.json new file mode 100644 index 000000000..fc89c66b4 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/saladshroom.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:items/saladshroom" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/saladveggie.json b/src/main/resources/assets/biomesoplenty/models/item/saladveggie.json new file mode 100644 index 000000000..cd6338649 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/saladveggie.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:items/saladveggie" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/shroompowder.json b/src/main/resources/assets/biomesoplenty/models/item/shroompowder.json new file mode 100644 index 000000000..5cba4df8d --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/shroompowder.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:items/shroompowder" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/textures/items/ambrosia.png b/src/main/resources/assets/biomesoplenty/textures/items/ambrosia.png new file mode 100644 index 000000000..058b5177b Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/items/ambrosia.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/items/earth.png b/src/main/resources/assets/biomesoplenty/textures/items/earth.png new file mode 100644 index 000000000..a73db971a Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/items/earth.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/items/ricebowl.png b/src/main/resources/assets/biomesoplenty/textures/items/ricebowl.png new file mode 100644 index 000000000..d093226bc Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/items/ricebowl.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/items/saladfruit.png b/src/main/resources/assets/biomesoplenty/textures/items/saladfruit.png new file mode 100644 index 000000000..aa997e430 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/items/saladfruit.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/items/saladshroom.png b/src/main/resources/assets/biomesoplenty/textures/items/saladshroom.png new file mode 100644 index 000000000..10aa71e14 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/items/saladshroom.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/items/saladveggie.png b/src/main/resources/assets/biomesoplenty/textures/items/saladveggie.png new file mode 100644 index 000000000..9b98094bb Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/items/saladveggie.png differ diff --git a/src/main/resources/assets/biomesoplenty/textures/items/shroompowder.png b/src/main/resources/assets/biomesoplenty/textures/items/shroompowder.png new file mode 100644 index 000000000..5842bffd5 Binary files /dev/null and b/src/main/resources/assets/biomesoplenty/textures/items/shroompowder.png differ