From 5fac95002a607ad1dd56214ad61a5da80a505cb9 Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 9 Jan 2019 17:23:22 +0200 Subject: [PATCH] Implement super sugary cereal --- .../com/minelittlepony/unicopia/UItems.java | 14 ++++------ .../unicopia/item/ItemCereal.java | 26 ++++++++++++++++++ .../unicopia/models/item/sugar_cereal.json | 6 ++++ .../unicopia/textures/items/sugar_cereal.png | Bin 0 -> 253 bytes 4 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/minelittlepony/unicopia/item/ItemCereal.java create mode 100644 src/main/resources/assets/unicopia/models/item/sugar_cereal.json create mode 100644 src/main/resources/assets/unicopia/textures/items/sugar_cereal.png diff --git a/src/main/java/com/minelittlepony/unicopia/UItems.java b/src/main/java/com/minelittlepony/unicopia/UItems.java index 8eef0bae..7bfc7b88 100644 --- a/src/main/java/com/minelittlepony/unicopia/UItems.java +++ b/src/main/java/com/minelittlepony/unicopia/UItems.java @@ -1,6 +1,7 @@ package com.minelittlepony.unicopia; import com.minelittlepony.unicopia.item.ItemApple; +import com.minelittlepony.unicopia.item.ItemCereal; import com.minelittlepony.unicopia.item.ItemCloud; import com.minelittlepony.unicopia.item.ItemCurse; import com.minelittlepony.unicopia.item.ItemOfHolding; @@ -24,7 +25,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemDoor; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemSeedFood; -import net.minecraft.item.ItemSoup; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.IRecipe; @@ -96,13 +96,8 @@ public class UItems { .setTranslationKey("alfalfa_leaves") .setRegistryName(Unicopia.MODID, "alfalfa_leaves"); - public static final Item cereal = new ItemSoup(15) - .setTranslationKey("cereal") - .setRegistryName(Unicopia.MODID, "cereal"); - - public static final Item sugar_cereal = new ItemSoup(15) - .setTranslationKey("sugar_cereal") - .setRegistryName(Unicopia.MODID, "sugar_cereal"); + public static final Item cereal = new ItemCereal(Unicopia.MODID, "cereal", 9, 0.8F); + public static final Item sugar_cereal = new ItemCereal(Unicopia.MODID, "sugar_cereal", 20, -2).setAlwaysEdible(); public static final ItemTomato tomato = new ItemTomato(Unicopia.MODID, "tomato", 4, 34); public static final ItemTomato cloudsdale_tomato = new ItemTomato(Unicopia.MODID, "cloudsdale_tomato", 16, 4); @@ -120,7 +115,8 @@ public class UItems { cloud_stairs, cloud_slab, cloud_farmland, mist_door, anvil, bag_of_holding, spell, curse, - alfalfa_seeds, alfalfa_leaves, cereal, + alfalfa_seeds, alfalfa_leaves, + cereal, sugar_cereal, cloudsdale_tomato, tomato_seeds, tomato); diff --git a/src/main/java/com/minelittlepony/unicopia/item/ItemCereal.java b/src/main/java/com/minelittlepony/unicopia/item/ItemCereal.java new file mode 100644 index 00000000..5ed324c0 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/item/ItemCereal.java @@ -0,0 +1,26 @@ +package com.minelittlepony.unicopia.item; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Items; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class ItemCereal extends ItemFood { + + public ItemCereal(String domain, String name, int amount, float saturation) { + super(amount, saturation, false); + + setTranslationKey(name); + setRegistryName(domain, name); + setMaxStackSize(1); + } + + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { + super.onItemUseFinish(stack, worldIn, entityLiving); + + this.setAlwaysEdible(); + + return new ItemStack(Items.BOWL); + } +} diff --git a/src/main/resources/assets/unicopia/models/item/sugar_cereal.json b/src/main/resources/assets/unicopia/models/item/sugar_cereal.json new file mode 100644 index 00000000..bde35e7c --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/sugar_cereal.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:items/sugar_cereal" + } +} diff --git a/src/main/resources/assets/unicopia/textures/items/sugar_cereal.png b/src/main/resources/assets/unicopia/textures/items/sugar_cereal.png new file mode 100644 index 0000000000000000000000000000000000000000..716fc901769b81778b81dfe2f63bc071ebd8ed8e GIT binary patch literal 253 zcmV