Forgeified texturebinding for pipeitems, changed getBoundingBoxFromPool to getBoundingBox, fixed Block.getHardness calls

This commit is contained in:
Krapht 2012-08-11 23:30:22 +02:00
parent e93c37f1a3
commit f7c5262c09
7 changed files with 18 additions and 27 deletions

View file

@ -433,8 +433,7 @@ public class RenderPipe extends TileEntitySpecialRenderer {
if (customRenderer != null) { if (customRenderer != null) {
GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC
loadTexture("/terrain.png"); ForgeHooksClient.bindTexture(itemstack.getItem().getTextureFile(), 0);
ForgeHooksClient.overrideTexture(itemstack.getItem());
float f4 = 0.25F; float f4 = 0.25F;
f4 = 0.5F; f4 = 0.5F;
GL11.glScalef(f4, f4, f4); GL11.glScalef(f4, f4, f4);
@ -460,8 +459,8 @@ public class RenderPipe extends TileEntitySpecialRenderer {
&& RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) { && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) {
GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC
loadTexture("/terrain.png");
ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]); ForgeHooksClient.bindTexture(Block.blocksList[itemstack.itemID].getTextureFile(), 0);
float f4 = 0.25F; float f4 = 0.25F;
int j = Block.blocksList[itemstack.itemID].getRenderType(); int j = Block.blocksList[itemstack.itemID].getRenderType();
if (j == 1 || j == 19 || j == 12 || j == 2) if (j == 1 || j == 19 || j == 12 || j == 2)
@ -488,7 +487,7 @@ public class RenderPipe extends TileEntitySpecialRenderer {
if (itemstack.getItem().requiresMultipleRenderPasses()) { if (itemstack.getItem().requiresMultipleRenderPasses()) {
GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glScalef(0.5F, 0.5F, 0.5F);
this.loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID])); ForgeHooksClient.bindTexture(Item.itemsList[itemstack.itemID].getTextureFile(), 0);
for (int i = 0; i <= 1; ++i) { for (int i = 0; i <= 1; ++i) {
int iconIndex = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), i); int iconIndex = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), i);
@ -509,11 +508,9 @@ public class RenderPipe extends TileEntitySpecialRenderer {
GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glScalef(0.5F, 0.5F, 0.5F);
int i = itemstack.getIconIndex(); int i = itemstack.getIconIndex();
if (itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null) { if (itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null) {
loadTexture("/terrain.png"); ForgeHooksClient.bindTexture(Block.blocksList[itemstack.itemID].getTextureFile(), 0);
ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]);
} else { } else {
loadTexture("/gui/items.png"); ForgeHooksClient.bindTexture(Item.itemsList[itemstack.itemID].getTextureFile(), 0);
ForgeHooksClient.overrideTexture(Item.itemsList[itemstack.itemID]);
} }
drawItem(i, quantity); drawItem(i, quantity);
@ -555,9 +552,4 @@ public class RenderPipe extends TileEntitySpecialRenderer {
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
} }
protected void loadTexture(String s) {
RenderEngine renderengine = RenderManager.instance.renderEngine;
renderengine.bindTexture(renderengine.getTexture(s));
}
} }

View file

@ -49,17 +49,17 @@ public class BlockMarker extends BlockContainer {
switch (meta) { switch (meta) {
case 0: case 0:
return AxisAlignedBB.getBoundingBoxFromPool(i + 0.5 - w, j + 1 - h, k + 0.5 - w, i + 0.5 + w, j + 1, k + 0.5 + w); return AxisAlignedBB.getBoundingBox(i + 0.5 - w, j + 1 - h, k + 0.5 - w, i + 0.5 + w, j + 1, k + 0.5 + w);
case 5: case 5:
return AxisAlignedBB.getBoundingBoxFromPool(i + 0.5 - w, j, k + 0.5 - w, i + 0.5 + w, j + h, k + 0.5 + w); return AxisAlignedBB.getBoundingBox(i + 0.5 - w, j, k + 0.5 - w, i + 0.5 + w, j + h, k + 0.5 + w);
case 3: case 3:
return AxisAlignedBB.getBoundingBoxFromPool(i + 0.5 - w, j + 0.5 - w, k, i + 0.5 + w, j + 0.5 + w, k + h); return AxisAlignedBB.getBoundingBox(i + 0.5 - w, j + 0.5 - w, k, i + 0.5 + w, j + 0.5 + w, k + h);
case 4: case 4:
return AxisAlignedBB.getBoundingBoxFromPool(i + 0.5 - w, j + 0.5 - w, k + 1 - h, i + 0.5 + w, j + 0.5 + w, k + 1); return AxisAlignedBB.getBoundingBox(i + 0.5 - w, j + 0.5 - w, k + 1 - h, i + 0.5 + w, j + 0.5 + w, k + 1);
case 1: case 1:
return AxisAlignedBB.getBoundingBoxFromPool(i, j + 0.5 - w, k + 0.5 - w, i + h, j + 0.5 + w, k + 0.5 + w); return AxisAlignedBB.getBoundingBox(i, j + 0.5 - w, k + 0.5 - w, i + h, j + 0.5 + w, k + 0.5 + w);
default: default:
return AxisAlignedBB.getBoundingBoxFromPool(i + 1 - h, j + 0.5 - w, k + 0.5 - w, i + 1, j + 0.5 + w, k + 0.5 + w); return AxisAlignedBB.getBoundingBox(i + 1 - h, j + 0.5 - w, k + 0.5 - w, i + 1, j + 0.5 + w, k + 0.5 + w);
} }
} }

View file

@ -96,7 +96,7 @@ public class BlockFrame extends Block implements IFramePipeConnection {
zMax = 1.0F; zMax = 1.0F;
} }
return AxisAlignedBB.getBoundingBoxFromPool((double) i + xMin, (double) j + yMin, (double) k + zMin, (double) i + xMax, return AxisAlignedBB.getBoundingBox((double) i + xMin, (double) j + yMin, (double) k + zMin, (double) i + xMax,
(double) j + yMax, (double) k + zMax); (double) j + yMax, (double) k + zMax);
} }

View file

@ -59,7 +59,7 @@ public class TileMiningWell extends TileMachine implements IMachine, IPowerRecep
if (depth < 0 if (depth < 0
|| (Block.blocksList[world.getBlockId(xCoord, depth, zCoord)] != null && Block.blocksList[world.getBlockId( || (Block.blocksList[world.getBlockId(xCoord, depth, zCoord)] != null && Block.blocksList[world.getBlockId(
xCoord, depth, zCoord)].getHardness() == -1.0f) xCoord, depth, zCoord)].getBlockHardness(world, xCoord, yCoord, zCoord) == -1.0f)
|| world.getBlockId(xCoord, depth, zCoord) == Block.lavaMoving.blockID || world.getBlockId(xCoord, depth, zCoord) == Block.lavaMoving.blockID
|| world.getBlockId(xCoord, depth, zCoord) == Block.lavaStill.blockID) { || world.getBlockId(xCoord, depth, zCoord) == Block.lavaStill.blockID) {

View file

@ -407,8 +407,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
} }
// Collect any lost items laying around // Collect any lost items laying around
AxisAlignedBB axis = AxisAlignedBB.getBoundingBoxFromPool(arm.headPosX - 1.5, arm.headPosY, arm.headPosZ - 1.5, AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(arm.headPosX - 1.5, arm.headPosY, arm.headPosZ - 1.5, arm.headPosX + 2.5, arm.headPosY + 2.5, arm.headPosZ + 2.5);
arm.headPosX + 2.5, arm.headPosY + 2.5, arm.headPosZ + 2.5);
List result = worldObj.getEntitiesWithinAABB(EntityItem.class, axis); List result = worldObj.getEntitiesWithinAABB(EntityItem.class, axis);
for (int ii = 0; ii < result.size(); ii++) { for (int ii = 0; ii < result.size(); ii++) {
if (result.get(ii) instanceof EntityItem) { if (result.get(ii) instanceof EntityItem) {
@ -455,7 +454,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
private boolean blockDig(int blockID) { private boolean blockDig(int blockID) {
if (Block.blocksList[blockID] != null && Block.blocksList[blockID].getHardness() == -1.0f) if (Block.blocksList[blockID] != null && Block.blocksList[blockID].getBlockHardness(worldObj, xCoord, yCoord, zCoord) == -1.0f)
return true; return true;
return blockID == Block.lavaStill.blockID || blockID == Block.lavaMoving.blockID; return blockID == Block.lavaStill.blockID || blockID == Block.lavaMoving.blockID;

View file

@ -128,7 +128,7 @@ public class BlockGenericPipe extends BlockContainer {
if (Utils.checkPipesConnections(world, tile1, i, j, k + 1)) if (Utils.checkPipesConnections(world, tile1, i, j, k + 1))
zMax = 1.0F; zMax = 1.0F;
return AxisAlignedBB.getBoundingBoxFromPool((double) i + xMin, (double) j + yMin, (double) k + zMin, (double) i + xMax, return AxisAlignedBB.getBoundingBox((double) i + xMin, (double) j + yMin, (double) k + zMin, (double) i + xMax,
(double) j + yMax, (double) k + zMax); (double) j + yMax, (double) k + zMax);
} }

View file

@ -137,7 +137,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
Position min = p1.min(p2); Position min = p1.min(p2);
Position max = p1.max(p2); Position max = p1.max(p2);
return AxisAlignedBB.getBoundingBoxFromPool(min.x, min.y, min.z, max.x, max.y, max.z); return AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, max.y, max.z);
} }
@Override @Override