diff --git a/src/main/java/tconstruct/smeltery/blocks/CastingChannelBlock.java b/src/main/java/tconstruct/smeltery/blocks/CastingChannelBlock.java index df0d9857..3cd735ed 100644 --- a/src/main/java/tconstruct/smeltery/blocks/CastingChannelBlock.java +++ b/src/main/java/tconstruct/smeltery/blocks/CastingChannelBlock.java @@ -1,14 +1,17 @@ package tconstruct.smeltery.blocks; +import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import tconstruct.library.TConstructRegistry; +import tconstruct.smeltery.TinkerSmeltery; import tconstruct.smeltery.logic.CastingChannelLogic; import tconstruct.smeltery.model.BlockRenderCastingChannel; @@ -34,9 +37,13 @@ public class CastingChannelBlock extends BlockContainer ItemStack stack = player.getCurrentEquippedItem(); CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z); - if (stack == null) + if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerSmeltery.castingChannel)) + return false; + else + { tile.changeOutputs(player, side, hitX, hitY, hitZ); - return true; + return true; + } } @Override diff --git a/src/main/java/tconstruct/smeltery/logic/CastingChannelLogic.java b/src/main/java/tconstruct/smeltery/logic/CastingChannelLogic.java index c1e5ee42..62b09a1f 100644 --- a/src/main/java/tconstruct/smeltery/logic/CastingChannelLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/CastingChannelLogic.java @@ -26,7 +26,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class CastingChannelLogic extends TileEntity implements IFluidHandler { - public final static int fillMax = TConstruct.ingotLiquidValue; + public final static int fillMax = TConstruct.ingotLiquidValue * 3; public final static int outputMax = TConstruct.ingotLiquidValue; FluidTank internalTank = new FluidTank(fillMax); HashMap subTanks = new HashMap(); @@ -48,10 +48,10 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler validOutputs.add(ForgeDirection.EAST); validOutputs.add(ForgeDirection.WEST); - subTanks.put(ForgeDirection.NORTH, new FluidTank(TConstruct.ingotLiquidValue / 4)); - subTanks.put(ForgeDirection.SOUTH, new FluidTank(TConstruct.ingotLiquidValue / 4)); - subTanks.put(ForgeDirection.WEST, new FluidTank(TConstruct.ingotLiquidValue / 4)); - subTanks.put(ForgeDirection.EAST, new FluidTank(TConstruct.ingotLiquidValue / 4)); + subTanks.put(ForgeDirection.NORTH, new FluidTank(fillMax / 4)); + subTanks.put(ForgeDirection.SOUTH, new FluidTank(fillMax / 4)); + subTanks.put(ForgeDirection.WEST, new FluidTank(fillMax / 4)); + subTanks.put(ForgeDirection.EAST, new FluidTank(fillMax / 4)); } @Override @@ -65,9 +65,9 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler if (possibleFaucet != null && possibleFaucet instanceof FaucetLogic) flagActiveFaucet = ((FaucetLogic) possibleFaucet).active; - if (ticks == 6 && !flagActiveFaucet) + if (ticks == 6)// && !flagActiveFaucet) this.distributeFluids(); - if (ticks >= 12 && !flagActiveFaucet) + if (ticks >= 12)// && !flagActiveFaucet) { if (recentlyFilledDelay != 0) recentlyFilledDelay--; @@ -85,14 +85,14 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler if(player.isSneaking()) { - if(mode == null || mode == CastingChannelMode.SINGLEDRAIN) - mode = CastingChannelMode.CONTINUEDRAIN; - else - mode = CastingChannelMode.SINGLEDRAIN; + if(mode == null || mode == CastingChannelMode.SINGLEDRAIN) + mode = CastingChannelMode.CONTINUEDRAIN; + else + mode = CastingChannelMode.SINGLEDRAIN; - String s = "Casting Channel Mode "+(worldObj.isRemote?"client side: ":"server side: "); - player.addChatMessage(s+mode.toString()); - return; + String s = "Casting Channel Mode "+(worldObj.isRemote?"client side: ":"server side: "); + player.addChatMessage(s+mode.toString()); + return; } */ @@ -168,7 +168,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler } } - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirtyForRendering(); } private void distributeFluids () @@ -185,7 +185,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler if (connected.contains(lastProvider)) connected.remove(lastProvider); - int output = Math.min(internalTank.getFluidAmount(), 12); + int output = Math.min(internalTank.getFluidAmount(), outputMax); int connectedAmount = connected.size(); if (connectedAmount < 1) connectedAmount = 1; @@ -218,7 +218,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler debugLog.add("Internal Tank now contains: "+internalTank.getFluidAmount()+"mb"); debugLog.add("SubTank now contains: "+subTanks.get(dirOut).getFluidAmount()+"mb"); */ - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirtyForRendering(); } /* DEBUG if(printDebugLog) @@ -237,7 +237,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler /* DEBUG debugLog.add("Importing from "+lastProvider+"ern SubTank"); */ - FluidStack tempFS = new FluidStack(inputTank.getFluid().getFluid(), Math.min(inputTank.getFluidAmount(), 12)); + FluidStack tempFS = new FluidStack(inputTank.getFluid().getFluid(), Math.min(inputTank.getFluidAmount(), outputMax)); int fit = internalTank.fill(tempFS, false); /* DEBUG debugLog.add("Internal Tank will accept "+fit+"mb"); @@ -256,8 +256,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler debugLog.add("Internal Tank now contains: "+internalTank.getFluidAmount()+"mb"); debugLog.add("SubTank now contains: "+inputTank.getFluidAmount()+"mb"); */ - - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirtyForRendering(); } /* DEBUG if(printDebugLog) @@ -281,7 +280,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler connected.remove(lastProvider); if (connected.containsKey(ForgeDirection.DOWN) && this.internalTank.getFluid() != null) // Prioritizes FluidHandlers below { - int output = Math.min(internalTank.getFluid().amount, 12); + int output = Math.min(internalTank.getFluid().amount, outputMax); FluidStack tempFS = new FluidStack(internalTank.getFluid().getFluid(), output); int fittingBelow = ((IFluidHandler) connected.get(ForgeDirection.DOWN)).fill(ForgeDirection.UP, tempFS, false); if (fittingBelow > 0) @@ -300,7 +299,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler /* DEBUG debugLog.add("Exporting from "+dir+"ern SubTank"); */ - FluidStack tempFS = new FluidStack(subTanks.get(dir).getFluid().getFluid(), Math.min(subTanks.get(dir).getFluidAmount(), 12)); + FluidStack tempFS = new FluidStack(subTanks.get(dir).getFluid().getFluid(), Math.min(subTanks.get(dir).getFluidAmount(), outputMax)); int fit = ((IFluidHandler) connected.get(dir)).fill(dir.getOpposite(), tempFS, false); /* DEBUG debugLog.add("New Channel will accept "+fit+"mb"); @@ -347,6 +346,11 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler return 0.5f; } + private void markDirtyForRendering() + { + this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + public HashMap getOutputs () { HashMap map = new HashMap(); @@ -368,10 +372,10 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler { if (doFill) { - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirtyForRendering(); this.lastProvider = from; - if (this.internalTank.getFluid() == null) - this.recentlyFilledDelay = 2; + //if (this.internalTank.getFluid() == null) + //this.recentlyFilledDelay = 2; } if (from == ForgeDirection.UP) diff --git a/src/main/java/tconstruct/smeltery/model/BlockRenderCastingChannel.java b/src/main/java/tconstruct/smeltery/model/BlockRenderCastingChannel.java index aace4fa4..37fb78fe 100644 --- a/src/main/java/tconstruct/smeltery/model/BlockRenderCastingChannel.java +++ b/src/main/java/tconstruct/smeltery/model/BlockRenderCastingChannel.java @@ -148,7 +148,7 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler { float liquidAmount = (float) tankMain.fluid.amount / (float) tankMain.capacity * 0.125f; double startY = tile.tankBelow(); - renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.5 + liquidAmount, 0.625D); //Center + renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.51 + liquidAmount, 0.625D); //Center renderLiquidPart(world, x, y, z, block, renderer, tankMain.fluid, false); } for (ForgeDirection dir : outputs) @@ -160,8 +160,8 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler if (tankSub == null || tankSub.fluid == null) break; float liquidAmount = (float) tankSub.fluid.amount / (float) tankSub.capacity * 0.125f / 2; - renderer.setRenderBounds(bounds[0], 0.5, bounds[1], bounds[2], 0.5 + liquidAmount, bounds[3]); - renderLiquidPart(world, x, y, z, block, renderer, tankSub.fluid, true); + renderer.setRenderBounds(bounds[0], 0.51, bounds[1], bounds[2], 0.5 + liquidAmount, bounds[3]); + renderLiquidPart(world, x, y, z, block, renderer, tankSub.fluid, false); } } return true;