Skip to content

Commit

Permalink
Made battlesigns have editable text
Browse files Browse the repository at this point in the history
  • Loading branch information
fuj1n committed Sep 12, 2014
1 parent fc0d73d commit 3d028e7
Show file tree
Hide file tree
Showing 20 changed files with 545 additions and 205 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 24 additions & 22 deletions src/main/java/tconstruct/client/pages/ModifierPage.java
@@ -1,5 +1,6 @@
package tconstruct.client.pages;

import java.util.*;
import mantle.client.pages.BookPage;
import mantle.lib.client.MantleClientRegistry;
import net.minecraft.client.renderer.RenderHelper;
Expand All @@ -8,9 +9,6 @@
import org.lwjgl.opengl.*;
import org.w3c.dom.*;

import java.util.LinkedList;
import java.util.List;

public class ModifierPage extends BookPage
{
String type;
Expand All @@ -29,27 +27,30 @@ public void readPageFromXML (Element element)
type = nodes.item(0).getTextContent();

nodes = element.getElementsByTagName("recipe");
if (nodes != null) {
if (nodes != null)
{
String recipe = nodes.item(0).getTextContent();
icons = MantleClientRegistry.getRecipeIcons(recipe);

if(type.equals("travelmulti"))
if (type.equals("travelmulti"))
{
List<ItemStack[]> stacks = new LinkedList<ItemStack[]>();
List<String> tools = new LinkedList<String>();
String[] suffixes = new String[] { "goggles", "vest", "wings", "boots", "glove", "belt" };
for(String suffix : suffixes)
for (String suffix : suffixes)
{
ItemStack[] icons2 = MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix);
if(icons2 != null) {
if (icons2 != null)
{
stacks.add(icons2);
tools.add(suffix);
}
}

iconsMulti = new ItemStack[stacks.size()][];
toolMulti = new ItemStack[stacks.size()];
for(int i = 0; i < stacks.size(); i++) {
for (int i = 0; i < stacks.size(); i++)
{
iconsMulti[i] = stacks.get(i);
toolMulti[i] = MantleClientRegistry.getManualIcon("travel" + tools.get(i));
}
Expand All @@ -66,9 +67,9 @@ public void readPageFromXML (Element element)
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
{
String tStation = new String("Tool Station");
if(icons.length > 4)
if (icons.length > 4)
tStation = "Tinker Table";
if(icons.length > 3)
if (icons.length > 3)
tStation = "Tool Forge";
if (isTranslatable)
tStation = StatCollector.translateToLocal(tStation);
Expand All @@ -80,34 +81,35 @@ public void renderContentLayer (int localWidth, int localHeight, boolean isTrans
ItemStack toolstack = MantleClientRegistry.getManualIcon("ironpick");
if (type.equals("weapon"))
toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
if(type.equals("travelgoggles"))
if (type.equals("travelgoggles"))
toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
if(type.equals("travelvest"))
if (type.equals("travelvest"))
toolstack = MantleClientRegistry.getManualIcon("travelvest");
if(type.equals("travelwings"))
if (type.equals("travelwings"))
toolstack = MantleClientRegistry.getManualIcon("travelwings");
if(type.equals("travelboots"))
if (type.equals("travelboots"))
toolstack = MantleClientRegistry.getManualIcon("travelboots");
if(type.equals("travelbelt"))
if (type.equals("travelbelt"))
toolstack = MantleClientRegistry.getManualIcon("travelbelt");
if(type.equals("travelglove"))
if (type.equals("travelglove"))
toolstack = MantleClientRegistry.getManualIcon("travelglove");
if(type.equals("travelmulti"))
if (type.equals("travelmulti"))
toolstack = toolMulti[counter];

// update displayed item
if(iconsMulti != null && iconsMulti.length > 0 && type.equals("travelmulti") && System.currentTimeMillis() - lastUpdate > 1000)
if (iconsMulti != null && iconsMulti.length > 0 && type.equals("travelmulti") && System.currentTimeMillis() - lastUpdate > 1000)
{
lastUpdate = System.currentTimeMillis();
counter++;
if(counter >= iconsMulti.length)
if (counter >= iconsMulti.length)
counter = 0;
icons = iconsMulti[counter];
toolstack = toolMulti[counter];
}

manual.renderitem.zLevel = 100;
if(icons.length < 4) {
if (icons.length < 4)
{
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, toolstack, (localWidth + 54) / 2, (localHeight + 54) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 130) / 2, (localHeight + 54) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
Expand All @@ -121,7 +123,7 @@ public void renderContentLayer (int localWidth, int localHeight, boolean isTrans
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth - 2) / 2, (localHeight + 36) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth - 2) / 2, (localHeight + 74) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[3], (localWidth + 36) / 2, (localHeight + 36) / 2);
if(icons[4] != null)
if (icons[4] != null)
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[4], (localWidth + 36) / 2, (localHeight + 74) / 2);
}
manual.renderitem.zLevel = 0;
Expand All @@ -137,7 +139,7 @@ public void renderContentLayer (int localWidth, int localHeight, boolean isTrans
public void renderBackgroundLayer (int localWidth, int localHeight)
{
manual.getMC().getTextureManager().bindTexture(background);
if(icons.length > 3)
if (icons.length > 3)
manual.drawTexturedModalRect(localWidth - 7, localHeight + 32, 0, 80, 182, 78);
else
manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
Expand Down
47 changes: 8 additions & 39 deletions src/main/java/tconstruct/items/tools/BattleSign.java
@@ -1,11 +1,13 @@
package tconstruct.items.tools;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.world.World;
import tconstruct.TConstruct;
import tconstruct.library.tools.Weapon;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.*;
import tconstruct.tools.logic.EquipLogic;

public class BattleSign extends Weapon
Expand All @@ -16,50 +18,12 @@ public BattleSign()
this.setUnlocalizedName("InfiTool.Battlesign");
}

/*
* public ItemStack onItemRightClick(ItemStack stack, World world,
* EntityPlayer player) { if (!player.isSneaking())
* player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); return
* stack; }
*/

@Override
public String getToolName ()
{
return "Battlesign";
}

/*
* public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player,
* World par3World, int par4, int par5, int par6, int par7, float par8,
* float par9, float par10) { if (par7 == 0 || !player.isSneaking()) {
* return false; } else if (!par3World.getBlockMaterial(par4, par5,
* par6).isSolid()) { return false; } else { if (par7 == 1) { ++par5; }
*
* if (par7 == 2) { --par6; }
*
* if (par7 == 3) { ++par6; }
*
* if (par7 == 4) { --par4; }
*
* if (par7 == 5) { ++par4; }
*
* if (!player.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) {
* return false; } else if (!Block.signPost.canPlaceBlockAt(par3World, par4,
* par5, par6)) { return false; } else { if (par7 == 1) { int var11 =
* MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 16.0F /
* 360.0F) + 0.5D) & 15; par3World.setBlock(par4, par5, par6,
* Block.signPost.blockID, var11); } else { par3World.setBlock(par4, par5,
* par6, Block.signWall.blockID, par7); }
*
* //--par1ItemStack.stackSize; TileEntitySign var12 =
* (TileEntitySign)par3World.getBlockTileEntity(par4, par5, par6);
*
* if (var12 != null) { player.displayGUIEditSign(var12); }
*
* return true; } } }
*/

@Override
public Item getHeadItem ()
{
Expand Down Expand Up @@ -176,6 +140,11 @@ else if (!TinkerTools.battlesignBlock.canPlaceBlockAt(world, x, y, z))
logic.setEquipmentItem(stack);
--stack.stackSize;

if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
{
player.openGui(TConstruct.instance, ToolProxyClient.battlesignTextID, world, x, y, z);
}

return true;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/smeltery/SmelteryProxyClient.java
Expand Up @@ -43,7 +43,8 @@ void registerRenderer ()
RenderingRegistry.registerBlockHandler(new RenderBlockFluid());
RenderingRegistry.registerBlockHandler(new BlockRenderCastingChannel());

if (!PHConstruct.newSmeltery) {
if (!PHConstruct.newSmeltery)
{
RenderingRegistry.registerBlockHandler(new SmelteryRender());
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/smeltery/TinkerSmeltery.java
Expand Up @@ -1077,7 +1077,8 @@ protected static void addRecipesForSmeltery ()
Smeltery.addSmelteryFuel(pyrotheum, 1500, 9);

// BLOOD FOR THE BLOOD GOD
if(TinkerWorld.meatBlock != null) {
if (TinkerWorld.meatBlock != null)
{
Smeltery.addMelting(new ItemStack(Items.rotten_flesh), TinkerWorld.meatBlock, 0, 200, new FluidStack(bloodFluid, 5));
Smeltery.addMelting(new ItemStack(TinkerWorld.strangeFood, 1, 1), TinkerWorld.meatBlock, 0, 80, new FluidStack(bloodFluid, 160));
}
Expand Down

0 comments on commit 3d028e7

Please sign in to comment.