From 0ee38022785bfe68b06c0b9d95325263b1efb9bb Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 25 Dec 2018 19:38:25 +0100 Subject: [PATCH] added the environmental ocular --- .../naturesaura/compat/BaublesCompat.java | 8 +-- .../naturesaura/events/ClientEvents.java | 53 ++++++++++++------ .../de/ellpeck/naturesaura/items/ItemEye.java | 4 +- .../ellpeck/naturesaura/items/ModItems.java | 3 +- .../naturesaura/recipes/ModRecipes.java | 8 +++ .../assets/naturesaura/lang/en_US.lang | 1 + .../naturesaura/models/item/eye_improved.json | 6 ++ .../en_us/entries/items/eye_improved.json | 21 +++++++ .../naturesaura/textures/gui/overlays.png | Bin 1333 -> 1791 bytes .../textures/items/eye_improved.png | Bin 0 -> 636 bytes 10 files changed, 81 insertions(+), 23 deletions(-) create mode 100644 src/main/resources/assets/naturesaura/models/item/eye_improved.json create mode 100644 src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/items/eye_improved.json create mode 100644 src/main/resources/assets/naturesaura/textures/items/eye_improved.png diff --git a/src/main/java/de/ellpeck/naturesaura/compat/BaublesCompat.java b/src/main/java/de/ellpeck/naturesaura/compat/BaublesCompat.java index cbe91c6d..3247cffb 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/BaublesCompat.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/BaublesCompat.java @@ -52,13 +52,13 @@ public class BaublesCompat { @SubscribeEvent public void onCapabilitiesAttach(AttachCapabilitiesEvent event) { Item item = event.getObject().getItem(); - if (item == ModItems.EYE) { + if (item == ModItems.EYE || item == ModItems.EYE_IMPROVED) this.addCap(event, this.eye); - } else if (item == ModItems.AURA_CACHE) { + else if (item == ModItems.AURA_CACHE) this.addCap(event, this.cache); - } else if (item == ModItems.SHOCKWAVE_CREATOR) { + else if (item == ModItems.SHOCKWAVE_CREATOR) this.addCap(event, this.shockwaveCreator); - } + } private void addCap(AttachCapabilitiesEvent event, IBauble type) { diff --git a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java index 14c74599..e2a94cc4 100644 --- a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java +++ b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java @@ -181,6 +181,7 @@ public class ClientEvents { if (mc.player != null) { ItemStack cache = ItemStack.EMPTY; ItemStack eye = ItemStack.EMPTY; + ItemStack eyeImproved = ItemStack.EMPTY; if (Compat.baubles) { IItemHandler baubles = BaublesApi.getBaublesHandler(mc.player); @@ -191,19 +192,21 @@ public class ClientEvents { cache = slot; else if (slot.getItem() == ModItems.EYE) eye = slot; + else if (slot.getItem() == ModItems.EYE_IMPROVED) + eyeImproved = slot; } } } - if (cache.isEmpty() || eye.isEmpty()) { - for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) { - ItemStack slot = mc.player.inventory.getStackInSlot(i); - if (!slot.isEmpty()) { - if (slot.getItem() == ModItems.AURA_CACHE) - cache = slot; - else if (slot.getItem() == ModItems.EYE && i <= 8) - eye = slot; - } + for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) { + ItemStack slot = mc.player.inventory.getStackInSlot(i); + if (!slot.isEmpty()) { + if (slot.getItem() == ModItems.AURA_CACHE) + cache = slot; + else if (slot.getItem() == ModItems.EYE && i <= 8) + eye = slot; + else if (slot.getItem() == ModItems.EYE_IMPROVED) + eyeImproved = slot; } } @@ -232,7 +235,7 @@ public class ClientEvents { GlStateManager.popMatrix(); } - if (!eye.isEmpty()) { + if (!eye.isEmpty() || !eyeImproved.isEmpty()) { GlStateManager.pushMatrix(); mc.getTextureManager().bindTexture(OVERLAYS); @@ -243,15 +246,33 @@ public class ClientEvents { float totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F); int tHeight = MathHelper.ceil(MathHelper.clamp(totalPercentage, 0F, 1F) * 50); + int y = eyeImproved.isEmpty() ? 10 : 36; if (tHeight < 50) - Gui.drawModalRectWithCustomSizedTexture(3, 10, 6, 12, 6, 50 - tHeight, 256, 256); + Gui.drawModalRectWithCustomSizedTexture(3, y, 6, 12, 6, 50 - tHeight, 256, 256); if (tHeight > 0) - Gui.drawModalRectWithCustomSizedTexture(3, 10 + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256); + Gui.drawModalRectWithCustomSizedTexture(3, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256); - if (totalPercentage > 1F) - mc.fontRenderer.drawString("+", 10F, 9.5F, 0x53a008, true); - if (totalPercentage < 0F) - mc.fontRenderer.drawString("-", 10F, 53.5F, 0x53a008, true); + if (!eyeImproved.isEmpty()) { + GlStateManager.color(160 / 255F, 83 / 255F, 8 / 255F); + + int topHeight = MathHelper.ceil(MathHelper.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25); + if (topHeight < 25) + Gui.drawModalRectWithCustomSizedTexture(3, 10, 18, 12, 6, 25 - topHeight, 256, 256); + if (topHeight > 0) + Gui.drawModalRectWithCustomSizedTexture(3, 10 + 25 - topHeight, 12, 12 + 25 - topHeight, 6, topHeight, 256, 256); + + int bottomHeight = MathHelper.ceil(MathHelper.clamp((totalPercentage + 1F) * 2F - 1F, 0F, 1F) * 25); + if (bottomHeight < 25) + Gui.drawModalRectWithCustomSizedTexture(3, 87, 18, 12, 6, 25 - bottomHeight, 256, 256); + if (bottomHeight > 0) + Gui.drawModalRectWithCustomSizedTexture(3, 87 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256); + } + + int color = eyeImproved.isEmpty() ? 0x53a008 : 0xa05308; + if (totalPercentage > (eyeImproved.isEmpty() ? 1F : 1.5F)) + mc.fontRenderer.drawString("+", 10F, 9.5F, color, true); + if (totalPercentage < (eyeImproved.isEmpty() ? 0F : -0.5F)) + mc.fontRenderer.drawString("-", 10F, eyeImproved.isEmpty() ? 53.5F : 105.5F, color, true); GlStateManager.pushMatrix(); float scale = 0.75F; diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java b/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java index c0720035..796bda15 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java @@ -11,8 +11,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class ItemEye extends ItemImpl implements ITrinketItem { - public ItemEye() { - super("eye"); + public ItemEye(String name) { + super(name); this.setMaxStackSize(1); } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java index fe011baf..d962b613 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java @@ -26,7 +26,8 @@ public final class ModItems { public static final Item INFUSED_PANTS = new ItemArmorNA("infused_iron_pants", ARMOR_INFUSED, EntityEquipmentSlot.LEGS); public static final Item INFUSED_SHOES = new ItemArmorNA("infused_iron_shoes", ARMOR_INFUSED, EntityEquipmentSlot.FEET); - public static final Item EYE = new ItemEye(); + public static final Item EYE = new ItemEye("eye"); + public static final Item EYE_IMPROVED = new ItemEye("eye_improved"); public static final Item GOLD_FIBER = new ItemGoldFiber(); public static final Item GOLD_LEAF = new ItemImpl("gold_leaf"); public static final Item INFUSED_IRON = new ItemImpl("infused_iron"); diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index 231de24e..269653e2 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -34,6 +34,14 @@ public final class ModRecipes { Ingredient.fromItem(Items.GOLD_INGOT), Ingredient.fromItem(ModItems.GOLD_LEAF), Ingredient.fromItem(ModItems.GOLD_LEAF)).register(); + new TreeRitualRecipe(new ResourceLocation(NaturesAura.MOD_ID, "eye_improved"), + Ingredient.fromStacks(new ItemStack(Blocks.SAPLING)), new ItemStack(ModItems.EYE_IMPROVED), 500, + Ingredient.fromItem(ModItems.EYE), + Ingredient.fromItem(ModItems.SKY_INGOT), + Ingredient.fromItem(ModItems.SKY_INGOT), + Helper.blockIng(ModBlocks.END_FLOWER), + Ingredient.fromItem(ModItems.GOLD_LEAF), + Ingredient.fromItem(ModItems.GOLD_LEAF)).register(); new TreeRitualRecipe(new ResourceLocation(NaturesAura.MOD_ID, "nature_altar"), Helper.blockIng(Blocks.SAPLING), new ItemStack(ModBlocks.NATURE_ALTAR), 500, Helper.blockIng(Blocks.STONE), diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang index c01e6682..1c4b2a0d 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -38,6 +38,7 @@ tile.naturesaura.animal_generator.name=Disentangler of Mortals tile.naturesaura.end_flower.name=Rose of Oblivion item.naturesaura.eye.name=Environmental Eye +item.naturesaura.eye_improved.name=Environmental Ocular item.naturesaura.gold_fiber.name=Brilliant Fiber item.naturesaura.gold_leaf.name=Gold Leaf item.naturesaura.infused_iron.name=Infused Iron diff --git a/src/main/resources/assets/naturesaura/models/item/eye_improved.json b/src/main/resources/assets/naturesaura/models/item/eye_improved.json new file mode 100644 index 00000000..8d587acb --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/eye_improved.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "naturesaura:items/eye_improved" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/items/eye_improved.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/items/eye_improved.json new file mode 100644 index 00000000..8157605b --- /dev/null +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/items/eye_improved.json @@ -0,0 +1,21 @@ +{ + "name": "Environmental Ocular", + "icon": "naturesaura:eye_improved", + "category": "items", + "advancement": "naturesaura:end_flower", + "pages": [ + { + "type": "text", + "text": "The $(l:items/eye)Environmental Eye$() is very useful in theory; however, a lot of magical botanists struggle with its limited range of gauging $(aura) in the environment around them. A simple solution to this probem is the $(item)Environmental Ocular$().$(br)While working similarly to the $(item)Environmental Eye$(), the main difference is its much bigger gauge for $(aura) in the area: It is $(thing)twice as large$()." + }, + { + "type": "text", + "text": "An additional perk is that, while the $(item)Environmental Eye$() needs to be held in the hotbar, the $(item)Environmental Ocular$() can be anywhere in the user's inventory to work.$(p)It should be noted that all of the features of the $(item)Environmental Eye$() that were not mentioned also carry over to the $(item)Environmental Ocular$()." + }, + { + "type": "naturesaura:tree_ritual", + "text": "Creating the $(item)Environmental Ocular$() using the $(l:practices/tree_ritual)Ritual of the Forest$()", + "recipe": "naturesaura:eye_improved" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/gui/overlays.png b/src/main/resources/assets/naturesaura/textures/gui/overlays.png index 5b6bdd2b7311b0bd444efb98b13871ed6e11376e..a93eac7c196f6413fa15e43fb83aa0ef2df06236 100644 GIT binary patch literal 1791 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5Fo{p?&#~tz_78O`%fY(0|PTd zfKP}kP+Uz-O+!ONS6A2A*x1t2(#FQd!NI}P)6>h#%g@g*JUl!vFR!?`xTdD2v$M0O zr)SlwRcqI--MMq;-o1P8-o5+g%^RR0qhK@yhGGc(2OJ9?k@&pP>l(rIsj|=o#u6CTq>{2AZ?k z)5S5QBJS;7L$B;;hSrBYZaG1boSK)iCYo*bNPf-2)aP=7LB~iW{ejH6(9$eq??{Q!%*;+=RmvxgHG#qhWdli4AYYK9TT28Upjp{ zpXj=yHEXZG&fI+SjGVmuPyXq~QqN6$HhZ^oT~FHglfV7&myaJ0^4r+kpI83y*Wux; zGt31xa?7`GH?MnKW9Ps8a;6#7czy|nX=!o|%a<>I`SfY4yhQ$N9)|0AKznYsH|&4z z>@Y2DpPv7V_5N=Pe{L4nx&1u4;p4or9ecLOn*aH+>Gadn`ulz`o!%^^pLx9c)@ku1c&U>o-O>#ymI61jKY0Hg3$-uBHOZ!jF#1PopanPrbZ zT1fv_eqhA#`)}R9v-Um5*%+p!?mNc&|LXqIty1QH!WS=mC3A diff --git a/src/main/resources/assets/naturesaura/textures/items/eye_improved.png b/src/main/resources/assets/naturesaura/textures/items/eye_improved.png new file mode 100644 index 0000000000000000000000000000000000000000..874f3cc5900ffe465cde5fe8e30b3c9b33eaa4b6 GIT binary patch literal 636 zcmV-?0)zdDP)N2bZe?^J zG%hhNHDpIvQUCw}`bk7VR5(vaA2lY9G}5Bl6V11 zWgdcpMsJl-FT4;HP+!O!U!winE#ETxk4BoT|D2w)*V^L=^?E&+S&T-b5qjJ51}+|L z*LtBjZGEZ2!L@~Iwfc{Jh@wavR*cU#wb{{lO#ClqD2j&(# zmPgQiBxNJ*CuPVwJ+orP(j)5}d2ADvrC5ynOUE*XK&@8$69ET*6X)h%Sx0%)#yiK`<5Q2b!i)??`S0qjD-u9NvC5((`~6W=B9 zZhgnrH^0c?<(90e@`U9A9)WvLCX-r8B|r4Qw%+f_jwnb!&};IiNN?9Z$!KtVPjHcP z<%huC=Ju{^NkIZcfB{z>Noq1C(j$t-@JFlj*;!!r>JMkO4!-5J`X!Q{^I8)14AQ3=%67h*$P>4UR(} z$SAr9?SX)|a@%nUQ7b$%x&96`%6xcXeuxMw1d7Dtg2qVOAY W%RLG`c5^iV0000