fixed quarry placement and various minors twearks

This commit is contained in:
SpaceToad 2014-02-11 21:11:06 +01:00
parent 12ec799ea3
commit 3580d4b34a
5 changed files with 38 additions and 35 deletions

View file

@ -188,9 +188,11 @@ public class BuildCraftEnergy extends BuildCraftMod {
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("fuel", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketFuel), new ItemStack(Items.bucket));
}
BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel);
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
// TODO: Are these still really necessary? If not, remove the
// BucketHandler class as well.
//BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
//BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel);
//MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
BuildcraftRecipes.refinery.addRecipe(new FluidStack(fluidOil, 1), new FluidStack(fluidFuel, 1), 12, 1);

View file

@ -27,12 +27,14 @@ public class StackWrapper {
public int hashCode() {
int hash = 5;
// TODO: this may have a speed impact. To be checked.
hash = 67 * hash + Item.itemRegistry.getIDForObject(stack.getItem());
hash = 67 * hash + stack.getItem().hashCode();
hash = 67 * hash + stack.getItemDamage();
if (stack.stackTagCompound != null)
if (stack.stackTagCompound != null) {
hash = 67 * hash + stack.stackTagCompound.hashCode();
}
return hash;
}

View file

@ -488,7 +488,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with) {
if (type == PipeType.POWER) {
return ConnectOverride.DEFAULT;
} else if (with == orientation) {
} else if (with == orientation) {
return ConnectOverride.DISCONNECT;
} else {
return ConnectOverride.DEFAULT;

View file

@ -51,10 +51,6 @@ public class BlockTank extends BlockContainer {
return false;
}
public boolean isACube() {
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileTank();
@ -80,19 +76,19 @@ public class BlockTank extends BlockContainer {
case 1:
return textureTop;
default:
if (iblockaccess.getBlock(i, j - 1, k) == this)
if (iblockaccess.getBlock(i, j - 1, k) == this) {
return textureStackedSide;
else
} else {
return textureBottomSide;
}
}
}
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
System.out.println ("ACTIVATED");
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null) {
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
TileTank tank = (TileTank) world.getTileEntity(i, j, k);
@ -109,8 +105,8 @@ public class BlockTank extends BlockContainer {
// Handle empty containers
} else {
FluidStack available = tank.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
if (available != null) {
ItemStack filled = FluidContainerRegistry.fillFluidContainer(available, current);
@ -129,7 +125,9 @@ public class BlockTank extends BlockContainer {
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, filled);
}
}
tank.drain(ForgeDirection.UNKNOWN, liquid.amount, true);
return true;
}
}
@ -141,9 +139,11 @@ public class BlockTank extends BlockContainer {
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
if (side <= 1)
if (side <= 1) {
return world.getBlock(x, y, z) != this;
return super.shouldSideBeRendered(world, x, y, z, side);
} else {
return super.shouldSideBeRendered(world, x, y, z, side);
}
}
@Override
@ -157,10 +157,12 @@ public class BlockTank extends BlockContainer {
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileTank) {
TileTank tank = (TileTank) tile;
return tank.getFluidLightLevel();
}
return super.getLightValue(world, x, y, z);
}
}

View file

@ -531,11 +531,10 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
if (chunkTicket == null) {
isAlive = false;
if (placedBy != null && !worldObj.isRemote) {
((EntityPlayerMP) placedBy)
.addChatMessage(new ChatComponentText(
String.format(
"[BUILDCRAFT] The quarry at %d, %d, %d will not work because there are no more chunkloaders available",
xCoord, yCoord, zCoord)));
placedBy.addChatMessage(new ChatComponentText(
String.format(
"[BUILDCRAFT] The quarry at %d, %d, %d will not work because there are no more chunkloaders available",
xCoord, yCoord, zCoord)));
}
sendNetworkUpdate();
return;
@ -561,13 +560,12 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
int zSize = a.zMax() - a.zMin() + 1;
if (xSize < 3 || zSize < 3 || ((xSize * zSize) >> 8) >= chunkTicket.getMaxChunkListDepth()) {
if (placedBy != null) {
((EntityPlayerMP) placedBy)
.addChatMessage(new ChatComponentText(
String.format(
"Quarry size is outside of chunkloading bounds or too small %d %d (%d)",
xSize, zSize,
chunkTicket.getMaxChunkListDepth())));
if (placedBy != null) {
placedBy.addChatMessage(new ChatComponentText(
String.format(
"Quarry size is outside of chunkloading bounds or too small %d %d (%d)",
xSize, zSize,
chunkTicket.getMaxChunkListDepth())));
}
a = new DefaultAreaProvider(xCoord, yCoord, zCoord, xCoord + 10, yCoord + 4, zCoord + 10);
@ -857,11 +855,10 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
}
if (placedBy != null) {
((EntityPlayerMP) placedBy)
.addChatMessage(new ChatComponentText(
String.format(
"[BUILDCRAFT] The quarry at %d %d %d will keep %d chunks loaded",
xCoord, yCoord, zCoord, chunks.size())));
placedBy.addChatMessage(new ChatComponentText(
String.format(
"[BUILDCRAFT] The quarry at %d %d %d will keep %d chunks loaded",
xCoord, yCoord, zCoord, chunks.size())));
}
sendNetworkUpdate();