From 5bd192645324332d64dfa70eb082cf654618c847 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 4 Jan 2016 17:25:03 +0100 Subject: [PATCH] Added bacon --- .../actuallyadditions/items/ItemFoods.java | 29 ++++++++++++++++-- .../items/metalists/TheFoods.java | 3 +- .../textures/items/itemEllspeck.png | Bin 0 -> 990 bytes .../textures/items/itemFoodBacon.png | Bin 0 -> 1506 bytes 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/assets/actuallyadditions/textures/items/itemEllspeck.png create mode 100644 src/main/resources/assets/actuallyadditions/textures/items/itemFoodBacon.png diff --git a/src/main/java/de/ellpeck/actuallyadditions/items/ItemFoods.java b/src/main/java/de/ellpeck/actuallyadditions/items/ItemFoods.java index 6a159ca52..947df3498 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/items/ItemFoods.java +++ b/src/main/java/de/ellpeck/actuallyadditions/items/ItemFoods.java @@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.items.base.ItemFoodBase; import de.ellpeck.actuallyadditions.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.util.ModUtil; import de.ellpeck.actuallyadditions.util.StringUtil; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; @@ -34,6 +35,10 @@ public class ItemFoods extends ItemFoodBase{ public static final TheFoods[] allFoods = TheFoods.values(); @SideOnly(Side.CLIENT) public IIcon[] textures; + @SideOnly(Side.CLIENT) + private IIcon iconEllspeck; + + private static final String ELLSPECK = "ellspeck"; public ItemFoods(String name){ super(0, 0.0F, false, name); @@ -78,10 +83,21 @@ public class ItemFoods extends ItemFoodBase{ return stack.getItemDamage() >= allFoods.length ? 0 : allFoods[stack.getItemDamage()].saturation; } + @Override + public IIcon getIcon(ItemStack stack, int pass){ + return getIconIndex(stack); + } + @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1){ - return par1 >= textures.length ? null : textures[par1]; + public IIcon getIconIndex(ItemStack stack){ + int damage = stack.getItemDamage(); + if(damage == TheFoods.BACON.ordinal() && StringUtil.equalsToLowerCase(stack.getDisplayName(), ELLSPECK)){ + return this.iconEllspeck; + } + else{ + return damage >= textures.length ? null : textures[damage]; + } } @Override @@ -114,5 +130,14 @@ public class ItemFoods extends ItemFoodBase{ for(int i = 0; i < textures.length; i++){ textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allFoods[i].name); } + this.iconEllspeck = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":itemEllspeck"); + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){ + if(stack.getItemDamage() == TheFoods.BACON.ordinal() && StringUtil.equalsToLowerCase(stack.getDisplayName(), ELLSPECK)){ + String strg = "Yes, this is an ugly texture of bacon with its legs behind its head. This is an homage to Ellpeck, the mod author, being able to put his legs behind his head. Wasn't my idea, so don't judge me."; + list.addAll(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strg, 200)); + } } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/items/metalists/TheFoods.java b/src/main/java/de/ellpeck/actuallyadditions/items/metalists/TheFoods.java index 6113b16d3..042219f8f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/items/metalists/TheFoods.java +++ b/src/main/java/de/ellpeck/actuallyadditions/items/metalists/TheFoods.java @@ -36,7 +36,8 @@ public enum TheFoods{ RICE("Rice", 2, 1F, false, 10, EnumRarity.uncommon), RICE_BREAD("RiceBread", 8, 3F, false, 25, EnumRarity.uncommon), DOUGHNUT("Doughnut", 4, 0.5F, false, 10, EnumRarity.epic), - CHOCOLATE_TOAST("ChocolateToast", 8, 1.4F, false, 40, EnumRarity.rare); + CHOCOLATE_TOAST("ChocolateToast", 8, 1.4F, false, 40, EnumRarity.rare), + BACON("Bacon", 4, 0.5F, false, 30, EnumRarity.common); public final String name; public final int healAmount; diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemEllspeck.png b/src/main/resources/assets/actuallyadditions/textures/items/itemEllspeck.png new file mode 100644 index 0000000000000000000000000000000000000000..e2ae5d1aa383072de01b65595c590f3b127ffa8a GIT binary patch literal 990 zcmV<410np0P)N2bZe?^J zG%heMHvEiZ-v9suTuDShR9HvFmD@{HQ5eM)iJp5DdMSwhg`P&7G}EXob-d*0q~iti z0!oTvB_ULz8I*-WMw(!#nU_pQtuQqS!@}}XikKMDg&=zAX|=zt`?TGDGwMS&@WYw4 zzrEHvd(IjC0Q^^2aXVqf?SvJ#6IS%be)lMdeaQpjZ&`)8rC0J2M58oTxCZrXe3UnsgL;)K->7kacN~j`A z_XaEK=;6fodxiMjS_&%gIK_@fu3)^bOqQQ%jb^rTKd_<>ndspJg-u+F$4KD`^rjuc zY+Z)bsMwkk&h__-2`l5C&TORwE1E3V=Yt^g?idkLlYyzLN$5)r#gMoUzP1lA#HU`2upA3vKVjy(iZH7<;o zC&>Q;FN&ftU6G8QI6E2~@{#=OBld4}66*wu)o_K?u zAQKKUeqWV>m&LK@I%UJNoTFH7KaY-x18WK>d|f@kiiB>Wqe5n@Gh~5@@^~!W$z{XU zyy>mOiVD+Ahm5Jfc$vd%xSBJ4by!is8EzHR(}WduDar=PZA7A#W#l;hT`v3p{ M07*qoM6N<$f_TozDgXcg literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemFoodBacon.png b/src/main/resources/assets/actuallyadditions/textures/items/itemFoodBacon.png new file mode 100644 index 0000000000000000000000000000000000000000..5822fc51a29c0b642133a1b28955f021a4109b9e GIT binary patch literal 1506 zcmV<81s(c{P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;VI^GGzb&1ye~xK~z{r#a3xkQ)d+RU)62_LJ}Zs*+@b{ zl1mm63;|`86fp(I1x2X~DwekHwxAJ0RssZMi2{ua0)j}XwP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