added the environmental ocular

This commit is contained in:
Ellpeck 2018-12-25 19:38:25 +01:00
parent 01af6975fd
commit 0ee3802278
10 changed files with 81 additions and 23 deletions

View file

@ -52,13 +52,13 @@ public class BaublesCompat {
@SubscribeEvent
public void onCapabilitiesAttach(AttachCapabilitiesEvent<ItemStack> 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<ItemStack> event, IBauble type) {

View file

@ -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;

View file

@ -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);
}

View file

@ -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");

View file

@ -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),

View file

@ -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

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "naturesaura:items/eye_improved"
}
}

View file

@ -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"
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B