2211
This commit is contained in:
parent
abb9b5102f
commit
92ca6548c6
49 changed files with 405 additions and 332 deletions
|
@ -10,6 +10,7 @@ import net.minecraft.network.NetworkManager;
|
|||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.multiblock.IMultiblockPart;
|
||||
|
@ -25,7 +26,7 @@ import techreborn.powerSystem.TilePowerAcceptor;
|
|||
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(4, "TileBlastFurnace", 64);
|
||||
public Inventory inventory = new Inventory(4, "TileBlastFurnace", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
public int capacity = 1000;
|
||||
public static int euTick = 5;
|
||||
|
@ -81,23 +82,23 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
|||
}
|
||||
|
||||
public int getHeat() {
|
||||
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
|
||||
for (EnumFacing direction : EnumFacing.values()) {
|
||||
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(), getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
||||
if (tileEntity instanceof TileMachineCasing) {
|
||||
if (((TileMachineCasing) tileEntity).isConnected() && ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) {
|
||||
MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
|
||||
Location location = new Location(xCoord, yCoord, zCoord, direction);
|
||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
||||
location.modifyPositionFromSide(direction, 1);
|
||||
int heat = 0;
|
||||
if (worldObj.getBlock(location.getX(), location.getY() - 1, location.getZ()) == tileEntity.getBlockType()) {
|
||||
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY() - 1, location.getZ())).getBlock() == tileEntity.getBlockType()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (IMultiblockPart part : casing.connectedParts) {
|
||||
heat += BlockMachineCasing.getHeatFromMeta(part.getWorldObj().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z));
|
||||
heat += BlockMachineCasing.getHeatFromMeta(part.getWorld().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z));
|
||||
}
|
||||
|
||||
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava") && worldObj.getBlock(location.getX(), location.getY() + 1, location.getZ()).getUnlocalizedName().equals("tile.lava")) {
|
||||
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ())).getBlock().getUnlocalizedName().equals("tile.lava") && worldObj.getBlockState(new BlockPos(location.getX(), location.getY() + 1, location.getZ())).getBlock().getUnlocalizedName().equals("tile.lava")) {
|
||||
heat += 500;
|
||||
}
|
||||
return heat;
|
||||
|
@ -132,15 +133,6 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
|||
inventory.setInventorySlotContents(p_70299_1_, p_70299_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return inventory.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inventory.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
|
@ -153,13 +145,13 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
inventory.openInventory();
|
||||
public void openInventory(EntityPlayer player) {
|
||||
inventory.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.closeInventory();
|
||||
public void closeInventory(EntityPlayer player) {
|
||||
inventory.closeInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -167,19 +159,38 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
|||
return inventory.isItemValidForSlot(p_94041_1_, p_94041_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id) {
|
||||
return inventory.getField(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value) {
|
||||
inventory.setField(id, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount() {
|
||||
return inventory.getFieldCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
inventory.clear();
|
||||
}
|
||||
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.getPos().getX(), this.getPos().getY(),
|
||||
this.getPos().getZ(), 1, nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.getPos(), 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
readFromNBT(packet.func_148857_g());
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -125,8 +125,8 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
|
|||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
|
|
|
@ -102,8 +102,8 @@ public class TileDigitalChest extends TileMachineBase implements IInventory,
|
|||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
|
|||
super.updateEntity();
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj.getBlock(xCoord, yCoord + 1, zCoord) == Blocks.dragon_egg) {
|
||||
if (worldObj.getBlock(getPos().getX(), getPos().getY() + 1, getPos().getZ()) == Blocks.dragon_egg) {
|
||||
addEnergy(euTick);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,8 +139,8 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable,
|
|||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
|
|
|
@ -81,12 +81,12 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IFlui
|
|||
|
||||
public boolean getMutliBlock() {
|
||||
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(getPos().getX() + direction.offsetX, getPos().getY() + direction.offsetY, getPos().getZ() + direction.offsetZ);
|
||||
if (tileEntity instanceof TileMachineCasing) {
|
||||
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
|
||||
int heat;
|
||||
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
|
||||
Location location = new Location(xCoord, yCoord, zCoord, direction);
|
||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
||||
location.modifyPositionFromSide(direction, 1);
|
||||
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
|
||||
heat += 500;
|
||||
|
|
|
@ -22,15 +22,15 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
|||
super.updateEntity();
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj.getBlock(xCoord + 1, yCoord, zCoord) == Blocks.lava) {
|
||||
if (worldObj.getBlock(getPos().getX() + 1, getPos().getY(), getPos().getZ()) == Blocks.lava) {
|
||||
addEnergy(euTick);
|
||||
} else if (worldObj.getBlock(xCoord, yCoord, zCoord + 1) == Blocks.lava) {
|
||||
} else if (worldObj.getBlock(getPos().getX(), getPos().getY(), getPos().getZ() + 1) == Blocks.lava) {
|
||||
addEnergy(euTick);
|
||||
} else if (worldObj.getBlock(xCoord, yCoord, zCoord - 1) == Blocks.lava) {
|
||||
} else if (worldObj.getBlock(getPos().getX(), getPos().getY(), getPos().getZ() - 1) == Blocks.lava) {
|
||||
addEnergy(euTick);
|
||||
} else if (worldObj.getBlock(xCoord - 1, yCoord, zCoord) == Blocks.lava) {
|
||||
} else if (worldObj.getBlock(getPos().getX() - 1, getPos().getY(), getPos().getZ()) == Blocks.lava) {
|
||||
addEnergy(euTick);
|
||||
} else if (worldObj.getBlock(xCoord, yCoord - 1, zCoord) == Blocks.lava) {
|
||||
} else if (worldObj.getBlock(getPos().getX(), getPos().getY() - 1, getPos().getZ()) == Blocks.lava) {
|
||||
addEnergy(euTick);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,12 +68,12 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
|
|||
|
||||
public boolean getMutliBlock() {
|
||||
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(getPos().getX() + direction.offsetX, getPos().getY() + direction.offsetY, getPos().getZ() + direction.offsetZ);
|
||||
if (tileEntity instanceof TileMachineCasing) {
|
||||
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
|
||||
int heat;
|
||||
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
|
||||
Location location = new Location(xCoord, yCoord, zCoord, direction);
|
||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
||||
location.modifyPositionFromSide(direction, 1);
|
||||
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
|
||||
heat += 500;
|
||||
|
|
|
@ -54,12 +54,12 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
|
||||
public boolean getMutliBlock() {
|
||||
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
|
||||
TileEntity tileEntity = worldObj.getTileEntity(getPos().getX() + direction.offsetX, getPos().getY() + direction.offsetY, getPos().getZ() + direction.offsetZ);
|
||||
if (tileEntity instanceof TileMachineCasing) {
|
||||
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
|
||||
int heat;
|
||||
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
|
||||
Location location = new Location(xCoord, yCoord, zCoord, direction);
|
||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
||||
location.modifyPositionFromSide(direction, 1);
|
||||
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
|
||||
heat += 500;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.client.renderer.texture.ITickable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
|
@ -7,7 +8,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import reborncore.common.packets.PacketHandler;
|
||||
|
||||
public class TileMachineBase extends TileEntity {
|
||||
public class TileMachineBase extends TileEntity implements ITickable {
|
||||
|
||||
int rotation;
|
||||
|
||||
|
@ -21,15 +22,14 @@ public class TileMachineBase extends TileEntity {
|
|||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.getPos().getX(), this.getPos().getY(),
|
||||
this.getPos().getZ(), 1, nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.getPos(), 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
readFromNBT(packet.func_148857_g());
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
public int getRotation() {
|
||||
|
@ -39,9 +39,9 @@ public class TileMachineBase extends TileEntity {
|
|||
public void setRotation(int rotation) {
|
||||
this.rotation = rotation;
|
||||
syncWithAll();
|
||||
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, blockType);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
|
||||
worldObj.notifyBlockOfStateChange(getPos(), blockType);
|
||||
worldObj.markBlockForUpdate(getPos());
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(), getPos().getY(), getPos().getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,4 +59,13 @@ public class TileMachineBase extends TileEntity {
|
|||
super.writeToNBT(tagCompound);
|
||||
tagCompound.setInteger("rotation", rotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
updateEntity();
|
||||
}
|
||||
|
||||
public void updateEntity() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TilePlayerDectector extends TilePowerAcceptor {
|
|||
while (tIterator.hasNext()) {
|
||||
EntityPlayer player = (EntityPlayer) tIterator.next();
|
||||
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D, (double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
||||
if(worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0){//ALL
|
||||
if(worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == 0){//ALL
|
||||
redstone = true;
|
||||
} else if (blockMetadata == 1){//Others
|
||||
if(!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())){
|
||||
|
@ -69,8 +69,8 @@ public class TilePlayerDectector extends TilePowerAcceptor {
|
|||
useEnergy(50);
|
||||
}
|
||||
if(lastRedstone != redstone){
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
|
||||
worldObj.markBlockForUpdate(getPos().getX(), getPos().getY(), getPos().getZ());
|
||||
worldObj.notifyBlocksOfNeighborChange(getPos().getX(), getPos().getY(), getPos().getZ(), worldObj.getBlock(getPos().getX(), getPos().getY(), getPos().getZ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ public class TileQuantumChest extends TileMachineBase implements IInventory,
|
|||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(), getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ public class TileQuantumTank extends TileMachineBase implements IFluidHandler,
|
|||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
|
|
|
@ -145,8 +145,8 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
|||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
|
|
|
@ -128,8 +128,8 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
|||
@Override
|
||||
public void onDataPacket(NetworkManager net,
|
||||
S35PacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
|
||||
yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
|||
if (!worldObj.isRemote) {
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
|
||||
if (worldObj.getBlock(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ) == Blocks.lava) {
|
||||
if (worldObj.getBlock(getPos().getX() + direction.offsetX, getPos().getY() + direction.offsetY, getPos().getZ() + direction.offsetZ) == Blocks.lava) {
|
||||
addEnergy(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,13 +190,13 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
|||
for (int j = -1; j < 2; j++) {
|
||||
for (int k = -1; k < 2; k++) {
|
||||
if ((i != 0) || (j != 0) || (k != 0)) {
|
||||
if (worldObj.getBlock(xCoord - xDir + i, yCoord - yDir + j, zCoord - zDir + k) != ModBlocks.MachineCasing) {
|
||||
if (worldObj.getBlock(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k) != ModBlocks.MachineCasing) {
|
||||
return false;
|
||||
}
|
||||
if (worldObj.getBlockMetadata(xCoord - xDir + i, yCoord - yDir + j, zCoord - zDir + k) != (((i == 0) && (j == 0) && (k != 0)) || ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2 : 1)) {
|
||||
if (worldObj.getBlockMetadata(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k) != (((i == 0) && (j == 0) && (k != 0)) || ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2 : 1)) {
|
||||
return false;
|
||||
}
|
||||
} else if (!worldObj.isAirBlock(xCoord - xDir + i, yCoord - yDir + j, zCoord - zDir + k)) {
|
||||
} else if (!worldObj.isAirBlock(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,12 +47,12 @@ public class TileIDSU extends TilePowerAcceptor {
|
|||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) != Functions.getIntDirFromDirection(direction);
|
||||
return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) != Functions.getIntDirFromDirection(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == Functions.getIntDirFromDirection(direction);
|
||||
return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == Functions.getIntDirFromDirection(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,7 @@ public class LesuNetwork {
|
|||
private void rebuild() {
|
||||
master = null;
|
||||
for (TileLesuStorage lesuStorage : storages) {
|
||||
lesuStorage.findAndJoinNetwork(lesuStorage.getWorldObj(), lesuStorage.getPos().getX(), lesuStorage.getPos().getY(), lesuStorage.getPos().getZ());
|
||||
lesuStorage.findAndJoinNetwork(lesuStorage.getWorld(), lesuStorage.getPos().getX(), lesuStorage.getPos().getY(), lesuStorage.getPos().getZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ public class TileLesu extends TilePowerAcceptor {//TODO wrench
|
|||
countedNetworks.clear();
|
||||
connectedBlocks = 0;
|
||||
for (EnumFacing dir : EnumFacing.VALID_DIRECTIONS) {
|
||||
if (worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ) instanceof TileLesuStorage) {
|
||||
if (((TileLesuStorage) worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)).network != null) {
|
||||
LesuNetwork network = ((TileLesuStorage) worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)).network;
|
||||
if (worldObj.getTileEntity(getPos().getX() + dir.offsetX, getPos().getY() + dir.offsetY, getPos().getZ() + dir.offsetZ) instanceof TileLesuStorage) {
|
||||
if (((TileLesuStorage) worldObj.getTileEntity(getPos().getX() + dir.offsetX, getPos().getY() + dir.offsetY, getPos().getZ() + dir.offsetZ)).network != null) {
|
||||
LesuNetwork network = ((TileLesuStorage) worldObj.getTileEntity(getPos().getX() + dir.offsetX, getPos().getY() + dir.offsetY, getPos().getZ() + dir.offsetZ)).network;
|
||||
if (!countedNetworks.contains(network)) {
|
||||
if (network.master == null || network.master == this) {
|
||||
connectedBlocks += network.storages.size();
|
||||
|
|
|
@ -12,9 +12,9 @@ public class TileLesuStorage extends TileMachineBase {
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (network == null) {
|
||||
findAndJoinNetwork(worldObj, xCoord, yCoord, zCoord);
|
||||
findAndJoinNetwork(worldObj, getPos().getX(), getPos().getY(), getPos().getZ());
|
||||
} else {
|
||||
if (network.master != null && network.master.getWorldObj().getTileEntity(network.master.getPos().getX(), network.master.getPos().getY(), network.master.getPos().getZ()) != network.master) {
|
||||
if (network.master != null && network.master.getWorld().getTileEntity(network.master.getPos().getX(), network.master.getPos().getY(), network.master.getPos().getZ()) != network.master) {
|
||||
network.master = null;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,6 @@ public class TileLesuStorage extends TileMachineBase {
|
|||
public final void rebuildNetwork() {
|
||||
this.removeFromNetwork();
|
||||
this.resetNetwork();
|
||||
this.findAndJoinNetwork(worldObj, xCoord, yCoord, zCoord);
|
||||
this.findAndJoinNetwork(worldObj, getPos().getX(), getPos().getY(), getPos().getZ());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue