Aether Lore changes

This commit is contained in:
Kino 2017-11-21 18:17:22 -05:00
parent a46264b9be
commit 38cea09c44
6 changed files with 111 additions and 17 deletions

View file

@ -3,6 +3,7 @@ package com.legacy.aether.client.gui;
import java.util.HashMap;
import java.util.Iterator;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
@ -13,6 +14,7 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.legacy.aether.common.containers.ContainerLore;
import com.legacy.aether.common.registry.AetherLore;
import com.legacy.aether.common.registry.lore.AetherLoreEntry;
import com.legacy.aether.common.registry.lore.EndLoreEntry;
import com.legacy.aether.common.registry.lore.NetherLoreEntry;
@ -25,6 +27,8 @@ public class GuiLore extends GuiContainer
private static final ResourceLocation TEXTURE_LORE = new ResourceLocation("aether_legacy", "textures/gui/lore.png");
private static final ResourceLocation TEXTURE_LORE_BOOK = new ResourceLocation("aether_legacy", "textures/gui/lore_book.png");
private HashMap<String, LoreEntry> lore_pages = new HashMap<String, LoreEntry>();
public GuiLore(InventoryPlayer inventoryplayer)
@ -55,12 +59,32 @@ public class GuiLore extends GuiContainer
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRendererObj.drawString("Book of Lore:", 37, 18, 4210752);
this.fontRendererObj.drawString("Add Object", 37, 28, 4210752);
this.fontRendererObj.drawString("Book", 32, -5, 4210752);
this.fontRendererObj.drawString("of Lore:", 24, 4, 4210752);
//this.fontRendererObj.drawString("Add Object", 70, 0, 4210752);
this.fontRendererObj.drawString("Item :", 75, 0, 4210752);
this.fontRendererObj.drawString("Item : ", 46, 72, 4210752);
ItemStack searchedStack = ((ContainerLore)this.inventorySlots).loreSlot.getStackInSlot(0);
if (searchedStack != null)
{
this.drawCenteredString(this.fontRendererObj, searchedStack.getRarity().rarityColor.toString() + searchedStack.getItem().getItemStackDisplayName(searchedStack), 71, 18, 4210752);
int size = 0;
for (String lore : this.fontRendererObj.listFormattedStringToWidth(AetherLore.getLoreEntry(searchedStack), 111))
{
this.fontRendererObj.drawString(lore, ((size >= 6 ? 184 : 71) - this.fontRendererObj.getStringWidth(lore) / 2), (size >= 6 ? -68 : 28) + (10 * size), 4210752);
//this.drawCenteredString(this.fontRendererObj, lore, size >= 6 ? 182 : 71, (size >= 6 ? -70 : 28) + (10 * size), 4210752);
size++;
}
//this.fontRendererObj.drawSplitString(str, x, y, wrapWidth, textColor);
}
/*ItemStack searchedStack = ((ContainerLore)this.inventorySlots).loreSlot.getStackInSlot(0);
if (searchedStack != null)
{
Iterator<LoreEntry> entries = this.lore_pages.values().iterator();
@ -76,22 +100,24 @@ public class GuiLore extends GuiContainer
if (loreItem != null && (information.base.getItemDamage() == searchedStack.getItemDamage() || information.base.isItemStackDamageable()) && loreItem == searchedStack.getItem())
{
GlStateManager.pushMatrix();
GlStateManager.scale(0.8F, 1.2F, 0.0F);
//GlStateManager.pushMatrix();
this.fontRendererObj.drawString(information.s, 164, 14, 4210752);
this.fontRendererObj.drawString(information.s1, 164, 28, 4210752);
this.fontRendererObj.drawString(information.s2, 164, 38, 4210752);
this.fontRendererObj.drawString(information.s3, 164, 48, 4210752);
this.fontRendererObj.drawString(information.s4, 164, 58, 4210752);
this.fontRendererObj.drawString(information.s5, 164, 68, 4210752);
this.fontRendererObj.drawString(information.s6, 164, 78, 4210752);
this.drawCenteredString(this.fontRendererObj, information.base.getRarity().rarityColor.toString() + information.s, 71, 18, 4210752);
GlStateManager.popMatrix();
this.fontRendererObj.drawSplitString(information.s1 + " " + information.s2 + " " + information.s3 + " " + information.s4, 18, 30, 120, 4210752);
//this.fontRendererObj.drawStringWithShadow(information.base.getRarity().rarityColor.toString() + information.s, 18, 18, 4210752);
//this.fontRendererObj.drawString(information.s1, 134, 28, 4210752);
//this.fontRendererObj.drawString(information.s2, 134, 38, 4210752);
//this.fontRendererObj.drawString(information.s3, 134, 48, 4210752);
//this.fontRendererObj.drawString(information.s4, 134, 58, 4210752);
//this.fontRendererObj.drawString(information.s5, 134, 68, 4210752);
//this.fontRendererObj.drawString(information.s6, 134, 78, 4210752);
//GlStateManager.popMatrix();
}
}
}
}
}*/
}
public void onGuiClosed()
@ -102,9 +128,16 @@ public class GuiLore extends GuiContainer
protected void drawGuiContainerBackgroundLayer(float f, int i1, int i2)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(TEXTURE_LORE);
int j = (this.width - this.xSize) / 2;
int k = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize);
this.mc.renderEngine.bindTexture(TEXTURE_LORE);
Gui.drawScaledCustomSizeModalRect(j, k - 4, 0, 0, 120, 120, this.xSize, this.ySize + 61, 120, 120);
this.mc.renderEngine.bindTexture(TEXTURE_LORE_BOOK);
Gui.drawModalRectWithCustomSizedTexture(j - 1, k - 20, 0, 0, this.xSize + 20, this.ySize - 60, 275, 315);
Gui.drawModalRectWithCustomSizedTexture(j + 90, k - 5, 0, 225, this.xSize + 20, this.ySize - 177, 500, 500);
//Gui.drawScaledCustomSizeModalRect(j - 1, k - 20, 200, 200, 100, 100, this.xSize + 20, this.ySize + 120, 100, 100);
}
}

View file

@ -33,7 +33,7 @@ public class ContainerLore extends Container
this.loreSlot = new InventoryLore(inventory.player);
this.addSlotToContainer(new Slot(this.loreSlot, 0, 82, 66));
this.addSlotToContainer(new Slot(this.loreSlot, 0, 104, -4));
}
protected void retrySlotClick(int var1, int var2, boolean var3, EntityPlayer var4) {}

View file

@ -0,0 +1,58 @@
package com.legacy.aether.common.registry;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStreamReader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.IResource;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.IOUtils;
public class AetherLore
{
public static String getLoreEntry(ItemStack stack)
{
ResourceLocation location = new ResourceLocation(stack.getItem().getRegistryName().getResourceDomain(), "lore/" + stack.getUnlocalizedName().replace("item.", "") + ".txt");
IResource iresource = null;
try
{
StringBuilder stringBuilder = new StringBuilder();
iresource = Minecraft.getMinecraft().getResourceManager().getResource(location);
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8));
String s;
while ((s = bufferedreader.readLine()) != null)
{
s = " " + s.trim();
if (!s.isEmpty())
{
stringBuilder.append(s);
}
}
if (stringBuilder.length() != 0)
{
return stringBuilder.toString();
}
}
catch (IOException var8)
{
System.out.println("Cannot find lore entry for " + location.toString());
}
finally
{
IOUtils.closeQuietly((Closeable)iresource);
}
return "missingno";
}
}

View file

@ -0,0 +1,3 @@
A shield that protects the user from most projectiles.
It will reflect the projectile back at the thrower and cause damage to them.
Each time a projectile is reflected the shield will be damaged.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB