From c12948b330cb2597bdd902817ced801f937de204 Mon Sep 17 00:00:00 2001 From: Dosh <29446556+Dash1269@users.noreply.github.com> Date: Thu, 20 Feb 2025 16:37:50 +1100 Subject: [PATCH] automatic formatting --- .../TileEntityMachineRotaryFurnace.java | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRotaryFurnace.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRotaryFurnace.java index f9fef2930..4d65872db 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRotaryFurnace.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRotaryFurnace.java @@ -42,7 +42,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting implements IFluidStandardTransceiver, IGUIProvider, IFluidCopiable, IConditionalInvAccess { - + public FluidTank[] tanks; public boolean isProgressing; public float progress; @@ -52,7 +52,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i public boolean isVenting; public MaterialStack output; public static final int maxOutput = MaterialShapes.BLOCK.q(16); - + public int anim; public int lastAnim; @@ -71,12 +71,12 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i @Override public void updateEntity() { - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + if(!worldObj.isRemote) { - + tanks[0].setType(3, slots); for(DirPos pos : getSteamPos()) { @@ -86,16 +86,16 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i if(tanks[0].getTankType() != Fluids.NONE) for(DirPos pos : getFluidPos()) { this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + if(smoke.getFill() > 0) this.sendFluid(smoke, worldObj, xCoord + rot.offsetX, yCoord + 5, zCoord + rot.offsetZ, Library.POS_Y); - + if(this.output != null) { - + int prev = this.output.amount; Vec3 impact = Vec3.createVectorHelper(0, 0, 0); MaterialStack leftover = CrucibleUtil.pourSingleStack(worldObj, xCoord + 0.5D + rot.offsetX * 2.875D, yCoord + 1.25D, zCoord + 0.5D + rot.offsetZ * 2.875D, 6, true, this.output, MaterialShapes.INGOT.q(1), impact); this.output = leftover; - + if(prev != this.output.amount) { this.output = leftover; NBTTagCompound data = new NBTTagCompound(); @@ -107,31 +107,31 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i data.setFloat("len", Math.max(1F, yCoord + 1 - (float) (Math.ceil(impact.yCoord) - 1.125))); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5D + rot.offsetX * 2.875D, yCoord + 0.75, zCoord + 0.5D + rot.offsetZ * 2.875D), new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 1, zCoord + 0.5, 50)); } - + if(output.amount <= 0) this.output = null; } - + RotaryFurnaceRecipe recipe = RotaryFurnaceRecipes.getRecipe(slots[0], slots[1], slots[2]); this.isProgressing = false; - + if(recipe != null) { - + if(this.burnTime <= 0 && slots[4] != null && TileEntityFurnace.isItemFuel(slots[4])) { this.maxBurnTime = this.burnTime = TileEntityFurnace.getItemBurnTime(slots[4]) / 2; this.decrStackSize(4, 1); this.markChanged(); } - + if(this.canProcess(recipe)) { this.progress += 1F / recipe.duration; tanks[1].setFill(tanks[1].getFill() - recipe.steam); steamUsed += recipe.steam; this.isProgressing = true; - + if(this.progress >= 1F) { this.progress -= 1F; this.consumeItems(recipe); - + if(this.output == null) { this.output = recipe.output.copy(); } else { @@ -139,11 +139,11 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i } this.markDirty(); } - + } else { this.progress = 0; } - + if(this.steamUsed >= 100) { int steamReturn = this.steamUsed / 100; int canReturn = tanks[2].getMaxFill() - tanks[2].getFill(); @@ -151,28 +151,28 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i this.steamUsed -= doesReturn * 100; tanks[2].setFill(tanks[2].getFill() + doesReturn); } - + } else { this.progress = 0; } - + this.isVenting = false; if(this.burnTime > 0) { this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND / 10F); this.burnTime--; } - + this.networkPackNT(50); - + } else { - + if(this.burnTime > 0 && MainRegistry.proxy.me().getDistance(xCoord, yCoord, zCoord) < 25) { Random rand = worldObj.rand; worldObj.spawnParticle("flame", xCoord + 0.5 + dir.offsetX * 0.5 + rot.offsetX + rand.nextGaussian() * 0.25, yCoord + 0.375, zCoord + 0.5 + dir.offsetZ * 0.5 + rot.offsetZ + rand.nextGaussian() * 0.25, 0, 0, 0); } if(isVenting && worldObj.getTotalWorldTime() % 2 == 0) { - + NBTTagCompound fx = new NBTTagCompound(); fx.setString("type", "tower"); fx.setFloat("lift", 10F); @@ -202,7 +202,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i buf.writeFloat(progress); buf.writeInt(burnTime); buf.writeInt(maxBurnTime); - + if(this.output != null) { buf.writeBoolean(true); buf.writeInt(this.output.material.id); @@ -211,7 +211,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i buf.writeBoolean(false); } } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); tanks[0].deserialize(buf); @@ -222,14 +222,14 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i progress = buf.readFloat(); burnTime = buf.readInt(); maxBurnTime = buf.readInt(); - + if(buf.readBoolean()) { this.output = new MaterialStack(Mats.matById.get(buf.readInt()), buf.readInt()); } else { this.output = null; } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -240,7 +240,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i this.burnTime = nbt.getInteger("burn"); this.maxBurnTime = nbt.getInteger("maxBurn"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); @@ -251,31 +251,31 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i nbt.setInteger("burn", burnTime); nbt.setInteger("maxBurn", maxBurnTime); } - + public DirPos[] getSteamPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + return new DirPos[] { new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 2, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ * 2, dir.getOpposite()), new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 - rot.offsetZ, dir.getOpposite()) }; } - + public DirPos[] getFluidPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN); - + return new DirPos[] { new DirPos(xCoord + dir.offsetX + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ + rot.offsetZ * 3, rot), new DirPos(xCoord - dir.offsetX + rot.offsetX * 3, yCoord, zCoord - dir.offsetZ + rot.offsetZ * 3, rot) }; } - + public boolean canProcess(RotaryFurnaceRecipe recipe) { - + if(this.burnTime <= 0) return false; - + if(recipe.fluid != null) { if(this.tanks[0].getTankType() != recipe.fluid.type) return false; if(this.tanks[0].getFill() < recipe.fluid.fill) return false; @@ -284,19 +284,19 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i if(tanks[1].getFill() < recipe.steam) return false; if(tanks[2].getMaxFill() - tanks[2].getFill() < recipe.steam / 100) return false; if(this.steamUsed > 100) return false; - + if(this.output != null) { if(this.output.material != recipe.output.material) return false; if(this.output.amount + recipe.output.amount > this.maxOutput) return false; } - + return true; } - + public void consumeItems(RotaryFurnaceRecipe recipe) { - + for(AStack aStack : recipe.ingredients) { - + for(int i = 0; i < 3; i++) { ItemStack stack = slots[i]; if(aStack.matchesRecipe(stack, true) && stack.stackSize >= aStack.stacksize) { @@ -305,19 +305,19 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i } } } - + if(recipe.fluid != null) { this.tanks[0].setFill(tanks[0].getFill() - recipe.fluid.fill); } } - + @Override public void pollute(PollutionType type, float amount) { FluidTank tank = type == PollutionType.SOOT ? smoke : type == PollutionType.HEAVYMETAL ? smoke_leaded : smoke_poison; - + int fluidAmount = (int) Math.ceil(amount * 100); tank.setFill(tank.getFill() + fluidAmount); - + if(tank.getFill() > tank.getMaxFill()) { int overflow = tank.getFill() - tank.getMaxFill(); tank.setFill(tank.getMaxFill()); @@ -332,12 +332,12 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i @Override public boolean isItemValidForSlot(int x, int y, int z, int slot, ItemStack stack) { return slot < 3 || slot == 4; } @Override public boolean canExtractItem(int x, int y, int z, int slot, ItemStack stack, int side) { return false; } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 2, @@ -348,10 +348,10 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i zCoord + 3 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { @@ -364,7 +364,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); BlockPos core = new BlockPos(xCoord, yCoord, zCoord); - + //Red if(side == dir.getOpposite().ordinal() && pos.equals(core.clone().offset(dir, -1).offset(rot, -2))) return new int[] {0}; //Yellow @@ -373,7 +373,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i if(side == dir.getOpposite().ordinal() && pos.equals(core.clone().offset(dir, -1))) return new int[] {2}; //Fuel if(side == dir.ordinal() && pos.equals(core.clone().offset(dir, 1).offset(rot, -1))) return new int[] {4}; - + return new int[] { }; }