diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java index a410034c..c9b2b827 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java @@ -27,8 +27,9 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer @SideOnly(Side.CLIENT) public IIcon icon_active_face; - + @SideOnly(Side.CLIENT) public IIcon icon_input; + @SideOnly(Side.CLIENT) public IIcon icon_output; public EnergyPylon() { @@ -47,8 +48,7 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer @Override public TileEntity createTileEntity(World world, int metadata) { - if (metadata == 1 || metadata == 2) return new TileEnergyPylon(); - else return null; + return metadata == 1 || metadata == 2 ? new TileEnergyPylon() : null; } @Override @@ -61,74 +61,72 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) { - if (meta == 1 && side == 1) return icon_active_face; - if (meta == 2 && side == 0) return icon_active_face; - return icon_input; + public IIcon getIcon(int side, int metadata) { + return metadata == 1 && side == 1 || metadata == 2 && side == 0 ? icon_active_face : icon_input; } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - int meta = world.getBlockMetadata(x, y, z); - if (meta == 1 && side == 1) return icon_active_face; - if (meta == 2 && side == 0) return icon_active_face; - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) - ? (TileEnergyPylon) world.getTileEntity(x, y, z) - : null; - if (thisTile == null) return icon_input; - return !thisTile.reciveEnergy ? icon_output : icon_input; + int metadata = world.getBlockMetadata(x, y, z); + if (metadata == 1 && side == 1 || metadata == 2 && side == 0) return icon_active_face; + TileEntity tile = world.getTileEntity(x, y, z); + if (tile instanceof TileEnergyPylon) { + return ((TileEnergyPylon) tile).reciveEnergy ? icon_input : icon_output; + } + return icon_input; } @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { - int meta = world.getBlockMetadata(x, y, z); - if (meta == 0) { + updateBlockState(world, x, y, z); + } + + private void updateBlockState(World world, int x, int y, int z) { + TileEntity tile = world.getTileEntity(x, y, z); + int metadata = world.getBlockMetadata(x, y, z); + if (metadata == 0) { if (world.getBlock(x, y + 1, z) == Blocks.glass) { - world.setBlockMetadataWithNotify(x, y, z, 1, 2); + metadata = 1; + world.setBlockMetadataWithNotify(x, y, z, metadata, 2); world.setBlock(x, y + 1, z, ModBlocks.invisibleMultiblock, 2, 2); } else if (world.getBlock(x, y - 1, z) == Blocks.glass) { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); + metadata = 2; + world.setBlockMetadataWithNotify(x, y, z, metadata, 2); world.setBlock(x, y - 1, z, ModBlocks.invisibleMultiblock, 2, 2); } } else { - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) - ? (TileEnergyPylon) world.getTileEntity(x, y, z) - : null; - if (thisTile == null || (meta == 1 && !isGlass(world, x, y + 1, z)) - || (meta == 2 && !isGlass(world, x, y - 1, z))) { - world.setBlockMetadataWithNotify(x, y, z, 0, 2); + if (!(tile instanceof TileEnergyPylon) || (metadata == 1 && isGlassMissing(world, x, y + 1, z)) + || (metadata == 2 && isGlassMissing(world, x, y - 1, z))) { + metadata = 0; + world.setBlockMetadataWithNotify(x, y, z, metadata, 2); } } - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) - ? (TileEnergyPylon) world.getTileEntity(x, y, z) - : null; - if (thisTile != null) { - thisTile.onActivated(); + if (tile instanceof TileEnergyPylon) { + ((TileEnergyPylon) tile).onActivated(); + if (metadata == 0) { + world.removeTileEntity(x, y, z); + } } - if (world.getBlockMetadata(x, y, z) == 0 && world.getTileEntity(x, y, z) != null) - world.removeTileEntity(x, y, z); } - private boolean isGlass(World world, int x, int y, int z) { - return world.getBlock(x, y, z) == ModBlocks.invisibleMultiblock && world.getBlockMetadata(x, y, z) == 2; + private boolean isGlassMissing(World world, int x, int y, int z) { + return world.getBlock(x, y, z) != ModBlocks.invisibleMultiblock || world.getBlockMetadata(x, y, z) != 2; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - int meta = world.getBlockMetadata(x, y, z); - if (meta == 0) return false; - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) - ? (TileEnergyPylon) world.getTileEntity(x, y, z) - : null; - if (thisTile != null) { - if (!player.isSneaking()) thisTile.onActivated(); - else thisTile.nextCore(); + int metadata = world.getBlockMetadata(x, y, z); + if (metadata == 0) return false; + TileEntity tile = world.getTileEntity(x, y, z); + if (tile instanceof TileEnergyPylon) { + TileEnergyPylon energyPylon = (TileEnergyPylon) tile; + if (player.isSneaking()) { + energyPylon.nextCore(); + } else { + energyPylon.onActivated(); + } return true; } return false; @@ -136,34 +134,7 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer @Override public void onPostBlockPlaced(World world, int x, int y, int z, int p_149714_5_) { - int meta = world.getBlockMetadata(x, y, z); - if (meta == 0) { - if (world.getBlock(x, y + 1, z) == Blocks.glass) { - world.setBlockMetadataWithNotify(x, y, z, 1, 2); - world.setBlock(x, y + 1, z, ModBlocks.invisibleMultiblock, 2, 2); - } else if (world.getBlock(x, y - 1, z) == Blocks.glass) { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - world.setBlock(x, y - 1, z, ModBlocks.invisibleMultiblock, 2, 2); - } - } else { - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) - ? (TileEnergyPylon) world.getTileEntity(x, y, z) - : null; - if (thisTile == null || (meta == 1 && !isGlass(world, x, y + 1, z)) - || (meta == 2 && !isGlass(world, x, y - 1, z))) { - world.setBlockMetadataWithNotify(x, y, z, 0, 2); - } - } - TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) - ? (TileEnergyPylon) world.getTileEntity(x, y, z) - : null; - if (thisTile != null) { - thisTile.onActivated(); - } - if (world.getBlockMetadata(x, y, z) == 0 && world.getTileEntity(x, y, z) != null) - world.removeTileEntity(x, y, z); + updateBlockState(world, x, y, z); } @Override @@ -173,10 +144,11 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer @Override public int getComparatorInputOverride(World world, int x, int y, int z, int meta) { - TileEnergyPylon tile = world.getTileEntity(x, y, z) instanceof TileEnergyPylon - ? (TileEnergyPylon) world.getTileEntity(x, y, z) - : null; - if (tile != null) return (int) (tile.getEnergyStored() / tile.getMaxEnergyStored() * 15D); + TileEntity tile = world.getTileEntity(x, y, z); + if (tile instanceof TileEnergyPylon) { + TileEnergyPylon energyPylon = (TileEnergyPylon) tile; + return (int) (energyPylon.getEnergyStored() / energyPylon.getMaxEnergyStored() * 15D); + } return 0; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java index 33bd708a..11729ddd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java @@ -14,7 +14,7 @@ import net.minecraftforge.common.util.ForgeDirection; import com.brandon3055.draconicevolution.api.IExtendedRFStorage; import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.client.render.particle.Particles; +import com.brandon3055.draconicevolution.client.render.particle.Particles.EnergyTransferParticle; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; import com.brandon3055.draconicevolution.common.lib.References; @@ -38,7 +38,7 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I public boolean lastTickReciveEnergy = false; public float modelRotation = 0; public float modelScale = 0; - private List coreLocatios = new ArrayList(); + private List coreLocations = new ArrayList<>(); private int selectedCore = 0; private byte particleRate = 0; private byte lastTickParticleRate = 0; @@ -47,68 +47,42 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I @Override public void updateEntity() { - if (active && worldObj.isRemote) { - modelRotation += 1.5; - modelScale += !reciveEnergy ? -0.01F : 0.01F; - if ((modelScale < 0 && !reciveEnergy)) modelScale = 10000F; - if ((modelScale < 0 && reciveEnergy)) modelScale = 0F; - spawnParticles(); - } else if (worldObj.isRemote) modelScale = 0.5F; - - if (worldObj.isRemote) return; + if (worldObj.isRemote) { + if (active) { + modelRotation += 1.5; + modelScale += reciveEnergy ? 0.01F : -0.01F; + if (modelScale < 0) { + modelScale = reciveEnergy ? 0F : 10000F; + } + spawnParticles(); + } else { + modelScale = 0.5F; + } + return; + } tick++; if (tick % 20 == 0) { - int cOut = (int) (getEnergyStored() / getMaxEnergyStored() * 15D); - if (cOut != lastCheckCompOverride) { + int comparatorOut = (int) (getEnergyStored() / getMaxEnergyStored() * 15D); + if (comparatorOut != lastCheckCompOverride) { worldObj.notifyBlocksOfNeighborChange( xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange( - xCoord - 1, - yCoord, - zCoord, - worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange( - xCoord + 1, - yCoord, - zCoord, - worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange( - xCoord, - yCoord - 1, - zCoord, - worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange( - xCoord, - yCoord + 1, - zCoord, - worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange( - xCoord, - yCoord, - zCoord - 1, - worldObj.getBlock(xCoord, yCoord, zCoord)); - worldObj.notifyBlocksOfNeighborChange( - xCoord, - yCoord, - zCoord + 1, - worldObj.getBlock(xCoord, yCoord, zCoord)); - lastCheckCompOverride = cOut; + lastCheckCompOverride = comparatorOut; } } if (active && !reciveEnergy) { - for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { - TileEntity tile = worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ); - if (tile != null && tile instanceof IEnergyReceiver) { - extractEnergy( - d, - ((IEnergyReceiver) tile) - .receiveEnergy(d.getOpposite(), extractEnergy(d, Integer.MAX_VALUE, true), false), - false); + for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { + TileEntity tile = worldObj + .getTileEntity(xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ); + if (tile instanceof IEnergyReceiver) { + int energyToReceive = extractEnergy(side, Integer.MAX_VALUE, true); + int energyReceived = ((IEnergyReceiver) tile) + .receiveEnergy(side.getOpposite(), energyToReceive, false); + extractEnergy(side, energyReceived, false); } } } @@ -125,19 +99,22 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I } private TileEnergyStorageCore getMaster() { - if (coreLocatios.isEmpty()) return null; - if (selectedCore >= coreLocatios.size()) selectedCore = coreLocatios.size() - 1; - TileLocation core = coreLocatios.get(selectedCore); - if (core == null || !(worldObj - .getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()) instanceof TileEnergyStorageCore)) - return null; - return (TileEnergyStorageCore) worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()); + if (coreLocations.isEmpty()) return null; + if (selectedCore >= coreLocations.size()) selectedCore = coreLocations.size() - 1; + TileLocation location = coreLocations.get(selectedCore); + if (location != null) { + TileEntity tile = location.getTileEntity(worldObj); + if (tile instanceof TileEnergyStorageCore) { + return (TileEnergyStorageCore) tile; + } + } + return null; } private void findCores() { int yMod = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 ? 15 : -15; int range = 15; - List locations = new ArrayList(); + List locations = new ArrayList<>(); for (int x = xCoord - range; x <= xCoord + range; x++) { for (int y = yCoord + yMod - range; y <= yCoord + yMod + range; y++) { for (int z = zCoord - range; z <= zCoord + range; z++) { @@ -148,10 +125,10 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I } } - if (locations != coreLocatios) { - coreLocatios.clear(); - coreLocatios.addAll(locations); - selectedCore = selectedCore >= coreLocatios.size() ? 0 : selectedCore; + if (locations != coreLocations) { + coreLocations.clear(); + coreLocations.addAll(locations); + selectedCore = selectedCore >= coreLocations.size() ? 0 : selectedCore; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } @@ -159,135 +136,82 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I public void nextCore() { findCores(); selectedCore++; - if (selectedCore >= coreLocatios.size()) selectedCore = 0; + if (selectedCore >= coreLocations.size()) selectedCore = 0; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @SideOnly(Side.CLIENT) private void spawnParticles() { Random rand = worldObj.rand; - if (getMaster() == null || !getMaster().isOnline()) return; - int x = getMaster().xCoord; - int y = getMaster().yCoord; - int z = getMaster().zCoord; + TileEnergyStorageCore core = getMaster(); + if (core == null || !core.isOnline()) return; + + int x = core.xCoord; + int y = core.yCoord; + int z = core.zCoord; int cYCoord = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 ? yCoord + 1 : yCoord - 1; - float disMod = getMaster().getTier() == 0 ? 0.5F - : getMaster().getTier() == 1 ? 1F - : getMaster().getTier() == 2 ? 1F - : getMaster().getTier() == 3 ? 2F - : getMaster().getTier() == 4 ? 2F : getMaster().getTier() == 5 ? 3F : 4F; - double spawnX; - double spawnY; - double spawnZ; - double targetX; - double targetY; - double targetZ; + float disMod; + switch (core.getTier()) { + case 0: + disMod = 0.5F; + break; + case 1: + case 2: + disMod = 1F; + break; + case 3: + case 4: + disMod = 2F; + break; + case 5: + disMod = 3F; + break; + default: + disMod = 4F; + break; + } + if (particleRate > 20) particleRate = 20; - if (!reciveEnergy) { - spawnX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - spawnY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - spawnZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - targetX = xCoord + 0.5; - targetY = cYCoord + 0.5; - targetZ = zCoord + 0.5; - if (rand.nextFloat() < 0.05F) { - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, - spawnX, - spawnY, - spawnZ, - targetX, - targetY, - targetZ, - true); - ParticleHandler.spawnCustomParticle(passiveParticle, 35); - } - if (particleRate > 0) { - if (particleRate > 10) { - for (int i = 0; i <= particleRate / 10; i++) { - spawnX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - spawnY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - spawnZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, - spawnX, - spawnY, - spawnZ, - targetX, - targetY, - targetZ, - false); - ParticleHandler.spawnCustomParticle(passiveParticle, 35); - } - } else if (rand.nextInt(Math.max(1, 10 - particleRate)) == 0) { - spawnX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - spawnY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - spawnZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, - spawnX, - spawnY, - spawnZ, - targetX, - targetY, - targetZ, - false); - ParticleHandler.spawnCustomParticle(passiveParticle, 35); - } - } - - } else { - targetX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - targetY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - targetZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - spawnX = xCoord + 0.5; - spawnY = cYCoord + 0.5; - spawnZ = zCoord + 0.5; - if (rand.nextFloat() < 0.05F) { - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, - spawnX, - spawnY, - spawnZ, - targetX, - targetY, - targetZ, - true); - ParticleHandler.spawnCustomParticle(passiveParticle, 35); - } - - if (particleRate > 0) { - if (particleRate > 10) { - for (int i = 0; i <= particleRate / 10; i++) { - targetX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - targetY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - targetZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, - spawnX, - spawnY, - spawnZ, - targetX, - targetY, - targetZ, - false); - ParticleHandler.spawnCustomParticle(passiveParticle, 35); - } - } else if (rand.nextInt(Math.max(1, 10 - particleRate)) == 0) { - targetX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - targetY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - targetZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); - Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, - spawnX, - spawnY, - spawnZ, - targetX, - targetY, - targetZ, - false); + double sourceX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); + double sourceY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); + double sourceZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); + double targetX = xCoord + 0.5; + double targetY = cYCoord + 0.5; + double targetZ = zCoord + 0.5; + if (rand.nextFloat() < 0.05F) { + EnergyTransferParticle passiveParticle = reciveEnergy + ? new EnergyTransferParticle(worldObj, targetX, targetY, targetZ, sourceX, sourceY, sourceZ, true) + : new EnergyTransferParticle(worldObj, sourceX, sourceY, sourceZ, targetX, targetY, targetZ, true); + ParticleHandler.spawnCustomParticle(passiveParticle, 35); + } + if (particleRate > 0) { + if (particleRate > 10 || rand.nextInt(Math.max(1, 10 - particleRate)) == 0) { + int iterations = particleRate > 10 ? particleRate / 10 : 1; + for (int i = 0; i <= iterations; i++) { + sourceX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); + sourceY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); + sourceZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); + EnergyTransferParticle passiveParticle = reciveEnergy + ? new EnergyTransferParticle( + worldObj, + targetX, + targetY, + targetZ, + sourceX, + sourceY, + sourceZ, + false) + : new EnergyTransferParticle( + worldObj, + sourceX, + sourceY, + sourceZ, + targetX, + targetY, + targetZ, + false); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } } @@ -295,8 +219,9 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I } private boolean isValidStructure() { - return (isGlass(xCoord, yCoord + 1, zCoord) || isGlass(xCoord, yCoord - 1, zCoord)) - && (!isGlass(xCoord, yCoord + 1, zCoord) || !isGlass(xCoord, yCoord - 1, zCoord)); + boolean hasGlassAbove = isGlass(xCoord, yCoord + 1, zCoord); + boolean hasGlassBelow = isGlass(xCoord, yCoord - 1, zCoord); + return hasGlassAbove != hasGlassBelow; } private boolean isGlass(int x, int y, int z) { @@ -309,13 +234,13 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I active = compound.getBoolean("Active"); reciveEnergy = compound.getBoolean("Input"); int i = compound.getInteger("Cores"); - List list = new ArrayList(); + List list = new ArrayList<>(); for (int j = 0; j < i; j++) { TileLocation l = new TileLocation(); l.readFromNBT(compound, "Core" + j); list.add(l); } - coreLocatios = list; + coreLocations = list; selectedCore = compound.getInteger("SelectedCore"); particleRate = compound.getByte("ParticleRate"); } @@ -326,10 +251,10 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I super.writeToNBT(compound); compound.setBoolean("Active", active); compound.setBoolean("Input", reciveEnergy); - int i = coreLocatios.size(); + int i = coreLocations.size(); compound.setInteger("Cores", i); for (int j = 0; j < i; j++) { - coreLocatios.get(j).writeToNBT(compound, "Core" + j); + coreLocations.get(j).writeToNBT(compound, "Core" + j); } compound.setInteger("SelectedCore", selectedCore); compound.setByte("ParticleRate", particleRate); @@ -357,8 +282,7 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { if (getMaster() == null) return 0; int received = reciveEnergy ? getMaster().receiveEnergy(maxReceive, simulate) : 0; - if (!simulate && received > 0) - particleRate = (byte) Math.min(20, received < 500 && received > 0 ? 1 : received / 500); + if (!simulate && received > 0) particleRate = (byte) Math.min(20, received < 500 ? 1 : received / 500); return received; } @@ -366,8 +290,7 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { if (getMaster() == null || !getMaster().isOnline()) return 0; int extracted = reciveEnergy ? 0 : getMaster().extractEnergy(maxExtract, simulate); - if (!simulate && extracted > 0) - particleRate = (byte) Math.min(20, extracted < 500 && extracted > 0 ? 1 : extracted / 500); + if (!simulate && extracted > 0) particleRate = (byte) Math.min(20, extracted < 500 ? 1 : extracted / 500); return extracted; }