Skip to content

Commit

Permalink
fixed a whole bunch of client side stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
progwml6 committed Jan 8, 2014
1 parent 9814ead commit a5862aa
Show file tree
Hide file tree
Showing 42 changed files with 251 additions and 656 deletions.
31 changes: 16 additions & 15 deletions src/main/java/tconstruct/blocks/PaneBase.java
Expand Up @@ -3,13 +3,14 @@
import java.util.List;

import tconstruct.client.block.PaneRender;

import net.minecraft.block.Block;
import net.minecraft.block.BlockPane;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
Expand All @@ -32,10 +33,10 @@ public PaneBase(Material material, String folder, String[] blockTextures)
this.folder = folder;
}

public boolean canConnectTo (int blockID)
public boolean canConnectTo (Block block2)
{
Block block = Block.blocksList[blockID];
return Block.opaqueCubeLookup[blockID] || block instanceof PaneBase || block instanceof BlockPane || blockID == Block.glass.blockID;
Block block = block2;
return Block.opaqueCubeLookup[block2] || block instanceof PaneBase || block instanceof BlockPane || block2 == Blocks.glass;
}

public IIcon getSideTextureIndex (int meta)
Expand Down Expand Up @@ -65,7 +66,7 @@ public IIcon getIcon (int side, int meta)
}

@Override
public void getSubBlocks (Block b, CreativeTabs tab, List list)
public void getSubBlocks (Item b, CreativeTabs tab, List list)
{
for (int iter = 0; iter < textureNames.length; iter++)
{
Expand All @@ -90,8 +91,8 @@ public int getRenderType ()

public boolean shouldSideBeRendered (IBlockAccess iblockaccess, int i, int j, int k, int l)
{
int bID = iblockaccess.getBlockId(i, j, k);
if (Block.blocksList[bID] instanceof PaneBase || Block.blocksList[bID] instanceof BlockPane)
Block b = iblockaccess.func_147439_a(i, j, k);
if (b instanceof PaneBase || b instanceof BlockPane)
{
return false;
}
Expand All @@ -104,10 +105,10 @@ public boolean shouldSideBeRendered (IBlockAccess iblockaccess, int i, int j, in
@Override
public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity)
{
boolean south = canConnectTo(world.getBlockId(x, y, z - 1));
boolean north = canConnectTo(world.getBlockId(x, y, z + 1));
boolean east = canConnectTo(world.getBlockId(x - 1, y, z));
boolean west = canConnectTo(world.getBlockId(x + 1, y, z));
boolean south = canConnectTo(world.func_147439_a(x, y, z - 1));
boolean north = canConnectTo(world.func_147439_a(x, y, z + 1));
boolean east = canConnectTo(world.func_147439_a(x - 1, y, z));
boolean west = canConnectTo(world.func_147439_a(x + 1, y, z));
if (east && west || !east && !west && !south && !north)
{
setBlockBounds(0.0F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F);
Expand Down Expand Up @@ -151,10 +152,10 @@ public void setBlockBoundsBasedOnState (IBlockAccess iblockaccess, int i, int j,
float f1 = 0.5625F;
float f2 = 0.4375F;
float f3 = 0.5625F;
boolean flag = canConnectTo(iblockaccess.getBlockId(i, j, k - 1));
boolean flag1 = canConnectTo(iblockaccess.getBlockId(i, j, k + 1));
boolean flag2 = canConnectTo(iblockaccess.getBlockId(i - 1, j, k));
boolean flag3 = canConnectTo(iblockaccess.getBlockId(i + 1, j, k));
boolean flag = canConnectTo(iblockaccess.func_147439_a(i, j, k - 1));
boolean flag1 = canConnectTo(iblockaccess.func_147439_a(i, j, k + 1));
boolean flag2 = canConnectTo(iblockaccess.func_147439_a(i - 1, j, k));
boolean flag3 = canConnectTo(iblockaccess.func_147439_a(i + 1, j, k));
if (flag2 && flag3 || !flag2 && !flag3 && !flag && !flag1)
{
f = 0.0F;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/blocks/logic/DryingRackLogic.java
Expand Up @@ -7,7 +7,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/tconstruct/client/TClientEvents.java
Expand Up @@ -57,7 +57,7 @@ public void onSound (SoundLoadEvent event)
}
catch (Exception e)
{
TConstruct.logger.warning("Failed to register one or more sounds");
TConstruct.logger.error("Failed to register one or more sounds");
}
}
}
Expand Down Expand Up @@ -253,7 +253,7 @@ public void fovModifier(FOVUpdateEvent event)
f *= 1.1F;
}

if (event.entity.isUsingItem() && event.entity.getItemInUse().itemID == Items.bow.itemID)
if (event.entity.isUsingItem() && event.entity.getItemInUse() == Items.bow)
{
int i = event.entity.getItemInUseDuration();
float f1 = (float) i / 20.0F;
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/tconstruct/client/TProxyClient.java
Expand Up @@ -74,31 +74,31 @@ public class TProxyClient extends TProxyCommon
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
{
if (ID == toolStationID)
return new ToolStationGui(player.inventory, (ToolStationLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new ToolStationGui(player.inventory, (ToolStationLogic) world.func_147438_o(x, y, z), world, x, y, z);
if (ID == partBuilderID)
return new PartCrafterGui(player.inventory, (PartBuilderLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new PartCrafterGui(player.inventory, (PartBuilderLogic) world.func_147438_o(x, y, z), world, x, y, z);
if (ID == patternChestID)
return new PatternChestGui(player.inventory, (PatternChestLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new PatternChestGui(player.inventory, (PatternChestLogic) world.func_147438_o(x, y, z), world, x, y, z);
if (ID == frypanGuiID)
return new FrypanGui(player.inventory, (FrypanLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new FrypanGui(player.inventory, (FrypanLogic) world.func_147438_o(x, y, z), world, x, y, z);
if (ID == smelteryGuiID)
{
if (PHConstruct.newSmeltery)
return new AdaptiveSmelteryGui(player.inventory, (AdaptiveSmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new AdaptiveSmelteryGui(player.inventory, (AdaptiveSmelteryLogic) world.func_147438_o(x, y, z), world, x, y, z);
else
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new SmelteryGui(player.inventory, (SmelteryLogic) world.func_147438_o(x, y, z), world, x, y, z);
}
if (ID == stencilTableID)
return new StencilTableGui(player.inventory, (StencilTableLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new StencilTableGui(player.inventory, (StencilTableLogic) world.func_147438_o(x, y, z), world, x, y, z);
if (ID == toolForgeID)
return new ToolForgeGui(player.inventory, (ToolForgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new ToolForgeGui(player.inventory, (ToolForgeLogic) world.func_147438_o(x, y, z), world, x, y, z);
if (ID == landmineID)
return new GuiLandmine(new ContainerLandmine(player, (TileEntityLandmine) world.getBlockTileEntity(x, y, z)));
return new GuiLandmine(new ContainerLandmine(player, (TileEntityLandmine) world.func_147438_o(x, y, z)));
if (ID == craftingStationID)
return new CraftingStationGui(player.inventory, (CraftingStationLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
return new CraftingStationGui(player.inventory, (CraftingStationLogic) world.func_147438_o(x, y, z), world, x, y, z);

if (ID == furnaceID)
return new FurnaceGui(player.inventory, (FurnaceLogic) world.getBlockTileEntity(x, y, z));
return new FurnaceGui(player.inventory, (FurnaceLogic) world.func_147438_o(x, y, z));

if (ID == inventoryGui)
{
Expand Down Expand Up @@ -360,7 +360,7 @@ public void initManualIcons ()
MantleClientRegistry.registerManualIcon("broadaxehead", new ItemStack(TRepo.broadAxeHead, 1, 2));
MantleClientRegistry.registerManualIcon("largeswordblade", new ItemStack(TRepo.largeSwordBlade, 1, 2));

MantleClientRegistry.registerManualIcon("toolrod", new ItemStack(Item.stick));
MantleClientRegistry.registerManualIcon("toolrod", new ItemStack(Items.stick));

MantleClientRegistry.registerManualIcon("binding", new ItemStack(TRepo.binding, 1, 4));
MantleClientRegistry.registerManualIcon("wideguard", new ItemStack(TRepo.wideGuard, 1, 4));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/tconstruct/client/ToolCoreRenderer.java
Expand Up @@ -28,7 +28,7 @@ public boolean handleRenderType (ItemStack item, ItemRenderType type)
case INVENTORY:
return true;
default:
TConstruct.logger.warning("[TCon] Unhandled render case!");
TConstruct.logger.warn("[TCon] Unhandled render case!");
case FIRST_PERSON_MAP:
return false;
}
Expand Down Expand Up @@ -70,7 +70,7 @@ public void renderItem (ItemRenderType type, ItemStack item, Object... data)
}
}
for (int i = iconParts; i-- > 0;)
tempParts[i] = tool.getIIcon(item, i);
tempParts[i] = tool.getIcon(item, i);
}

int count = 0;
Expand Down
Expand Up @@ -57,7 +57,7 @@ public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block
{
if (modelID == renderID)
{
CastingChannelLogic tile = (CastingChannelLogic) world.getBlockTileEntity(x, y, z);
CastingChannelLogic tile = (CastingChannelLogic) world.func_147438_o(x, y, z);

if (!tile.hasTankConnected(ForgeDirection.DOWN))//CentrePiece, floor is removed if tank below is found
{
Expand Down Expand Up @@ -318,7 +318,7 @@ private void renderLiquidPart (IBlockAccess world, int x, int y, int z, Block bl
float blue = (color & 0xFF) / 255.0F;
Fluid fluid = liquid.getFluid();
if (fluid.canBePlacedInWorld())
BlockSkinRenderHelper.renderMetadataBlock(Block.blocksList[fluid.getBlockID()], 0, x, y, z, renderer, world);
BlockSkinRenderHelper.renderMetadataBlock(fluid.getBlock(), 0, x, y, z, renderer, world);
else
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
}
Expand All @@ -329,27 +329,27 @@ private void func_147784_q (Block block, int meta, RenderBlocks renderer)
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1.0F, 0.0F);
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1.0F);
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
Expand Down
Expand Up @@ -28,7 +28,7 @@ public static boolean renderMetadataBlock (Block block, int metadata, int x, int
var8 = var11;
}

return Minecraft.isAmbientOcclusionEnabled() && Block.lightValue[block.blockID] == 0 ? renderMetadataBlockWithAmbientOcclusion(block, metadata, x, y, z, var6, var7, var8, renderer, world)
return Minecraft.isAmbientOcclusionEnabled() && block.lightValue == 0 ? renderMetadataBlockWithAmbientOcclusion(block, metadata, x, y, z, var6, var7, var8, renderer, world)
: renderMetadataBlockWithColorMultiplier(block, metadata, x, y, z, var6, var7, var8, renderer, world);
}

Expand Down Expand Up @@ -778,7 +778,7 @@ static boolean renderMetadataBlockWithColorMultiplier (Block block, int metadata
float f17 = f5;
float f18 = f6;

if (block != Block.grass)
if (block != Blocks.grass)
{
f10 = f3 * colorRed;
f11 = f5 * colorRed;
Expand Down Expand Up @@ -1614,7 +1614,7 @@ static boolean renderFakeBlockWithColorMultiplier (IIcon stillIcon, IIcon flowin
float f17 = f5;
float f18 = f6;

if (block != Block.grass)
if (block != Blocks.grass)
{
f10 = f3 * colorRed;
f11 = f5 * colorRed;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/client/block/BreakingFX.java
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.Block;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
Expand All @@ -21,7 +22,7 @@ public BreakingFX(World par1World, double par2, double par4, double par6, Item p
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
this.setParticleIcon(par8Item.getIconFromDamage(par9));
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
this.particleGravity = Block.blockSnow.blockParticleGravity;
this.particleGravity = Blocks.snow.blockParticleGravity;
this.particleScale /= 2.0F;
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/tconstruct/client/block/DryingRackRender.java
Expand Up @@ -80,27 +80,27 @@ public static void renderStandardInvBlock (RenderBlocks renderblocks, Block bloc
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.func_149691_a(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/tconstruct/client/block/PaneRender.java
Expand Up @@ -75,8 +75,8 @@ public static boolean renderPaneInWorld (RenderBlocks renderblocks, IBlockAccess
boolean flag1 = false;
IIcon icon;
IIcon icon1;
int meta = iblockaccess.getBlockMetadata(x, y, z);
icon = renderblocks.getBlockIconFromSideAndMetadata(pane, 0, meta);
int meta = iblockaccess.func_147439_aMetadata(x, y, z);
icon = renderblocks.func_147439_aIconFromSideAndMetadata(pane, 0, meta);
icon1 = pane.getSideTextureIndex(meta);

meta = icon.getIconWidth();
Expand All @@ -97,8 +97,8 @@ public static boolean renderPaneInWorld (RenderBlocks renderblocks, IBlockAccess
/*int blockTextureIndex;
int blockSideIndex;
int j1 = iblockaccess.getBlockMetadata(x, y, z);
blockTextureIndex = pane.getBlockTextureFromSideAndMetadata(0, j1);
int j1 = iblockaccess.func_147439_aMetadata(x, y, z);
blockTextureIndex = pane.func_147439_aTextureFromSideAndMetadata(0, j1);
blockSideIndex = pane.getSideTextureIndex(j1);
int k1 = (blockTextureIndex & 0xf) << 4;
Expand Down Expand Up @@ -126,10 +126,10 @@ public static boolean renderPaneInWorld (RenderBlocks renderblocks, IBlockAccess
double xMidUp = (double) x + 0.5D + 0.0625D;
double zMidDown = ((double) z + 0.5D) - 0.0625D;
double zMidUp = (double) z + 0.5D + 0.0625D;
boolean west = pane.canConnectTo(iblockaccess.getBlock(x, y, z - 1));
boolean east = pane.canConnectTo(iblockaccess.getBlock(x, y, z + 1));
boolean south = pane.canConnectTo(iblockaccess.getBlock(x - 1, y, z));
boolean north = pane.canConnectTo(iblockaccess.getBlock(x + 1, y, z));
boolean west = pane.canConnectTo(iblockaccess.func_147439_a(x, y, z - 1));
boolean east = pane.canConnectTo(iblockaccess.func_147439_a(x, y, z + 1));
boolean south = pane.canConnectTo(iblockaccess.func_147439_a(x - 1, y, z));
boolean north = pane.canConnectTo(iblockaccess.func_147439_a(x + 1, y, z));
boolean renderAbove = pane.shouldSideBeRendered(iblockaccess, x, y + 1, z, 1);
boolean renderBelow = pane.shouldSideBeRendered(iblockaccess, x, y - 1, z, 0);
if ((!south || !north) && (south || north || west || east))
Expand Down

0 comments on commit a5862aa

Please sign in to comment.