Of course, the issue isn't on Minecraft's end, it has to do with Coord4D hashing. Coord4D no longer extends BlockPos to prevent hash issues

This commit is contained in:
aidancbrady committed 2016-05-09 21:07:18 -04:00
1 parent c6f3c162f9
commit ddfe83c495
70 files changed
+458 -1032

No files matched your search

+2 -2
View File
@@ -50,8 +50,8 @@ public class Chunk3D
*/
public Chunk3D(Coord4D coord)
{
xCoord = coord.getX() >> 4;
zCoord = coord.getZ() >> 4;
xCoord = coord.xCoord >> 4;
zCoord = coord.zCoord >> 4;
dimensionId = coord.dimensionId;
}
+111 -148
View File
@@ -3,9 +3,7 @@ package mekanism.api;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
import mekanism.api.util.ReflectionUtils;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
@@ -18,11 +16,9 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3i;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.Chunk.EnumCreateEntityType;
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
/**
@@ -31,8 +27,12 @@ import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
* @author aidancbrady
*
*/
public class Coord4D extends BlockPos
public class Coord4D
{
public int xCoord;
public int yCoord;
public int zCoord;
public int dimensionId;
/**
@@ -43,35 +43,22 @@ public class Coord4D extends BlockPos
*/
public Coord4D(int x, int y, int z)
{
super(x, y, z);
xCoord = x;
yCoord = y;
zCoord = z;
dimensionId = 0;
}
public Coord4D(int x, int y, int z, World world)
{
this(x, y, z, world.provider.getDimensionId());
}
public Coord4D(Vec3i pos, World world)
{
this(pos, world.provider.getDimensionId());
}
public Coord4D(double x, double y, double z)
{
super(x, y, z);
dimensionId = 0;
}
/**
* Creates a Coord4D from an entity's position, rounded down.
* @param entity - entity to create the Coord4D from
*/
public Coord4D(Entity entity)
{
super(entity);
xCoord = (int)entity.posX;
yCoord = (int)entity.posY;
zCoord = (int)entity.posZ;
dimensionId = entity.worldObj.provider.getDimensionId();
}
@@ -83,48 +70,44 @@ public class Coord4D extends BlockPos
* @param z - z coordinate
* @param dimension - dimension ID
*/
public Coord4D(int x, int y, int z, int dimension)
{
super(x, y, z);
dimensionId = dimension;
}
public Coord4D(double x, double y, double z, int dimension)
{
super(x, y, z);
xCoord = MathHelper.floor_double(x);
yCoord = MathHelper.floor_double(y);
zCoord = MathHelper.floor_double(z);
dimensionId = dimension;
}
public Coord4D(Vec3i pos)
public Coord4D(BlockPos pos, World world)
{
this(pos, 0);
this(pos.getX(), pos.getY(), pos.getZ(), world.provider.getDimensionId());
}
public Coord4D(Vec3i pos, int dimension)
public Coord4D(MovingObjectPosition mop, World world)
{
this(pos.getX(), pos.getY(), pos.getZ());
dimensionId = dimension;
}
public Coord4D(MovingObjectPosition mop)
{
super(mop.getBlockPos());
dimensionId = 0;
this(mop.getBlockPos(), world);
}
/**
* Gets the metadata of the block representing this Coord4D.
* Gets the state of the block representing this Coord4D.
* @param world - world this Coord4D is in
* @return the metadata of this Coord4D's block
* @return the state of this Coord4D's block
*/
public IBlockState getBlockState(IBlockAccess world)
{
return world.getBlockState(this);
return world.getBlockState(getPos());
}
public int getBlockMeta(IBlockAccess world)
{
IBlockState state = getBlockState(world);
return state == null ? 0 : state.getBlock().getMetaFromState(state);
}
public BlockPos getPos()
{
return new BlockPos(xCoord, yCoord, zCoord);
}
/**
@@ -139,46 +122,9 @@ public class Coord4D extends BlockPos
return null;
}
TileEntity tile = world.getTileEntity(this);
return (tile != null && tile.hasWorldObj() && !tile.isInvalid()) ? tile : null;
return world.getTileEntity(getPos());
}
public TileEntity safeTileGet(World world)
{
if(!exists(world))
{
return null;
}
TileEntity tile = world.getChunkFromBlockCoords(this).getTileEntity(this, EnumCreateEntityType.CHECK);
if(tile != null)
{
return tile;
}
for(TileEntity iter : world.loadedTileEntityList)
{
if(!iter.isInvalid() && iter.getPos().equals(this))
{
return iter;
}
}
List<TileEntity> added = (List<TileEntity>)ReflectionUtils.getPrivateValue(world, World.class, ObfuscatedNames.World_addedTileEntityList);
for(TileEntity iter : added)
{
if(!iter.isInvalid() && iter.getPos().equals(this))
{
return iter;
}
}
return null;
}
/**
* Gets the Block value of the block representing this Coord4D.
* @param world - world this Coord4D is in
@@ -191,13 +137,7 @@ public class Coord4D extends BlockPos
return null;
}
return world.getBlockState(this).getBlock();
}
public int getBlockMeta(IBlockAccess world)
{
IBlockState state = getBlockState(world);
return state == null ? 0 : state.getBlock().getMetaFromState(state);
return getBlockState(world).getBlock();
}
/**
@@ -207,9 +147,9 @@ public class Coord4D extends BlockPos
*/
public NBTTagCompound write(NBTTagCompound nbtTags)
{
nbtTags.setInteger("x", getX());
nbtTags.setInteger("y", getY());
nbtTags.setInteger("z", getZ());
nbtTags.setInteger("x", xCoord);
nbtTags.setInteger("y", yCoord);
nbtTags.setInteger("z", zCoord);
nbtTags.setInteger("dimensionId", dimensionId);
return nbtTags;
@@ -219,9 +159,11 @@ public class Coord4D extends BlockPos
* Writes this Coord4D's data to an ArrayList for packet transfer.
* @param data - the ArrayList to add the data to
*/
public void write(ArrayList<Object> data)
public void write(ArrayList data)
{
data.add(toLong());
data.add(xCoord);
data.add(yCoord);
data.add(zCoord);
data.add(dimensionId);
}
@@ -231,7 +173,9 @@ public class Coord4D extends BlockPos
*/
public void write(ByteBuf dataStream)
{
dataStream.writeLong(toLong());
dataStream.writeInt(xCoord);
dataStream.writeInt(yCoord);
dataStream.writeInt(zCoord);
dataStream.writeInt(dimensionId);
}
@@ -242,42 +186,47 @@ public class Coord4D extends BlockPos
* @param z - z value to translate
* @return translated Coord4D
*/
public Coord4D add(int x, int y, int z)
public Coord4D translate(int x, int y, int z)
{
return x == 0 && y == 0 && z == 0 ? this : new Coord4D(this.getX() + x, this.getY() + y, this.getZ() + z, dimensionId);
return new Coord4D(xCoord+x, yCoord+y, zCoord+z, dimensionId);
}
public Coord4D add(double x, double y, double z)
{
return x == 0.0D && y == 0.0D && z == 0.0D ? this : new Coord4D((double)this.getX() + x, (double)this.getY() + y, (double)this.getZ() + z, dimensionId);
}
/**
* Translates this Coord4D by the defined Coord4D's coordinates, regardless of dimension.
* @param coord - coordinates to translate by
* @return translated Coord4D
*/
public Coord4D add(Vec3i coord)
public Coord4D translate(Coord4D coord)
{
return add(coord.getX(), coord.getY(), coord.getZ());
return translate(coord.xCoord, coord.yCoord, coord.zCoord);
}
/**
* Offset this BlockPos 1 block in the given direction
* Creates and returns a new Coord4D translated to the defined offsets of the side.
* @param side - side to translate this Coord4D to
* @return translated Coord4D
*/
public Coord4D offset(EnumFacing facing)
public Coord4D offset(EnumFacing side)
{
return this.offset(facing, 1);
return getFromSide(side, 1);
}
/**
* Offsets this BlockPos n blocks in the given direction
* Creates and returns a new Coord4D translated to the defined offsets of the side by the defined amount.
* @param side - side to translate this Coord4D to
* @param amount - how far to translate this Coord4D
* @return translated Coord4D
*/
public Coord4D offset(EnumFacing facing, int n)
public Coord4D getFromSide(EnumFacing side, int amount)
{
return (facing == null || n == 0) ? this : new Coord4D(getX() + facing.getFrontOffsetX() * n, getY() + facing.getFrontOffsetY() * n, getZ() + facing.getFrontOffsetZ() * n, dimensionId);
if(side == null || amount == 0)
{
return this;
}
return new Coord4D(xCoord+(side.getFrontOffsetX()*amount), yCoord+(side.getFrontOffsetY()*amount), zCoord+(side.getFrontOffsetZ()*amount), dimensionId);
}
public ItemStack getStack(IBlockAccess world)
{
IBlockState state = getBlockState(world);
@@ -286,7 +235,7 @@ public class Coord4D extends BlockPos
{
return null;
}
return new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
}
@@ -297,8 +246,7 @@ public class Coord4D extends BlockPos
*/
public static Coord4D get(TileEntity tileEntity)
{
BlockPos pos = tileEntity.getPos();
return new Coord4D(pos.getX(), pos.getY(), pos.getZ(), tileEntity.getWorld().provider.getDimensionId());
return new Coord4D(tileEntity.getPos(), tileEntity.getWorld());
}
/**
@@ -318,17 +266,17 @@ public class Coord4D extends BlockPos
*/
public static Coord4D read(ByteBuf dataStream)
{
return new Coord4D(BlockPos.fromLong(dataStream.readLong()), dataStream.readInt());
return new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
/**
* Creates and returns a new Coord4D with values representing the difference between the defined Coord4D
* @param vec - the Coord4D to subtract from this
* @param other - the Coord4D to subtract from this
* @return a Coord4D representing the distance between the defined Coord4D
*/
public Coord4D difference(Vec3i vec)
public Coord4D difference(Coord4D other)
{
return vec.getX() == 0 && vec.getY() == 0 && vec.getZ() == 0 ? this : new Coord4D(getX() - vec.getX(), getY() - vec.getY(), getZ() - vec.getZ(), dimensionId);
return new Coord4D(xCoord-other.xCoord, yCoord-other.yCoord, zCoord-other.zCoord, dimensionId);
}
/**
@@ -343,7 +291,7 @@ public class Coord4D extends BlockPos
for(EnumFacing side : EnumFacing.VALUES)
{
if(side.getDirectionVec().equals(diff))
if(side.getFrontOffsetX() == diff.xCoord && side.getFrontOffsetY() == diff.yCoord && side.getFrontOffsetZ() == diff.zCoord)
{
return side;
}
@@ -357,11 +305,11 @@ public class Coord4D extends BlockPos
* @param obj - the Coord4D to find the distance to
* @return the distance to the defined Coord4D
*/
public int distanceTo(Vec3i obj)
public int distanceTo(Coord4D obj)
{
int subX = getX() - obj.getX();
int subY = getY() - obj.getY();
int subZ = getZ() - obj.getZ();
int subX = xCoord - obj.xCoord;
int subY = yCoord - obj.yCoord;
int subZ = zCoord - obj.zCoord;
return (int)MathHelper.sqrt_double(subX * subX + subY * subY + subZ * subZ);
}
@@ -373,7 +321,7 @@ public class Coord4D extends BlockPos
*/
public boolean sideVisible(EnumFacing side, IBlockAccess world)
{
return world.isAirBlock(offset(side));
return world.isAirBlock(step(side).getPos());
}
/**
@@ -383,7 +331,17 @@ public class Coord4D extends BlockPos
*/
public TargetPoint getTargetPoint(double range)
{
return new TargetPoint(dimensionId, getX(), getY(), getZ(), range);
return new TargetPoint(dimensionId, xCoord, yCoord, zCoord, range);
}
/**
* Steps this Coord4D in the defined side's offset without creating a new value.
* @param side - side to step towards
* @return this Coord4D
*/
public Coord4D step(EnumFacing side)
{
return translate(side.getFrontOffsetX(), side.getFrontOffsetY(), side.getFrontOffsetZ());
}
/**
@@ -393,7 +351,7 @@ public class Coord4D extends BlockPos
*/
public boolean exists(World world)
{
return world.getChunkProvider() == null || world.getChunkProvider().chunkExists(getX() >> 4, getZ() >> 4);
return world.getChunkProvider() == null || world.getChunkProvider().chunkExists(xCoord >> 4, zCoord >> 4);
}
/**
@@ -403,7 +361,7 @@ public class Coord4D extends BlockPos
*/
public Chunk getChunk(World world)
{
return world.getChunkFromBlockCoords(this);
return world.getChunkFromBlockCoords(getPos());
}
/**
@@ -422,7 +380,7 @@ public class Coord4D extends BlockPos
*/
public boolean isAirBlock(IBlockAccess world)
{
return world.isAirBlock(this);
return world.isAirBlock(getPos());
}
/**
@@ -432,7 +390,7 @@ public class Coord4D extends BlockPos
*/
public boolean isReplaceable(World world)
{
return getBlock(world).isReplaceable(world, this);
return getBlock(world).isReplaceable(world, getPos());
}
/**
@@ -441,33 +399,38 @@ public class Coord4D extends BlockPos
*/
public AxisAlignedBB getBoundingBox()
{
return new AxisAlignedBB(this, add(1,1,1));
return AxisAlignedBB.fromBounds(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1);
}
@Override
public Coord4D clone()
{
return new Coord4D(xCoord, yCoord, zCoord, dimensionId);
}
@Override
public String toString()
{
return "[Coord4D: " + getX() + ", " + getY() + ", " + getZ() + ", dim=" + dimensionId + "]";
return "[Coord4D: " + xCoord + ", " + yCoord + ", " + zCoord + ", dim=" + dimensionId + "]";
}
@Override
public boolean equals(Object obj)
{
return obj instanceof Vec3i &&
(
((Vec3i)obj).getX() == getX() &&
((Vec3i)obj).getY() == getY() &&
((Vec3i)obj).getZ() == getZ()
) && !(obj instanceof Coord4D && ((Coord4D)obj).dimensionId != dimensionId);
return obj instanceof Coord4D &&
((Coord4D)obj).xCoord == xCoord &&
((Coord4D)obj).yCoord == yCoord &&
((Coord4D)obj).zCoord == zCoord &&
((Coord4D)obj).dimensionId == dimensionId;
}
@Override
public int hashCode()
{
int code = 1;
code = 31 * code + getX();
code = 31 * code + getY();
code = 31 * code + getZ();
code = 31 * code + xCoord;
code = 31 * code + yCoord;
code = 31 * code + zCoord;
code = 31 * code + dimensionId;
return code;
}
@@ -13,5 +13,4 @@ public final class ObfuscatedNames
public static String[] SoundManager_invPlayingSounds = new String[] {"invPlayingSounds", "field_148630_i"};
public static String[] AbstractClientPlayer_getPlayerInfo = new String[] {"getPlayerInfo", "func_110303_q"};
public static String[] NetworkPlayerInfo_locationCape = new String[] {"locationCape", "field_178862_f"};
public static String[] World_addedTileEntityList = new String[] {"addedTileEntityList", "field_147484_a"};
}
+5
View File
@@ -27,6 +27,11 @@ public class Pos3D extends Vec3
{
super(vec.xCoord, vec.yCoord, vec.zCoord);
}
public Pos3D(Coord4D coord)
{
super(coord.xCoord, coord.yCoord, coord.zCoord);
}
public Pos3D(Vec3i vec)
{
+6 -6
View File
@@ -40,13 +40,13 @@ public class Range4D
public Range4D(Coord4D coord)
{
xMin = coord.getX();
yMin = coord.getY();
zMin = coord.getZ();
xMin = coord.xCoord;
yMin = coord.yCoord;
zMin = coord.zCoord;
xMax = coord.getX()+1;
yMax = coord.getY()+1;
zMax = coord.getZ()+1;
xMax = coord.xCoord+1;
yMax = coord.yCoord+1;
zMax = coord.zCoord+1;
dimensionId = coord.dimensionId;
}
@@ -248,23 +248,23 @@ public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N>> implemen
IGridTransmitter<A, N> initTransmitter = transmitters.iterator().next();
Coord4D initCoord = initTransmitter.coord();
int minX = initCoord.getX();
int minY = initCoord.getY();
int minZ = initCoord.getZ();
int maxX = initCoord.getX();
int maxY = initCoord.getY();
int maxZ = initCoord.getZ();
int minX = initCoord.xCoord;
int minY = initCoord.yCoord;
int minZ = initCoord.zCoord;
int maxX = initCoord.xCoord;
int maxY = initCoord.yCoord;
int maxZ = initCoord.zCoord;
for(IGridTransmitter transmitter : transmitters)
{
Coord4D coord = transmitter.coord();
if(coord.getX() < minX) minX = coord.getX();
if(coord.getY() < minY) minY = coord.getY();
if(coord.getZ() < minZ) minZ = coord.getZ();
if(coord.getX() > maxX) maxX = coord.getX();
if(coord.getY() > maxY) maxY = coord.getY();
if(coord.getX() > maxZ) maxZ = coord.getZ();
if(coord.xCoord < minX) minX = coord.xCoord;
if(coord.yCoord < minY) minY = coord.yCoord;
if(coord.zCoord < minZ) minZ = coord.zCoord;
if(coord.xCoord > maxX) maxX = coord.xCoord;
if(coord.yCoord > maxY) maxY = coord.yCoord;
if(coord.xCoord > maxZ) maxZ = coord.zCoord;
}
return new Range4D(minX, minY, minZ, maxX, maxY, maxZ, initTransmitter.world().provider.getDimensionId());
@@ -606,7 +606,7 @@ public class ClientProxy extends CommonProxy
{
if(Minecraft.getMinecraft().theWorld != null)
{
Minecraft.getMinecraft().effectRenderer.addBlockHitEffects(coord, mop);
Minecraft.getMinecraft().effectRenderer.addBlockHitEffects(coord.getPos(), mop);
}
}
@@ -52,12 +52,12 @@ public class SparkleAnimation
{
for(int i = 0; i < 6; i++)
{
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.getX() + random.nextDouble(), coord.getY() + -.01, coord.getZ() + random.nextDouble(), 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.getX() + random.nextDouble(), coord.getY() + 1.01, coord.getZ() + random.nextDouble(), 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.getX() + random.nextDouble(), coord.getY() + random.nextDouble(), coord.getZ() + -.01, 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.getX() + random.nextDouble(), coord.getY() + random.nextDouble(), coord.getZ() + 1.01, 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.getX() + -.01, coord.getY() + random.nextDouble(), coord.getZ() + random.nextDouble(), 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.getX() + 1.01, coord.getY() + random.nextDouble(), coord.getZ() + random.nextDouble(), 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.xCoord + random.nextDouble(), coord.yCoord + -.01, coord.zCoord + random.nextDouble(), 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.xCoord + random.nextDouble(), coord.yCoord + 1.01, coord.zCoord + random.nextDouble(), 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.xCoord + random.nextDouble(), coord.yCoord + random.nextDouble(), coord.zCoord + -.01, 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.xCoord + random.nextDouble(), coord.yCoord + random.nextDouble(), coord.zCoord + 1.01, 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.xCoord + -.01, coord.yCoord + random.nextDouble(), coord.zCoord + random.nextDouble(), 0, 0, 0);
world.spawnParticle(EnumParticleTypes.REDSTONE, coord.xCoord + 1.01, coord.yCoord + random.nextDouble(), coord.zCoord + random.nextDouble(), 0, 0, 0);
}
}
}
@@ -14,14 +14,13 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Rectangle;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiSeismicReader extends GuiScreen
{
@@ -43,7 +42,7 @@ public class GuiSeismicReader extends GuiScreen
public GuiSeismicReader(World world, Coord4D coord, ItemStack stack)
{
pos = new Coord4D(coord.getX(), Math.min(255, coord.getY()), coord.getZ());
pos = new Coord4D(coord.xCoord, Math.min(255, coord.yCoord), coord.zCoord);
worldObj = world;
itemStack = stack;
@@ -226,7 +225,7 @@ public class GuiSeismicReader extends GuiScreen
public void calculate()
{
for(BlockPos p = new BlockPos(pos.getX(), 0, pos.getZ()); p.getY() < pos.getY(); p = p.up())
for(BlockPos p = new BlockPos(pos.zCoord, 0, pos.zCoord); p.getY() < pos.yCoord; p = p.up())
{
IBlockState state = worldObj.getBlockState(p);
Block block = state.getBlock();
@@ -1,383 +0,0 @@
package mekanism.client.render;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
/**
* CTM Logic adapted from Chisel. Code licensed under GPLv2
*
* @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket
*/
public class CTM
{
static int submaps[][] = { {16, 17, 18, 19}, {16, 9, 18, 13}, {8, 9, 12, 13}, {8, 17, 12, 19}, {16, 9, 6, 15}, {8, 17, 14, 7}, {2, 11, 6, 15},
{8, 9, 14, 15}, {10, 1, 14, 15}, {10, 11, 14, 5}, {0, 11, 4, 15}, {0, 1, 14, 15}, {}, {}, {}, {}, {16, 17, 6, 7}, {16, 9, 6, 5}, {8, 9, 4, 5},
{8, 17, 4, 7}, {2, 11, 18, 13}, {10, 3, 12, 19}, {10, 11, 12, 13}, {10, 3, 14, 7}, {0, 11, 14, 15}, {10, 11, 4, 15}, {10, 11, 4, 5},
{10, 1, 14, 5}, {}, {}, {}, {}, {2, 3, 6, 7}, {2, 1, 6, 5}, {0, 1, 4, 5}, {0, 3, 4, 7}, {2, 11, 6, 5}, {8, 9, 4, 15}, {2, 1, 6, 15}, {8, 9, 14, 5},
{0, 1, 4, 15}, {0, 1, 14, 5}, {10, 1, 4, 15}, {0, 11, 14, 5}, {}, {}, {}, {}, {2, 3, 18, 19}, {2, 1, 18, 13}, {0, 1, 12, 13}, {0, 3, 12, 19},
{10, 1, 12, 13}, {0, 3, 14, 7}, {0, 11, 12, 13}, {10, 3, 4, 7}, {0, 11, 4, 5}, {10, 1, 4, 5}, {10, 11, 14, 15}, {0, 1, 4, 5}, {}, {}, {}, {},};
public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side, HashMap<Block, List<Integer>> blockMetas, boolean convexConnections)
{
int index = getTexture(world, x, y, z, side, blockMetas, convexConnections);
return submaps[index];
}
public static int getTexture(IBlockAccess world, int x, int y, int z, int side, HashMap<Block, List<Integer>> blockMetas, boolean convexConnections)
{
if(world == null)
{
return 0;
}
int texture = 0;
boolean b[] = new boolean[6];
if(side <= 1)
{
b[0] = isConnected(world, x - 1, y, z, side, blockMetas, convexConnections);
b[1] = isConnected(world, x + 1, y, z, side, blockMetas, convexConnections);
b[2] = isConnected(world, x, y, z + 1, side, blockMetas, convexConnections);
b[3] = isConnected(world, x, y, z - 1, side, blockMetas, convexConnections);
}
else if(side == 2)
{
b[0] = isConnected(world, x + 1, y, z, side, blockMetas, convexConnections);
b[1] = isConnected(world, x - 1, y, z, side, blockMetas, convexConnections);
b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections);
b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections);
}
else if(side == 3)
{
b[0] = isConnected(world, x - 1, y, z, side, blockMetas, convexConnections);
b[1] = isConnected(world, x + 1, y, z, side, blockMetas, convexConnections);
b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections);
b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections);
}
else if(side == 4)
{
b[0] = isConnected(world, x, y, z - 1, side, blockMetas, convexConnections);
b[1] = isConnected(world, x, y, z + 1, side, blockMetas, convexConnections);
b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections);
b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections);
}
else if(side == 5)
{
b[0] = isConnected(world, x, y, z + 1, side, blockMetas, convexConnections);
b[1] = isConnected(world, x, y, z - 1, side, blockMetas, convexConnections);
b[2] = isConnected(world, x, y - 1, z, side, blockMetas, convexConnections);
b[3] = isConnected(world, x, y + 1, z, side, blockMetas, convexConnections);
}
if(b[0] & !b[1] & !b[2] & !b[3])
{
texture = 3;
}
else if(!b[0] & b[1] & !b[2] & !b[3])
{
texture = 1;
}
else if(!b[0] & !b[1] & b[2] & !b[3])
{
texture = 16;
}
else if(!b[0] & !b[1] & !b[2] & b[3])
{
texture = 48;
}
else if(b[0] & b[1] & !b[2] & !b[3])
{
texture = 2;
}
else if(!b[0] & !b[1] & b[2] & b[3])
{
texture = 32;
}
else if(b[0] & !b[1] & b[2] & !b[3])
{
texture = 19;
}
else if(b[0] & !b[1] & !b[2] & b[3])
{
texture = 51;
}
else if(!b[0] & b[1] & b[2] & !b[3])
{
texture = 17;
}
else if(!b[0] & b[1] & !b[2] & b[3])
{
texture = 49;
}
else if(!b[0] & b[1] & b[2] & b[3])
{
texture = 33;
}
else if(b[0] & !b[1] & b[2] & b[3])
{
texture = 35;
}
else if(b[0] & b[1] & !b[2] & b[3])
{
texture = 50;
}
else if(b[0] & b[1] & b[2] & !b[3])
{
texture = 18;
}
else if(b[0] & b[1] & b[2] & b[3])
{
texture = 34;
}
boolean b2[] = new boolean[6];
if(side <= 1)
{
b2[0] = !isConnected(world, x + 1, y, z + 1, side, blockMetas, convexConnections);
b2[1] = !isConnected(world, x - 1, y, z + 1, side, blockMetas, convexConnections);
b2[2] = !isConnected(world, x + 1, y, z - 1, side, blockMetas, convexConnections);
b2[3] = !isConnected(world, x - 1, y, z - 1, side, blockMetas, convexConnections);
}
else if(side == 2)
{
b2[0] = !isConnected(world, x - 1, y - 1, z, side, blockMetas, convexConnections);
b2[1] = !isConnected(world, x + 1, y - 1, z, side, blockMetas, convexConnections);
b2[2] = !isConnected(world, x - 1, y + 1, z, side, blockMetas, convexConnections);
b2[3] = !isConnected(world, x + 1, y + 1, z, side, blockMetas, convexConnections);
}
else if(side == 3)
{
b2[0] = !isConnected(world, x + 1, y - 1, z, side, blockMetas, convexConnections);
b2[1] = !isConnected(world, x - 1, y - 1, z, side, blockMetas, convexConnections);
b2[2] = !isConnected(world, x + 1, y + 1, z, side, blockMetas, convexConnections);
b2[3] = !isConnected(world, x - 1, y + 1, z, side, blockMetas, convexConnections);
}
else if(side == 4)
{
b2[0] = !isConnected(world, x, y - 1, z + 1, side, blockMetas, convexConnections);
b2[1] = !isConnected(world, x, y - 1, z - 1, side, blockMetas, convexConnections);
b2[2] = !isConnected(world, x, y + 1, z + 1, side, blockMetas, convexConnections);
b2[3] = !isConnected(world, x, y + 1, z - 1, side, blockMetas, convexConnections);
}
else if(side == 5)
{
b2[0] = !isConnected(world, x, y - 1, z - 1, side, blockMetas, convexConnections);
b2[1] = !isConnected(world, x, y - 1, z + 1, side, blockMetas, convexConnections);
b2[2] = !isConnected(world, x, y + 1, z - 1, side, blockMetas, convexConnections);
b2[3] = !isConnected(world, x, y + 1, z + 1, side, blockMetas, convexConnections);
}
if(texture == 17 && b2[0])
{
texture = 4;
}
if(texture == 19 && b2[1])
{
texture = 5;
}
if(texture == 49 && b2[2])
{
texture = 20;
}
if(texture == 51 && b2[3])
{
texture = 21;
}
if(texture == 18 && b2[0] && b2[1])
{
texture = 7;
}
if(texture == 33 && b2[0] && b2[2])
{
texture = 6;
}
if(texture == 35 && b2[3] && b2[1])
{
texture = 23;
}
if(texture == 50 && b2[3] && b2[2])
{
texture = 22;
}
if(texture == 18 && !b2[0] && b2[1])
{
texture = 39;
}
if(texture == 33 && b2[0] && !b2[2])
{
texture = 38;
}
if(texture == 35 && !b2[3] && b2[1])
{
texture = 53;
}
if(texture == 50 && b2[3] && !b2[2])
{
texture = 52;
}
if(texture == 18 && b2[0] && !b2[1])
{
texture = 37;
}
if(texture == 33 && !b2[0] && b2[2])
{
texture = 36;
}
if(texture == 35 && b2[3] && !b2[1])
{
texture = 55;
}
if(texture == 50 && !b2[3] && b2[2])
{
texture = 54;
}
if(texture == 34 && b2[0] && b2[1] && b2[2] && b2[3])
{
texture = 58;
}
if(texture == 34 && !b2[0] && b2[1] && b2[2] && b2[3])
{
texture = 9;
}
if(texture == 34 && b2[0] && !b2[1] && b2[2] && b2[3])
{
texture = 25;
}
if(texture == 34 && b2[0] && b2[1] && !b2[2] && b2[3])
{
texture = 8;
}
if(texture == 34 && b2[0] && b2[1] && b2[2] && !b2[3])
{
texture = 24;
}
if(texture == 34 && b2[0] && b2[1] && !b2[2] && !b2[3])
{
texture = 11;
}
if(texture == 34 && !b2[0] && !b2[1] && b2[2] && b2[3])
{
texture = 26;
}
if(texture == 34 && !b2[0] && b2[1] && !b2[2] && b2[3])
{
texture = 27;
}
if(texture == 34 && b2[0] && !b2[1] && b2[2] && !b2[3])
{
texture = 10;
}
if(texture == 34 && b2[0] && !b2[1] && !b2[2] && b2[3])
{
texture = 42;
}
if(texture == 34 && !b2[0] && b2[1] && b2[2] && !b2[3])
{
texture = 43;
}
if(texture == 34 && b2[0] && !b2[1] && !b2[2] && !b2[3])
{
texture = 40;
}
if(texture == 34 && !b2[0] && b2[1] && !b2[2] && !b2[3])
{
texture = 41;
}
if(texture == 34 && !b2[0] && !b2[1] && b2[2] && !b2[3])
{
texture = 56;
}
if(texture == 34 && !b2[0] && !b2[1] && !b2[2] && b2[3])
{
texture = 57;
}
return texture;
}
public static boolean isConnected(IBlockAccess world, int x, int y, int z, int side, HashMap<Block, List<Integer>> blockMetas, boolean convexConnections)
{
int x2 = x, y2 = y, z2 = z;
switch(side)
{
case 0:
y2--;
break;
case 1:
y2++;
break;
case 2:
z2--;
break;
case 3:
z2++;
break;
case 4:
x2--;
break;
case 5:
x2++;
break;
}
IBlockState s1 = world.getBlockState(new BlockPos(x, y, z));
IBlockState s2 = world.getBlockState(new BlockPos(x2, y2, z2));
Block block1 = s1.getBlock();
Block block2 = s2.getBlock();
int meta1 = block1.getMetaFromState(s1);
int meta2 = block2.getMetaFromState(s2);
boolean validBlockMeta1 = false;
boolean invalidBlockMeta2 = true;
for(Entry<Block, List<Integer>> entry : blockMetas.entrySet())
{
validBlockMeta1 |= block1.equals(entry.getKey()) && entry.getValue().contains(meta1);
invalidBlockMeta2 &= convexConnections || !(block2.equals(entry.getKey()) && entry.getValue().contains(meta2));
}
return validBlockMeta1 && invalidBlockMeta2;
}
}
@@ -6,7 +6,6 @@ import java.util.List;
import java.util.Map;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.client.render.MekanismRenderer.DisplayInteger;
import mekanism.client.render.MekanismRenderer.Model3D;
import mekanism.common.tile.TileEntityDigitalMiner;
@@ -79,9 +78,9 @@ public final class MinerVisualRenderer
{
Model3D toReturn = new Model3D();
toReturn.setBlockBounds(rel.getX() + 0.4, rel.getY() + 0.4, rel.getZ() + 0.4, rel.getX() + 0.6, rel.getY() + 0.6, rel.getZ() + 0.6);
toReturn.setBlockBounds(rel.xCoord + 0.4, rel.yCoord + 0.4, rel.zCoord + 0.4, rel.xCoord + 0.6, rel.yCoord + 0.6, rel.zCoord + 0.6);
toReturn.baseBlock = Blocks.water;
//toReturn.setTexture(MekanismRenderer.getColorIcon(EnumColor.WHITE));
//toReturn.setTexture(MekanismRenderer.getColorIcon(EnumColor.WHITE)); TODO
return toReturn;
}
@@ -51,7 +51,7 @@ public class RenderTickHandler
if(pos != null)
{
Coord4D obj = new Coord4D(pos.getBlockPos(), world.provider.getDimensionId());
Coord4D obj = new Coord4D(pos.getBlockPos(), world);
if(MekanismAPI.debug && mc.currentScreen == null && !mc.gameSettings.showDebugInfo)
{
@@ -36,7 +36,7 @@ public class RenderBin extends TileEntitySpecialRenderer<TileEntityBin>
Coord4D obj = Coord4D.get(tileEntity).offset(tileEntity.facing);
if(tileEntity.getWorld().getBlockState(obj).getBlock().isSideSolid(tileEntity.getWorld(), obj, tileEntity.facing.getOpposite()))
if(obj.getBlockState(tileEntity.getWorld()).getBlock().isSideSolid(tileEntity.getWorld(), obj.getPos(), tileEntity.facing.getOpposite()))
{
return;
}
@@ -91,12 +91,12 @@ public class RenderBin extends TileEntitySpecialRenderer<TileEntityBin>
private void doLight(World world, Coord4D obj)
{
if(world.getBlockState(obj).getBlock().isOpaqueCube())
if(obj.getBlockState(world).getBlock().isOpaqueCube())
{
return;
}
int brightness = world.getLightFromNeighborsFor(EnumSkyBlock.SKY, obj);
int brightness = world.getLightFromNeighborsFor(EnumSkyBlock.SKY, obj.getPos());
int lightX = brightness % 65536;
int lightY = brightness / 65536;
float scale = 0.6F;
@@ -16,12 +16,11 @@ import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import org.lwjgl.opengl.GL11;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class RenderDynamicTank extends TileEntitySpecialRenderer<TileEntityDynamicTank>
{
@@ -46,7 +45,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer<TileEntityDynam
{
push();
GL11.glTranslated(getX(data.location.getX()), getY(data.location.getY()), getZ(data.location.getZ()));
GL11.glTranslated(getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));
MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity());
MekanismRenderer.colorFluid(tileEntity.structure.fluidStored.getFluid());
@@ -71,7 +70,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer<TileEntityDynam
{
push();
GL11.glTranslated(getX(valveData.location.getX()), getY(valveData.location.getY()), getZ(valveData.location.getZ()));
GL11.glTranslated(getX(valveData.location.xCoord), getY(valveData.location.yCoord), getZ(valveData.location.zCoord));
MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity());
@@ -258,7 +257,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer<TileEntityDynam
private int getValveFluidHeight(ValveRenderData data)
{
return data.valveLocation.getY() - data.location.getY();
return data.valveLocation.yCoord - data.location.yCoord;
}
private int getStages(int height)
@@ -43,7 +43,7 @@ public class RenderThermalEvaporationController extends TileEntitySpecialRendere
push();
GL11.glTranslated(getX(renderLoc.getX()), getY(renderLoc.getY()), getZ(renderLoc.getZ()));
GL11.glTranslated(getX(renderLoc.xCoord), getY(renderLoc.yCoord), getZ(renderLoc.zCoord));
MekanismRenderer.glowOn(tileEntity.inputTank.getFluid().getFluid().getLuminosity());
@@ -14,16 +14,14 @@ import mekanism.common.tile.TileEntityBoilerCasing;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import org.lwjgl.opengl.GL11;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEntityBoilerCasing>
{
@@ -44,7 +42,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEn
RenderData data = new RenderData();
data.location = tileEntity.structure.renderLocation;
data.height = (tileEntity.structure.upperRenderLocation.getY()-1)-tileEntity.structure.renderLocation.getY();
data.height = (tileEntity.structure.upperRenderLocation.yCoord-1)-tileEntity.structure.renderLocation.yCoord;
data.length = tileEntity.structure.volLength;
data.width = tileEntity.structure.volWidth;
@@ -54,7 +52,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEn
{
push();
GL11.glTranslated(getX(data.location.getX()), getY(data.location.getY()), getZ(data.location.getZ()));
GL11.glTranslated(getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));
MekanismRenderer.glowOn(tileEntity.structure.waterStored.getFluid().getLuminosity());
MekanismRenderer.colorFluid(tileEntity.structure.waterStored.getFluid());
@@ -79,7 +77,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEn
{
push();
GL11.glTranslated(getX(valveData.location.getX()), getY(valveData.location.getY()), getZ(valveData.location.getZ()));
GL11.glTranslated(getX(valveData.location.xCoord), getY(valveData.location.yCoord), getZ(valveData.location.zCoord));
MekanismRenderer.glowOn(tileEntity.structure.waterStored.getFluid().getLuminosity());
@@ -98,7 +96,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEn
RenderData data = new RenderData();
data.location = tileEntity.structure.upperRenderLocation;
data.height = (tileEntity.structure.renderLocation.getY()+tileEntity.structure.volHeight-2)-(tileEntity.structure.upperRenderLocation.getY());
data.height = (tileEntity.structure.renderLocation.yCoord+tileEntity.structure.volHeight-2)-(tileEntity.structure.upperRenderLocation.yCoord);
data.length = tileEntity.structure.volLength;
data.width = tileEntity.structure.volWidth;
@@ -108,7 +106,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEn
{
push();
GL11.glTranslated(getX(data.location.getX()), getY(data.location.getY()), getZ(data.location.getZ()));
GL11.glTranslated(getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));
MekanismRenderer.glowOn(tileEntity.structure.steamStored.getFluid().getLuminosity());
MekanismRenderer.colorFluid(tileEntity.structure.steamStored.getFluid());
@@ -317,7 +315,7 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEn
private int getValveFluidHeight(ValveRenderData data)
{
return data.valveLocation.getY() - data.location.getY();
return data.valveLocation.yCoord - data.location.yCoord;
}
private int getStages(int height)
-138
View File
@@ -1,138 +0,0 @@
package mekanism.common;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map.Entry;
//
//import mekanism.api.Coord4D;
//import mekanism.client.render.block.TextureSubmap;
//import net.minecraft.block.Block;
//import net.minecraft.client.renderer.texture.IIconRegister;
//import net.minecraft.util.IIcon;
//import net.minecraft.world.IBlockAccess;
//import net.minecraft.util.EnumFacing;
//import net.minecraftforge.fml.relauncher.Side;
//import net.minecraftforge.fml.relauncher.SideOnly;
public class CTMData
{/*
public CTMTextureData mainTextureData;
public HashMap<Block, List<Integer>> acceptableBlockMetas = new HashMap<Block, List<Integer>>();
public CTMTextureData[] sideOverrides = new CTMTextureData[6];
public CTMTextureData facingOverride;
public int facing;
public boolean renderConvexConnections = false;
public CTMData(String textureName, Block block, List<Integer> connectableMeta)
{
mainTextureData = new CTMTextureData(textureName);
acceptableBlockMetas.put(block, connectableMeta);
}
public CTMData addSideOverride(EnumFacing side, String sideTexture)
{
sideOverrides[side.ordinal()] = new CTMTextureData(sideTexture);
return this;
}
public CTMData addFacingOverride(String facingTexture)
{
facingOverride = new CTMTextureData(facingTexture);
return this;
}
public boolean hasFacingOverride()
{
return facingOverride != null;
}
public void setFacing(int newFacing)
{
facing = newFacing;
}
public CTMData registerIcons(IIconRegister register)
{
mainTextureData.registerIcons(register);
if(facingOverride != null)
{
facingOverride.registerIcons(register);
}
for(CTMTextureData data : sideOverrides)
{
if(data != null)
{
data.registerIcons(register);
}
}
return this;
}
public CTMTextureData getTextureData(int side)
{
if(hasFacingOverride() && side == facing)
{
return facingOverride;
}
if(sideOverrides[side] != null)
{
return sideOverrides[side];
}
return mainTextureData;
}
public IIcon getIcon(int side)
{
return getTextureData(side).icon;
}
public TextureSubmap getSubmap(int side)
{
return getTextureData(side).submap;
}
public TextureSubmap getSmallSubmap(int side)
{
return getTextureData(side).submapSmall;
}
public CTMData addOtherBlockConnectivities(Block block, List<Integer> connectableMeta)
{
acceptableBlockMetas.put(block, connectableMeta);
return this;
}
public CTMData setRenderConvexConnections()
{
renderConvexConnections = true;
return this;
}
@SideOnly(Side.CLIENT)
public boolean shouldRenderSide(IBlockAccess world, int x, int y, int z, int side)
{
Coord4D obj = new Coord4D(x, y, z);
Block coordBlock = obj.getBlock(world);
int coordMeta = obj.getBlockState(world);
boolean valid = false;
for(Entry<Block, List<Integer>> entry : acceptableBlockMetas.entrySet())
{
valid |= entry.getKey().equals(coordBlock) && entry.getValue().contains(coordMeta);
}
return !valid;
}
*/}
@@ -37,7 +37,7 @@ public class LaserManager
if(mop != null)
{
to = new Pos3D(mop.hitVec);
Coord4D toCoord = new Coord4D(mop.getBlockPos());
Coord4D toCoord = new Coord4D(mop.getBlockPos(), world);
TileEntity tile = toCoord.getTileEntity(world);
if(tile instanceof ILaserReceptor)
@@ -83,8 +83,8 @@ public class LaserManager
IBlockState state = blockCoord.getBlockState(world);
Block blockHit = state.getBlock();
EntityPlayer dummy = Mekanism.proxy.getDummyPlayer((WorldServer)world, blockCoord.getX(), blockCoord.getY(), blockCoord.getZ()).get();
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, blockCoord, state, dummy);
EntityPlayer dummy = Mekanism.proxy.getDummyPlayer((WorldServer)world, blockCoord.xCoord, blockCoord.yCoord, blockCoord.zCoord).get();
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, blockCoord.getPos(), state, dummy);
MinecraftForge.EVENT_BUS.post(event);
if(event.isCanceled())
@@ -94,15 +94,15 @@ public class LaserManager
if(dropAtBlock)
{
blockHit.dropBlockAsItem(world, blockCoord, state, 0);
blockHit.dropBlockAsItem(world, blockCoord.getPos(), state, 0);
}
else {
ret = blockHit.getDrops(world, blockCoord, state, 0);
ret = blockHit.getDrops(world, blockCoord.getPos(), state, 0);
}
blockHit.breakBlock(world, blockCoord, state);
world.setBlockToAir(blockCoord);
world.playAuxSFX(2001, blockCoord, Block.getIdFromBlock(blockHit));
blockHit.breakBlock(world, blockCoord.getPos(), state);
world.setBlockToAir(blockCoord.getPos());
world.playAuxSFX(2001, blockCoord.getPos(), Block.getIdFromBlock(blockHit));
return ret;
}
@@ -1037,9 +1037,9 @@ public abstract class BlockBasic extends Block implements ICTMBlock//TODO? imple
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, BlockPos pos, EnumFacing side)
{
Coord4D obj = new Coord4D(pos).offset(EnumFacing.getFront(side.ordinal()).getOpposite());
BlockPos offsetPos = pos.offset(EnumFacing.getFront(side.ordinal()).getOpposite());
if(BasicBlockType.get(world.getBlockState(obj)) == BasicBlockType.STRUCTURAL_GLASS)
if(BasicBlockType.get(world.getBlockState(offsetPos)) == BasicBlockType.STRUCTURAL_GLASS)
{
return ctmData[10][0].shouldRenderSide(world, pos, side);
}
@@ -1126,41 +1126,4 @@ public abstract class BlockBasic extends Block implements ICTMBlock//TODO? imple
{
return getBasicBlock().getProperty();
}
/*
@Override
public CTMData getCTMData(IBlockAccess world, BlockPos pos, int meta)
{
if(ctms[meta][1] != null && MekanismUtils.isActive(world, pos))
{
return ctms[meta][1];
}
BasicBlockType type = BasicBlockType.get(this, world.getBlockMetadata(x, y, z));
if(type == BasicBlockType.INDUCTION_CELL)
{
TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(pos);
return ctms[meta][tileEntity.tier.ordinal()];
}
else if(type == BasicBlockType.INDUCTION_PROVIDER)
{
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(pos);
return ctms[meta][tileEntity.tier.ordinal()];
}
else if(type == BasicType.SUPERHEATING_ELEMENT)
{
TileEntitySuperheatingElement element = (TileEntitySuperheatingElement)world.getTileEntity(x, y, z);
if(element.multiblockUUID != null && SynchronizedBoilerData.clientHotMap.get(element.multiblockUUID) != null)
{
return ctms[meta][SynchronizedBoilerData.clientHotMap.get(element.multiblockUUID) ? 1 : 0];
}
return ctms[meta][0];
}
return ctms[meta][0];
}
*/
}
@@ -9,6 +9,8 @@ import mekanism.api.MekanismConfig.client;
import mekanism.api.MekanismConfig.general;
import mekanism.api.energy.IEnergizedItem;
import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.client.render.ctm.CTMData;
import mekanism.client.render.ctm.ICTMBlock;
import mekanism.common.Mekanism;
import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.FluidTankTier;
@@ -24,6 +26,7 @@ import mekanism.common.base.ISustainedInventory;
import mekanism.common.base.ISustainedTank;
import mekanism.common.base.ITierItem;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.block.states.BlockStateBasic.BasicBlockType;
import mekanism.common.block.states.BlockStateFacing;
import mekanism.common.block.states.BlockStateMachine;
import mekanism.common.block.states.BlockStateMachine.MachineBlock;
@@ -124,9 +127,9 @@ import buildcraft.api.tools.IToolWrench;
* @author AidanBrady
*
*/
public abstract class BlockMachine extends BlockContainer implements ISpecialBounds//, IBlockCTM, ICustomBlockIcon
public abstract class BlockMachine extends BlockContainer implements ISpecialBounds, ICTMBlock//, ICustomBlockIcon
{
//public CTMData[][] ctms = new CTMData[16][4];
public CTMData[][] ctmData = new CTMData[16][4];
public BlockMachine()
{
@@ -134,6 +137,8 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
setHardness(3.5F);
setResistance(16F);
setCreativeTab(Mekanism.tabMekanism);
initCTMs();
}
public static BlockMachine getBlockMachine(MachineBlock block)
@@ -202,6 +207,18 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
return state;
}
public void initCTMs()
{
switch(getMachineBlock())
{
case MACHINE_BLOCK_1:
ctmData[11][0] = new CTMData(BasicBlockType.TELEPORTER_FRAME, MachineType.TELEPORTER);
break;
default:
}
}
/*
@Override
@@ -573,15 +590,12 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
{
for(Fluid f : FluidRegistry.getRegisteredFluids().values())
{
try
{ //Prevent bad IDs
try { //Prevent bad IDs
ItemStack filled = new ItemStack(item, 1, type.meta);
itemMachine.setBaseTier(filled, BaseTier.ULTIMATE);
itemMachine.setFluidStack(new FluidStack(f, itemMachine.getCapacity(filled)), filled);
list.add(filled);
} catch(Exception e)
{
}
} catch(Exception e) {}
}
}
@@ -645,8 +659,8 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
tileEntity.setFacing((short)change);
world.notifyNeighborsOfStateChange(pos, this);
} else
{
}
else {
SecurityUtils.displayNoAccess(entityplayer);
}
@@ -668,8 +682,8 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
if(SecurityUtils.canAccess(entityplayer, tileEntity))
{
MekanismUtils.openPersonalChestGui((EntityPlayerMP)entityplayer, chest, null, true);
} else
{
}
else {
SecurityUtils.displayNoAccess(entityplayer);
}
@@ -689,12 +703,12 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
entityplayer.inventory.markDirty();
return true;
}
} else
{
}
else {
entityplayer.openGui(Mekanism.instance, type.guiId, world, pos.getX(), pos.getY(), pos.getZ());
}
} else
{
}
else {
SecurityUtils.displayNoAccess(entityplayer);
}
@@ -708,8 +722,8 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
if(SecurityUtils.canAccess(entityplayer, tileEntity))
{
LogisticalSorterGuiMessage.openServerGui(SorterGuiPacket.SERVER, 0, world, (EntityPlayerMP)entityplayer, Coord4D.get(tileEntity), -1);
} else
{
}
else {
SecurityUtils.displayNoAccess(entityplayer);
}
@@ -726,8 +740,8 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
if(owner == null || entityplayer.getName().equals(owner))
{
entityplayer.openGui(Mekanism.instance, type.guiId, world, pos.getX(), pos.getY(), pos.getZ());
} else
{
}
else {
SecurityUtils.displayNoAccess(entityplayer);
}
@@ -760,6 +774,7 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
public TileEntity createTileEntity(World world, IBlockState state)
{
int metadata = getMetaFromState(state);
if(BlockStateMachine.MachineType.get(getMachineBlock(), metadata) == null)
{
return null;
@@ -1178,6 +1193,24 @@ public abstract class BlockMachine extends BlockContainer implements ISpecialBou
return true;
}
}
@Override
public CTMData getCTMData(IBlockState state)
{
return ctmData[getMetaFromState(state)][0];
}
@Override
public String getOverrideTexture(IBlockState state, EnumFacing side)
{
return null;
}
@Override
public PropertyEnum<MachineType> getTypeProperty()
{
return getMachineBlock().getProperty();
}
@Override
public void setRenderBounds(Block block, int metadata) {}
@@ -43,7 +43,7 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
return true;
}
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld()).safeTileGet(pointer.getWorld());
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld().provider.getDimensionId()).getTileEntity(pointer.getWorld());
return tile instanceof TileEntityPressureDisperser || tile instanceof TileEntitySuperheatingElement;
}
@@ -58,7 +58,7 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
for(Coord4D coord : innerNodes)
{
TileEntity tile = coord.safeTileGet(pointer.getWorld());
TileEntity tile = coord.getTileEntity(pointer.getWorld());
if(tile instanceof TileEntityPressureDisperser)
{
@@ -83,13 +83,13 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
final Coord4D initDisperser = dispersers.iterator().next();
//Ensure that a full horizontal plane of dispersers exist, surrounding the found disperser
Coord4D pos = new Coord4D(structure.renderLocation.getX(), initDisperser.getY(), structure.renderLocation.getZ(), pointer.getWorld().provider.getDimensionId());
Coord4D pos = new Coord4D(structure.renderLocation.xCoord, initDisperser.yCoord, structure.renderLocation.zCoord, pointer.getWorld().provider.getDimensionId());
for(int x = 1; x < structure.volLength-1; x++)
{
for(int z = 1; z < structure.volWidth-1; z++)
{
Coord4D coord4D = pos.add(x, 0, z);
TileEntity tile = coord4D.safeTileGet(pointer.getWorld());
Coord4D coord4D = pos.translate(x, 0, z);
TileEntity tile = coord4D.getTileEntity(pointer.getWorld());
if(!(tile instanceof TileEntityPressureDisperser))
{
@@ -112,7 +112,7 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
@Override
public boolean isValid(Coord4D coord)
{
return coord.safeTileGet(pointer.getWorld()) instanceof TileEntitySuperheatingElement;
return coord.getTileEntity(pointer.getWorld()) instanceof TileEntitySuperheatingElement;
}
}).calculate(elements.iterator().next());
}
@@ -125,15 +125,14 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
Coord4D initAir = null;
int totalAir = 0;
pos = new Coord4D(structure.renderLocation, pointer.getWorld().provider.getDimensionId());
//Find the first available block in the structure for water storage (including casings)
for(int x = 0; x < structure.volLength; x++)
{
for(int y = 0; y < initDisperser.getY() - structure.renderLocation.getY(); y++)
for(int y = 0; y < initDisperser.yCoord - structure.renderLocation.yCoord; y++)
{
for(int z = 0; z < structure.volWidth; z++)
{
if(pointer.getWorld().isAirBlock(pos.add(x, y, z)) || isViableNode(pos.add(x, y, z)))
if(pointer.getWorld().isAirBlock(pos.translate(x, y, z).getPos()) || isViableNode(pos.translate(x, y, z).getPos()))
{
initAir = new Coord4D(x, y, z, pointer.getWorld().provider.getDimensionId());
totalAir++;
@@ -157,10 +156,10 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
@Override
public final boolean isValid(Coord4D coord)
{
return coord.getY() >= renderLocation.getY()-1 && coord.getY() < initDisperser.getY() &&
coord.getX() >= renderLocation.getX() && coord.getX() < renderLocation.getX()+volLength &&
coord.getZ() >= renderLocation.getZ() && coord.getZ() < renderLocation.getZ()+volWidth &&
(coord.isAirBlock(pointer.getWorld()) || isViableNode(coord));
return coord.yCoord >= renderLocation.yCoord-1 && coord.yCoord < initDisperser.yCoord &&
coord.xCoord >= renderLocation.xCoord && coord.xCoord < renderLocation.xCoord+volLength &&
coord.zCoord >= renderLocation.zCoord && coord.zCoord < renderLocation.zCoord+volWidth &&
(coord.isAirBlock(pointer.getWorld()) || isViableNode(coord.getPos()));
}
}).calculate(initAir);
@@ -170,10 +169,10 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
return false;
}
int steamHeight = (structure.renderLocation.getY()+structure.volHeight-2)-initDisperser.getY();
int steamHeight = (structure.renderLocation.yCoord+structure.volHeight-2)-initDisperser.yCoord;
structure.steamVolume = structure.volWidth*structure.volLength*steamHeight;
structure.upperRenderLocation = new Coord4D(structure.renderLocation.getX(), initDisperser.getY()+1, structure.renderLocation.getZ());
structure.upperRenderLocation = new Coord4D(structure.renderLocation.xCoord, initDisperser.yCoord+1, structure.renderLocation.zCoord);
return true;
}
@@ -244,7 +243,7 @@ public class BoilerUpdateProtocol extends UpdateProtocol<SynchronizedBoilerData>
{
for(Coord4D obj : structure.locations)
{
if(obj.safeTileGet(pointer.getWorld()) instanceof TileEntityBoilerValve)
if(obj.getTileEntity(pointer.getWorld()) instanceof TileEntityBoilerValve)
{
ValveData data = new ValveData();
data.location = obj;
@@ -34,7 +34,7 @@ public class MatrixUpdateProtocol extends UpdateProtocol<SynchronizedMatrixData>
@Override
public boolean isValidInnerNode(int x, int y, int z)
{
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld()).safeTileGet(pointer.getWorld());
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld().provider.getDimensionId()).getTileEntity(pointer.getWorld());
if(tile != null && (tile instanceof TileEntityInductionCell || tile instanceof TileEntityInductionProvider))
{
@@ -80,7 +80,7 @@ public class MatrixUpdateProtocol extends UpdateProtocol<SynchronizedMatrixData>
{
for(Coord4D coord : innerNodes)
{
TileEntity tile = coord.safeTileGet(pointer.getWorld());
TileEntity tile = coord.getTileEntity(pointer.getWorld());
if(tile instanceof TileEntityInductionCell)
{
@@ -53,9 +53,9 @@ public class ThreadMinerSearch extends Thread
for(int i = 0; i < size; i++)
{
int x = coord.getX()+i%diameter;
int z = coord.getY()+(i/diameter)%diameter;
int y = coord.getZ()+(i/diameter/diameter);
int x = coord.xCoord+i%diameter;
int z = coord.yCoord+(i/diameter)%diameter;
int y = coord.zCoord+(i/diameter/diameter);
if(tileEntity.isInvalid())
{
@@ -90,7 +90,7 @@ public class TankUpdateProtocol extends UpdateProtocol<SynchronizedTankData>
{
for(Coord4D obj : structure.locations)
{
if(obj.safeTileGet(pointer.getWorld()) instanceof TileEntityDynamicValve)
if(obj.getTileEntity(pointer.getWorld()) instanceof TileEntityDynamicValve)
{
ValveData data = new ValveData();
data.location = obj;
@@ -6,15 +6,13 @@ import java.util.List;
import java.util.Map;
import mekanism.api.Coord4D;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
public class PathfinderCache
{
public static Map<PathData, List<Coord4D>> cachedPaths = new HashMap<PathData, List<Coord4D>>();
public static void onChanged(BlockPos location)
public static void onChanged(Coord4D location)
{
reset();
}
@@ -21,8 +21,8 @@ import mekanism.common.tile.TileEntityLogisticalSorter;
import mekanism.common.util.InventoryUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
@@ -104,7 +104,7 @@ public final class TransporterPathfinder
while(true)
{
Coord4D coord = start.offset(side, count);
Coord4D coord = start.getFromSide(side, count);
if(transportStack.canInsertToTransporter(coord.getTileEntity(worldObj), side))
{
@@ -88,7 +88,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData
this(world);
latched = obj;
setPosition(latched.getX() + 0.5F, latched.getY() + 1.9F, latched.getZ() + 0.5F);
setPosition(latched.xCoord + 0.5F, latched.yCoord + 1.9F, latched.zCoord + 0.5F);
prevPosX = posX;
prevPosY = posY;
@@ -97,9 +97,9 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData
color = c;
dataWatcher.updateObject(5, (byte)1); /* Is latched */
dataWatcher.updateObject(6, latched != null ? latched.getX() : 0); /* Latched X */
dataWatcher.updateObject(7, latched != null ? latched.getY() : 0); /* Latched Y */
dataWatcher.updateObject(8, latched != null ? latched.getZ() : 0); /* Latched Z */
dataWatcher.updateObject(6, latched != null ? latched.xCoord : 0); /* Latched X */
dataWatcher.updateObject(7, latched != null ? latched.yCoord : 0); /* Latched Y */
dataWatcher.updateObject(8, latched != null ? latched.zCoord : 0); /* Latched Z */
dataWatcher.updateObject(9, -1); /* Latched entity ID */
}
@@ -145,9 +145,9 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData
if(ticksExisted == 1)
{
dataWatcher.updateObject(5, new Byte(latched != null ? (byte)1 : (latchedEntity != null ? (byte)2 : (byte)0))); /* Is latched */
dataWatcher.updateObject(6, new Integer(latched != null ? latched.getX() : 0)); /* Latched X */
dataWatcher.updateObject(7, new Integer(latched != null ? latched.getY() : 0)); /* Latched Y */
dataWatcher.updateObject(8, new Integer(latched != null ? latched.getZ() : 0)); /* Latched Z */
dataWatcher.updateObject(6, new Integer(latched != null ? latched.xCoord : 0)); /* Latched X */
dataWatcher.updateObject(7, new Integer(latched != null ? latched.yCoord : 0)); /* Latched Y */
dataWatcher.updateObject(8, new Integer(latched != null ? latched.zCoord : 0)); /* Latched Z */
dataWatcher.updateObject(9, new Integer(latchedEntity != null ? latchedEntity.getEntityId() : -1)); /* Latched entity ID */
}
}
@@ -184,17 +184,17 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData
{
IBlockState state = worldObj.getBlockState(mop.getBlockPos());
Block block = state.getBlock();
boolean fluid = MekanismUtils.isFluid(worldObj, new Coord4D(mop)) || MekanismUtils.isDeadFluid(worldObj, new Coord4D(mop));
boolean fluid = MekanismUtils.isFluid(worldObj, new Coord4D(mop, worldObj)) || MekanismUtils.isDeadFluid(worldObj, new Coord4D(mop, worldObj));
Coord4D sideCoord = new Coord4D(mop.getBlockPos().offset(mop.sideHit), worldObj.provider.getDimensionId());
Coord4D sideCoord = new Coord4D(mop.getBlockPos().offset(mop.sideHit), worldObj);
if(general.aestheticWorldDamage && !fluid && (sideCoord.isAirBlock(worldObj) || sideCoord.isReplaceable(worldObj)))
{
if(mode != ItemFlamethrower.FlamethrowerMode.COMBAT && !smeltBlock(new Coord4D(mop.getBlockPos())))
if(mode != ItemFlamethrower.FlamethrowerMode.COMBAT && !smeltBlock(new Coord4D(mop, worldObj)))
{
if(mode == ItemFlamethrower.FlamethrowerMode.INFERNO && !worldObj.isRemote)
{
worldObj.setBlockState(sideCoord, Blocks.fire.getDefaultState());
worldObj.setBlockState(sideCoord.getPos(), Blocks.fire.getDefaultState());
}
}
}
@@ -249,19 +249,19 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData
if(newBlock != null && newBlock != Blocks.air)
{
worldObj.setBlockState(block, Block.getBlockFromItem(result.getItem()).getStateFromMeta(result.getItemDamage()), 3);
worldObj.setBlockState(block.getPos(), Block.getBlockFromItem(result.getItem()).getStateFromMeta(result.getItemDamage()), 3);
}
else {
worldObj.setBlockToAir(block);
worldObj.setBlockToAir(block.getPos());
EntityItem item = new EntityItem(worldObj, block.getX() + 0.5, block.getY() + 0.5, block.getZ() + 0.5, result.copy());
EntityItem item = new EntityItem(worldObj, block.xCoord + 0.5, block.yCoord + 0.5, block.zCoord + 0.5, result.copy());
item.motionX = 0;
item.motionY = 0;
item.motionZ = 0;
worldObj.spawnEntityInWorld(item);
}
worldObj.playAuxSFXAtEntity(null, 2001, block, Block.getIdFromBlock(b) + (b.getMetaFromState(state) << 12));
worldObj.playAuxSFXAtEntity(null, 2001, block.getPos(), Block.getIdFromBlock(b) + (b.getMetaFromState(state) << 12));
}
spawnParticlesAt(new Pos3D(block).translate(0.5, 0.5, 0.5));
@@ -309,7 +309,7 @@ public class EntityRobit extends EntityCreature implements IInventory, ISustaine
travelToDimension(homeLocation.dimensionId);
}
setPositionAndUpdate(homeLocation.getX()+0.5, homeLocation.getY()+0.3, homeLocation.getZ()+0.5);
setPositionAndUpdate(homeLocation.xCoord+0.5, homeLocation.yCoord+0.3, homeLocation.zCoord+0.5);
motionX = 0;
motionY = 0;
@@ -248,7 +248,7 @@ public class FrequencyManager
iter.remove();
}
else {
TileEntity tile = coord.safeTileGet(world);
TileEntity tile = coord.getTileEntity(world);
if(!(tile instanceof IFrequencyHandler))
{
@@ -90,7 +90,7 @@ public class WailaDataProvider implements IWailaDataProvider
else if(tile instanceof TileEntityBoundingBlock)
{
TileEntityBoundingBlock bound = (TileEntityBoundingBlock)tile;
Coord4D coord = new Coord4D(bound.getPos(), tile.getWorld().provider.getDimensionId());
Coord4D coord = new Coord4D(bound.getPos(), tile.getWorld());
if(bound.receivedCoords && coord.getTileEntity(tile.getWorld()) instanceof IInventory)
{
@@ -104,7 +104,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
}
ItemStack stack = new ItemStack(block, 1, meta);
Coord4D orig = new Coord4D(pos, player.worldObj.provider.getDimensionId());
Coord4D orig = new Coord4D(pos, player.worldObj);
List<String> names = MekanismUtils.getOreDictName(stack);
@@ -120,7 +120,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
if(getMode(itemstack) == 3 && isOre && !player.capabilities.isCreativeMode)
{
Set<Coord4D> found = new Finder(player.worldObj, stack, new Coord4D(pos, player.worldObj.provider.getDimensionId())).calc();
Set<Coord4D> found = new Finder(player.worldObj, stack, new Coord4D(pos, player.worldObj)).calc();
for(Coord4D coord : found)
{
@@ -131,11 +131,11 @@ public class ItemAtomicDisassembler extends ItemEnergized
Block block2 = coord.getBlock(player.worldObj);
block2.onBlockDestroyedByPlayer(player.worldObj, coord, state);
player.worldObj.playAuxSFXAtEntity(null, 2001, coord, meta << 12);
player.worldObj.setBlockToAir(coord);
block2.breakBlock(player.worldObj, coord, state);
block2.dropBlockAsItem(player.worldObj, coord, state, 0);
block2.onBlockDestroyedByPlayer(player.worldObj, coord.getPos(), state);
player.worldObj.playAuxSFXAtEntity(null, 2001, coord.getPos(), meta << 12);
player.worldObj.setBlockToAir(coord.getPos());
block2.breakBlock(player.worldObj, coord.getPos(), state);
block2.dropBlockAsItem(player.worldObj, coord.getPos(), state, 0);
setEnergy(itemstack, getEnergy(itemstack) - (general.DISASSEMBLER_USAGE*getEfficiency(itemstack)));
}
@@ -129,7 +129,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
if(!world.isRemote)
{
world.spawnEntityInWorld(new EntityBalloon(world, new Coord4D(pos, world.provider.getDimensionId()), getColor(stack)));
world.spawnEntityInWorld(new EntityBalloon(world, new Coord4D(pos, world), getColor(stack)));
stack.stackSize--;
}
}
@@ -237,7 +237,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
if(!source.getWorld().isRemote)
{
source.getWorld().spawnEntityInWorld(new EntityBalloon(source.getWorld(), new Coord4D(new BlockPos(pos)), getColor(stack)));
source.getWorld().spawnEntityInWorld(new EntityBalloon(source.getWorld(), new Coord4D(new BlockPos(pos), source.getWorld()), getColor(stack)));
}
}
@@ -511,16 +511,16 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
else {
if(pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
Coord4D coord = new Coord4D(pos.getBlockPos(), world.provider.getDimensionId());
Coord4D coord = new Coord4D(pos.getBlockPos(), world);
if(!world.provider.canMineBlock(entityplayer, coord))
if(!world.provider.canMineBlock(entityplayer, coord.getPos()))
{
return itemstack;
}
if(!entityplayer.isSneaking())
{
if(!entityplayer.canPlayerEdit(coord, pos.sideHit, itemstack))
if(!entityplayer.canPlayerEdit(coord.getPos(), pos.sideHit, itemstack))
{
return itemstack;
}
@@ -546,7 +546,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
setFluidStack(newStack, itemstack);
}
world.setBlockToAir(coord);
world.setBlockToAir(coord.getPos());
}
}
else {
@@ -559,12 +559,12 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
Coord4D trans = coord.offset(pos.sideHit);
if(!entityplayer.canPlayerEdit(trans, pos.sideHit, itemstack))
if(!entityplayer.canPlayerEdit(trans.getPos(), pos.sideHit, itemstack))
{
return itemstack;
}
if(tryPlaceContainedLiquid(world, itemstack, trans) && !entityplayer.capabilities.isCreativeMode)
if(tryPlaceContainedLiquid(world, itemstack, trans.getPos()) && !entityplayer.capabilities.isCreativeMode)
{
FluidStack newStack = stored.copy();
newStack.amount -= FluidContainerRegistry.BUCKET_VOLUME;
@@ -83,7 +83,7 @@ public class ItemPortableTeleporter extends ItemEnergized implements IOwnerItem
neededEnergy+=10000;
}
int distance = (int)entity.getDistance(coords.getX(), coords.getY(), coords.getZ());
int distance = (int)entity.getDistance(coords.xCoord, coords.yCoord, coords.zCoord);
neededEnergy+=(distance*10);
@@ -39,7 +39,7 @@ public class MultiblockManager<T extends SynchronizedData<T>>
for(Coord4D obj : inventories.get(id).locations)
{
TileEntityMultiblock<T> tileEntity = (TileEntityMultiblock<T>)obj.safeTileGet(world);
TileEntityMultiblock<T> tileEntity = (TileEntityMultiblock<T>)obj.getTileEntity(world);
if(tileEntity != null)
{
@@ -83,7 +83,7 @@ public class MultiblockManager<T extends SynchronizedData<T>>
{
if(obj.dimensionId == world.provider.getDimensionId() && obj.exists(world))
{
TileEntity tileEntity = obj.safeTileGet(world);
TileEntity tileEntity = obj.getTileEntity(world);
if(!(tileEntity instanceof TileEntityMultiblock) || ((TileEntityMultiblock)tileEntity).getManager() != this || (getStructureId(((TileEntityMultiblock<?>)tileEntity)) != null && getStructureId(((TileEntityMultiblock)tileEntity)) != inventoryID))
{
@@ -39,7 +39,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
{
World worldObj = pointer.getWorld();
int origX = coord.getX(), origY = coord.getY(), origZ = coord.getZ();
int origX = coord.xCoord, origY = coord.yCoord, origZ = coord.zCoord;
boolean isCorner = true;
boolean isHollow = true;
@@ -142,13 +142,13 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
rightBlocks = false;
break;
}
else if(isFrame(coord.add(x, y, z), origX+xmin, origX+xmax, origY+ymin, origY+ymax, origZ+zmin, origZ+zmax) && !isValidFrame(origX+x, origY+y, origZ+z))
else if(isFrame(coord.translate(x, y, z), origX+xmin, origX+xmax, origY+ymin, origY+ymax, origZ+zmin, origZ+zmax) && !isValidFrame(origX+x, origY+y, origZ+z))
{
rightFrame = false;
break;
}
else {
locations.add(coord.add(x, y, z));
locations.add(coord.translate(x, y, z));
}
}
else {
@@ -193,9 +193,9 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
structure.volHeight = Math.abs(ymax-ymin)+1;
structure.volWidth = Math.abs(zmax-zmin)+1;
structure.volume = structure.volLength*structure.volHeight*structure.volWidth;
structure.renderLocation = coord.add(0, 1, 0);
structure.minLocation = coord.add(xmin, ymin, zmin);
structure.maxLocation = coord.add(xmax, ymax, zmax);
structure.renderLocation = coord.translate(0, 1, 0);
structure.minLocation = coord.translate(xmin, ymin, zmin);
structure.maxLocation = coord.translate(xmax, ymax, zmax);
if(structure.volLength >= 3 && structure.volHeight >= 3 && structure.volWidth >= 3)
{
@@ -220,7 +220,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
{
Coord4D sideCoord = coord.offset(side);
if(isViableNode(sideCoord))
if(isViableNode(sideCoord.getPos()))
{
if(!iteratedNodes.contains(sideCoord))
{
@@ -237,27 +237,27 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
public EnumFacing getSide(Coord4D obj, int xmin, int xmax, int ymin, int ymax, int zmin, int zmax)
{
if(obj.getX() == xmin)
if(obj.xCoord == xmin)
{
return EnumFacing.WEST;
}
else if(obj.getX() == xmax)
else if(obj.xCoord == xmax)
{
return EnumFacing.EAST;
}
else if(obj.getY() == ymin)
else if(obj.yCoord == ymin)
{
return EnumFacing.DOWN;
}
else if(obj.getY() == ymax)
else if(obj.yCoord == ymax)
{
return EnumFacing.UP;
}
else if(obj.getZ() == zmin)
else if(obj.zCoord == zmin)
{
return EnumFacing.NORTH;
}
else if(obj.getZ() == zmax)
else if(obj.zCoord == zmax)
{
return EnumFacing.SOUTH;
}
@@ -291,7 +291,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
*/
public boolean isViableNode(int x, int y, int z)
{
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld().provider.getDimensionId()).safeTileGet(pointer.getWorld());
TileEntity tile = new Coord4D(x, y, z, pointer.getWorld().provider.getDimensionId()).getTileEntity(pointer.getWorld());
if(tile instanceof IStructuralMultiblock)
{
@@ -316,7 +316,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
*/
public boolean isViableNode(BlockPos pos)
{
TileEntity tile = new Coord4D(pos, pointer.getWorld()).safeTileGet(pointer.getWorld());
TileEntity tile = new Coord4D(pos, pointer.getWorld()).getTileEntity(pointer.getWorld());
if(tile == null || !tile.hasWorldObj() || tile.isInvalid())
{
@@ -350,7 +350,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
*/
private boolean isCorrectCorner(Coord4D obj, int xmin, int ymin, int zmin)
{
if(obj.getX() == xmin && obj.getY() == ymin && obj.getZ() == zmin)
if(obj.xCoord == xmin && obj.yCoord == ymin && obj.zCoord == zmin)
{
return true;
}
@@ -371,31 +371,31 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
*/
private boolean isFrame(Coord4D obj, int xmin, int xmax, int ymin, int ymax, int zmin, int zmax)
{
if(obj.getX() == xmin && obj.getY() == ymin)
if(obj.xCoord == xmin && obj.yCoord == ymin)
return true;
if(obj.getX() == xmax && obj.getY() == ymin)
if(obj.xCoord == xmax && obj.yCoord == ymin)
return true;
if(obj.getX() == xmin && obj.getY() == ymax)
if(obj.xCoord == xmin && obj.yCoord == ymax)
return true;
if(obj.getX() == xmax && obj.getY() == ymax)
if(obj.xCoord == xmax && obj.yCoord == ymax)
return true;
if(obj.getX() == xmin && obj.getZ() == zmin)
if(obj.xCoord == xmin && obj.zCoord == zmin)
return true;
if(obj.getX() == xmax && obj.getZ() == zmin)
if(obj.xCoord == xmax && obj.zCoord == zmin)
return true;
if(obj.getX() == xmin && obj.getZ() == zmax)
if(obj.xCoord == xmin && obj.zCoord == zmax)
return true;
if(obj.getX() == xmax && obj.getZ() == zmax)
if(obj.xCoord == xmax && obj.zCoord == zmax)
return true;
if(obj.getY() == ymin && obj.getZ() == zmin)
if(obj.yCoord == ymin && obj.zCoord == zmin)
return true;
if(obj.getY() == ymax && obj.getZ() == zmin)
if(obj.yCoord == ymax && obj.zCoord == zmin)
return true;
if(obj.getY() == ymin && obj.getZ() == zmax)
if(obj.yCoord == ymin && obj.zCoord == zmax)
return true;
if(obj.getY() == ymax && obj.getZ() == zmax)
if(obj.yCoord == ymax && obj.zCoord == zmax)
return true;
return false;
@@ -422,7 +422,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
{
for(Coord4D coord : structureFound.internalLocations)
{
TileEntity tile = coord.safeTileGet(pointer.getWorld());
TileEntity tile = coord.getTileEntity(pointer.getWorld());
if(tile instanceof TileEntityInternalMultiblock)
{
@@ -437,7 +437,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
{
for(Coord4D coord : structure.internalLocations)
{
TileEntity tile = coord.safeTileGet(pointer.getWorld());
TileEntity tile = coord.getTileEntity(pointer.getWorld());
if(tile instanceof TileEntityInternalMultiblock)
{
@@ -448,7 +448,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
public void killInnerNode(Coord4D coord)
{
TileEntity tile = coord.safeTileGet(pointer.getWorld());
TileEntity tile = coord.getTileEntity(pointer.getWorld());
if(tile instanceof TileEntityInternalMultiblock)
{
@@ -469,12 +469,12 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
{
if(!structureFound.locations.contains(coord))
{
System.out.println("No contain " + coord + " " + coord.safeTileGet(pointer.getWorld()));
System.out.println("No contain " + coord + " " + coord.getTileEntity(pointer.getWorld()));
System.out.println(coord.getBlockState(pointer.getWorld()).getBlock());
for(Coord4D newCoord : iteratedNodes)
{
TileEntity tile = newCoord.safeTileGet(pointer.getWorld());
TileEntity tile = newCoord.getTileEntity(pointer.getWorld());
if(tile instanceof TileEntityMultiblock)
{
@@ -500,7 +500,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
for(Coord4D obj : structureFound.locations)
{
TileEntity tileEntity = obj.safeTileGet(pointer.getWorld());
TileEntity tileEntity = obj.getTileEntity(pointer.getWorld());
if(tileEntity instanceof TileEntityMultiblock && ((TileEntityMultiblock)tileEntity).cachedID != null)
{
@@ -548,7 +548,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
for(Coord4D obj : structureFound.locations)
{
TileEntity tileEntity = obj.safeTileGet(pointer.getWorld());
TileEntity tileEntity = obj.getTileEntity(pointer.getWorld());
if(tileEntity instanceof TileEntityMultiblock)
{
@@ -576,7 +576,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
int killed = 0;
for(Coord4D coord : iteratedNodes)
{
TileEntity tile = coord.safeTileGet(pointer.getWorld());
TileEntity tile = coord.getTileEntity(pointer.getWorld());
if(tile instanceof TileEntityMultiblock)
{
@@ -38,7 +38,7 @@ public class MultipartTransmitter<A, N extends DynamicNetwork<A,N>> extends Tran
@Override
public Coord4D coord()
{
return new Coord4D(getPart().getPos(), getPart().getWorld().provider.getDimensionId());
return new Coord4D(getPart().getPos(), getPart().getWorld());
}
@Override
@@ -143,7 +143,7 @@ public class PartDiversionTransporter extends PartLogisticalTransporter
notifyPartUpdate();
notifyTileChange();
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.configurator.toggleDiverter") + ": " + EnumColor.RED + description));
Coord4D coord = new Coord4D(getPos(), getWorld().provider.getDimensionId());
Coord4D coord = new Coord4D(getPos(), getWorld());
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(coord, getNetworkedData(new ArrayList<Object>())), new Range4D(coord));
return true;
@@ -215,7 +215,7 @@ public class PartGlowPanel extends Multipart implements IOccludingPart//, JIconH
public boolean canStay()
{
Coord4D adj = new Coord4D(getPos().offset(side), getWorld().provider.getDimensionId());
return getWorld().isSideSolid(adj, side.getOpposite()) || (getContainer().getPartInSlot(PartSlot.getFaceSlot(side)) instanceof IFaceMicroblock && ((IFaceMicroblock)getContainer().getPartInSlot(PartSlot.getFaceSlot(side))).isFaceHollow());
Coord4D adj = new Coord4D(getPos().offset(side), getWorld());
return getWorld().isSideSolid(adj.getPos(), side.getOpposite()) || (getContainer().getPartInSlot(PartSlot.getFaceSlot(side)) instanceof IFaceMicroblock && ((IFaceMicroblock)getContainer().getPartInSlot(PartSlot.getFaceSlot(side))).isFaceHollow());
}
}
@@ -35,10 +35,10 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumFacing;
//import net.minecraft.util.IIcon;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.Constants.NBT;
import net.minecraft.util.EnumFacing;
/*
import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput;
@@ -388,8 +388,8 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
TransporterUtils.incrementColor(getTransmitter());
refreshConnections();
notifyTileChange();
PathfinderCache.onChanged(new Coord4D(getPos(), getWorld().provider.getDimensionId()));
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(new Coord4D(getPos(), getWorld().provider.getDimensionId()), getNetworkedData(new ArrayList())), new Range4D(new Coord4D(getPos(), getWorld().provider.getDimensionId())));
PathfinderCache.onChanged(new Coord4D(getPos(), getWorld()));
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(new Coord4D(getPos(), getWorld()), getNetworkedData(new ArrayList())), new Range4D(new Coord4D(getPos(), getWorld())));
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.configurator.toggleColor") + ": " + (getTransmitter().getColor() != null ? getTransmitter().getColor().getName() : EnumColor.BLACK + LangUtils.localize("gui.none"))));
return true;
@@ -6,36 +6,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.IConfigurable;
import mekanism.api.MekanismConfig.client;
import mekanism.api.transmitters.IBlockableConnection;
import mekanism.api.transmitters.ITransmitter;
import mekanism.api.transmitters.TransmissionType;
import mekanism.common.MekanismItems;
import mekanism.common.Tier;
import mekanism.common.base.ITileNetwork;
import mekanism.common.capabilities.Capabilities;
import mekanism.common.multipart.TransmitterType.Size;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumFacing;
//import net.minecraft.util.IIcon;
import net.minecraft.util.ITickable;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
/*import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput;
import codechicken.lib.raytracer.ExtendedMOP;
@@ -60,6 +30,35 @@ import mcmultipart.multipart.Multipart;
import mcmultipart.raytrace.PartMOP;
import mcmultipart.raytrace.RayTraceUtils;
import mcmultipart.raytrace.RayTraceUtils.RayTraceResultPart;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.IConfigurable;
import mekanism.api.MekanismConfig.client;
import mekanism.api.transmitters.IBlockableConnection;
import mekanism.api.transmitters.ITransmitter;
import mekanism.api.transmitters.TransmissionType;
import mekanism.common.MekanismItems;
import mekanism.common.Tier;
import mekanism.common.base.ITileNetwork;
import mekanism.common.capabilities.Capabilities;
import mekanism.common.multipart.TransmitterType.Size;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumFacing;
//import net.minecraft.util.IIcon;
import net.minecraft.util.ITickable;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class PartSidedPipe extends Multipart implements IOccludingPart, /*ISlotOccludingPart, ISidedHollowConnect, JIconHitEffects, INeighborTileChange,*/ ITileNetwork, IBlockableConnection, IConfigurable, ITransmitter, ITickable
{
@@ -313,7 +312,7 @@ public abstract class PartSidedPipe extends Multipart implements IOccludingPart,
public boolean getPossibleTransmitterConnection(EnumFacing side)
{
if(handlesRedstone() && redstoneReactive && MekanismUtils.isGettingPowered(getWorld(), new Coord4D(getPos())))
if(handlesRedstone() && redstoneReactive && MekanismUtils.isGettingPowered(getWorld(), new Coord4D(getPos(), getWorld())))
{
return false;
}
@@ -346,7 +345,7 @@ public abstract class PartSidedPipe extends Multipart implements IOccludingPart,
{
if(canConnectMutual(side))
{
Coord4D coord = new Coord4D(getPos()).offset(side);
Coord4D coord = new Coord4D(getPos(), getWorld()).offset(side);
if(!getWorld().isRemote && !coord.exists(getWorld()))
{
@@ -625,7 +624,7 @@ public abstract class PartSidedPipe extends Multipart implements IOccludingPart,
{
if(redstoneReactive)
{
redstonePowered = MekanismUtils.isGettingPowered(getWorld(), new Coord4D(getPos()));
redstonePowered = MekanismUtils.isGettingPowered(getWorld(), new Coord4D(getPos(), getWorld()));
}
else {
redstonePowered = false;
@@ -650,7 +649,7 @@ public abstract class PartSidedPipe extends Multipart implements IOccludingPart,
{
if(redstoneReactive)
{
redstonePowered = MekanismUtils.isGettingPowered(getWorld(), new Coord4D(getPos()));
redstonePowered = MekanismUtils.isGettingPowered(getWorld(), new Coord4D(getPos(), getWorld()));
}
else {
redstonePowered = false;
@@ -879,6 +878,6 @@ public abstract class PartSidedPipe extends Multipart implements IOccludingPart,
public void notifyTileChange()
{
MekanismUtils.notifyLoadedNeighborsOfTileChange(getWorld(), new Coord4D(getPos()));
MekanismUtils.notifyLoadedNeighborsOfTileChange(getWorld(), new Coord4D(getPos(), getWorld()));
}
}
@@ -135,7 +135,7 @@ public abstract class PartTransmitter<A, N extends DynamicNetwork<A, N>> extends
{
if(o1 instanceof IGridTransmitter && o2 instanceof IGridTransmitter)
{
Coord4D thisCoord = new Coord4D(getPos(), getWorld().provider.getDimensionId());
Coord4D thisCoord = new Coord4D(getPos(), getWorld());
Coord4D o1Coord = ((IGridTransmitter)o1).coord();
Coord4D o2Coord = ((IGridTransmitter)o2).coord();
@@ -29,7 +29,7 @@ public class PacketDataRequest implements IMessageHandler<DataRequestMessage, IM
{
EntityPlayer player = PacketHandler.getPlayer(context);
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(message.coord4D.dimensionId);
TileEntity tileEntity = message.coord4D.safeTileGet(worldServer);
TileEntity tileEntity = message.coord4D.getTileEntity(worldServer);
if(worldServer != null && tileEntity instanceof ITileNetwork)
{
@@ -56,11 +56,11 @@ public class PacketDigitalMinerGui implements IMessageHandler<DigitalMinerGuiMes
try {
if(message.packetType == MinerGuiPacket.CLIENT)
{
FMLCommonHandler.instance().showGuiScreen(DigitalMinerGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D, -1));
FMLCommonHandler.instance().showGuiScreen(DigitalMinerGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D.getPos(), -1));
}
else if(message.packetType == MinerGuiPacket.CLIENT_INDEX)
{
FMLCommonHandler.instance().showGuiScreen(DigitalMinerGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D, message.index));
FMLCommonHandler.instance().showGuiScreen(DigitalMinerGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D.getPos(), message.index));
}
player.openContainer.windowId = message.windowId;
@@ -50,11 +50,11 @@ public class PacketLogisticalSorterGui implements IMessageHandler<LogisticalSort
try {
if(message.packetType == SorterGuiPacket.CLIENT)
{
FMLCommonHandler.instance().showGuiScreen(LogisticalSorterGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D, -1));
FMLCommonHandler.instance().showGuiScreen(LogisticalSorterGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D.getPos(), -1));
}
else if(message.packetType == SorterGuiPacket.CLIENT_INDEX)
{
FMLCommonHandler.instance().showGuiScreen(LogisticalSorterGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D, message.index));
FMLCommonHandler.instance().showGuiScreen(LogisticalSorterGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D.getPos(), message.index));
}
player.openContainer.windowId = message.windowId;
@@ -50,11 +50,11 @@ public class PacketOredictionificatorGui implements IMessageHandler<Oredictionif
try {
if(message.packetType == OredictionificatorGuiPacket.CLIENT)
{
FMLCommonHandler.instance().showGuiScreen(OredictionificatorGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D, -1));
FMLCommonHandler.instance().showGuiScreen(OredictionificatorGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D.getPos(), -1));
}
else if(message.packetType == OredictionificatorGuiPacket.CLIENT_INDEX)
{
FMLCommonHandler.instance().showGuiScreen(OredictionificatorGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D, message.index));
FMLCommonHandler.instance().showGuiScreen(OredictionificatorGuiMessage.getGui(message.packetType, message.guiType, player, player.worldObj, message.coord4D.getPos(), message.index));
}
player.openContainer.windowId = message.windowId;
@@ -49,7 +49,7 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
else if(message.packetType == PersonalChestPacketType.CLIENT_OPEN)
{
try {
Mekanism.proxy.openPersonalChest(player, message.guiType, message.windowId, message.isBlock, message.coord4D == null ? BlockPos.ORIGIN : message.coord4D);
Mekanism.proxy.openPersonalChest(player, message.guiType, message.windowId, message.isBlock, message.coord4D == null ? BlockPos.ORIGIN : message.coord4D.getPos());
} catch(Exception e) {
Mekanism.logger.error("Error while handling electric chest open packet.");
e.printStackTrace();
@@ -24,8 +24,8 @@ public class PacketPortalFX implements IMessageHandler<PortalFXMessage, IMessage
for(int i = 0; i < 50; i++)
{
player.worldObj.spawnParticle(EnumParticleTypes.PORTAL, message.coord4D.getX() + random.nextFloat(), message.coord4D.getY() + random.nextFloat(), message.coord4D.getZ() + random.nextFloat(), 0.0F, 0.0F, 0.0F);
player.worldObj.spawnParticle(EnumParticleTypes.PORTAL, message.coord4D.getX() + random.nextFloat(), message.coord4D.getY() + 1 + random.nextFloat(), message.coord4D.getZ() + random.nextFloat(), 0.0F, 0.0F, 0.0F);
player.worldObj.spawnParticle(EnumParticleTypes.PORTAL, message.coord4D.xCoord + random.nextFloat(), message.coord4D.yCoord + random.nextFloat(), message.coord4D.zCoord + random.nextFloat(), 0.0F, 0.0F, 0.0F);
player.worldObj.spawnParticle(EnumParticleTypes.PORTAL, message.coord4D.xCoord + random.nextFloat(), message.coord4D.yCoord + 1 + random.nextFloat(), message.coord4D.zCoord + random.nextFloat(), 0.0F, 0.0F, 0.0F);
}
return null;
@@ -87,7 +87,7 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
Mekanism.packetHandler.sendTo(new SimpleGuiMessage(obj, handler, id, window), playerMP);
playerMP.openContainer = handlers.get(handler).getServerGui(id, playerMP, world, obj);
playerMP.openContainer = handlers.get(handler).getServerGui(id, playerMP, world, obj.getPos());
playerMP.openContainer.windowId = window;
playerMP.openContainer.onCraftGuiOpened(playerMP);
}
@@ -95,7 +95,7 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
@SideOnly(Side.CLIENT)
public static GuiScreen getGui(int handler, int id, EntityPlayer player, World world, Coord4D obj)
{
return (GuiScreen)handlers.get(handler).getClientGui(id, player, world, obj);
return (GuiScreen)handlers.get(handler).getClientGui(id, player, world, obj.getPos());
}
@Override
@@ -64,7 +64,7 @@ public class PacketTileEntity implements IMessageHandler<TileEntityMessage, IMes
if(server != null)
{
World world = server.worldServerForDimension(coord4D.dimensionId);
PacketHandler.log("Sending TileEntity packet from coordinate " + coord4D + " (" + coord4D.safeTileGet(world) + ")");
PacketHandler.log("Sending TileEntity packet from coordinate " + coord4D + " (" + coord4D.getTileEntity(world) + ")");
}
PacketHandler.encode(new Object[] {parameters}, dataStream);
@@ -384,7 +384,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
return null;
}
TileEntity tile = new Coord4D(mainPos, worldObj.provider.getDimensionId()).getTileEntity(worldObj);
TileEntity tile = new Coord4D(mainPos, worldObj).getTileEntity(worldObj);
if(!(tile instanceof IAdvancedBoundingBlock))
{
@@ -392,7 +392,7 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
return null;
}
return (IAdvancedBoundingBlock)new Coord4D(mainPos, worldObj.provider.getDimensionId()).getTileEntity(worldObj);
return (IAdvancedBoundingBlock)new Coord4D(mainPos, worldObj).getTileEntity(worldObj);
}
@Override
@@ -32,7 +32,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl
if(!worldObj.isRemote)
{
if(structure != null && structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.getY())
if(structure != null && structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.yCoord)
{
if(structure.steamStored != null && structure.steamStored.amount > 0)
{
@@ -63,7 +63,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl
{
if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure))
{
if(structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.getY())
if(structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.yCoord)
{
return new FluidTankInfo[] {steamTank.getInfo()};
}
@@ -78,7 +78,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl
@Override
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
{
if(structure != null && structure.upperRenderLocation != null && getPos().getY() < structure.upperRenderLocation.getY())
if(structure != null && structure.upperRenderLocation != null && getPos().getY() < structure.upperRenderLocation.yCoord)
{
return waterTank.fill(resource, doFill);
}
@@ -89,7 +89,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl
@Override
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
{
if(structure != null && structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.getY())
if(structure != null && structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.yCoord)
{
if(structure.steamStored != null)
{
@@ -106,7 +106,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl
@Override
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
{
if(structure != null && structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.getY())
if(structure != null && structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.yCoord)
{
return steamTank.drain(maxDrain, doDrain);
}
@@ -119,7 +119,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl
{
if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure))
{
return structure.upperRenderLocation != null && getPos().getY() < structure.upperRenderLocation.getY();
return structure.upperRenderLocation != null && getPos().getY() < structure.upperRenderLocation.yCoord;
}
return false;
@@ -130,7 +130,7 @@ public class TileEntityBoilerValve extends TileEntityBoilerCasing implements IFl
{
if((!worldObj.isRemote && structure != null) || (worldObj.isRemote && clientHasStructure))
{
return structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.getY();
return structure.upperRenderLocation != null && getPos().getY() >= structure.upperRenderLocation.yCoord;
}
return false;
@@ -264,7 +264,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
toRemove.add(chunk);
}
worldObj.playAuxSFXAtEntity(null, 2001, coord, Block.getIdFromBlock(block) + (meta << 12));
worldObj.playAuxSFXAtEntity(null, 2001, coord.getPos(), Block.getIdFromBlock(block) + (meta << 12));
missingStack = null;
}
@@ -361,8 +361,8 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
IBlockState state = obj.getBlockState(worldObj);
Block block = state.getBlock();
EntityPlayer dummy = Mekanism.proxy.getDummyPlayer((WorldServer)worldObj, obj.getX(), obj.getY(), obj.getZ()).get();
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(worldObj, obj, state, dummy);
EntityPlayer dummy = Mekanism.proxy.getDummyPlayer((WorldServer)worldObj, obj.xCoord, obj.yCoord, obj.zCoord).get();
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(worldObj, obj.getPos(), state, dummy);
MinecraftForge.EVENT_BUS.post(event);
if(!event.isCanceled())
@@ -371,13 +371,13 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
if(stack != null)
{
worldObj.setBlockState(obj, Block.getBlockFromItem(stack.getItem()).getStateFromMeta(stack.getItemDamage()), 3);
worldObj.setBlockState(obj.getPos(), Block.getBlockFromItem(stack.getItem()).getStateFromMeta(stack.getItemDamage()), 3);
IBlockState s = obj.getBlockState(worldObj);
if(s.getBlock() instanceof BlockBush && !((BlockBush)s.getBlock()).canBlockStay(worldObj, obj, s))
if(s.getBlock() instanceof BlockBush && !((BlockBush)s.getBlock()).canBlockStay(worldObj, obj.getPos(), s))
{
s.getBlock().dropBlockAsItem(worldObj, obj, s, 1);
worldObj.setBlockToAir(obj);
s.getBlock().dropBlockAsItem(worldObj, obj.getPos(), s, 1);
worldObj.setBlockToAir(obj.getPos());
}
return true;
@@ -387,7 +387,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
if(filter == null || (filter.replaceStack == null || !filter.requireStack))
{
worldObj.setBlockToAir(obj);
worldObj.setBlockToAir(obj.getPos());
return true;
}
@@ -529,7 +529,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
public TileEntity getPullInv()
{
return Coord4D.get(this).add(0, 2, 0).getTileEntity(worldObj);
return Coord4D.get(this).translate(0, 2, 0).getTileEntity(worldObj);
}
public TileEntity getEjectInv()
@@ -1030,9 +1030,9 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
int diameter = getDiameter();
Coord4D start = getStartingCoord();
int x = start.getX()+index%diameter;
int y = start.getY()+(index/diameter/diameter);
int z = start.getZ()+(index/diameter)%diameter;
int x = start.xCoord+index%diameter;
int y = start.yCoord+(index/diameter/diameter);
int z = start.zCoord+(index/diameter)%diameter;
return new Coord4D(x, y, z, worldObj.provider.getDimensionId());
}
@@ -184,7 +184,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
if(shouldTake(fluid, wrapper))
{
worldObj.setBlockToAir(wrapper);
worldObj.setBlockToAir(wrapper.getPos());
}
}
@@ -207,7 +207,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
if(shouldTake(fluid, wrapper))
{
worldObj.setBlockToAir(wrapper);
worldObj.setBlockToAir(wrapper.getPos());
}
}
@@ -233,7 +233,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
if(shouldTake(fluid, side))
{
worldObj.setBlockToAir(side);
worldObj.setBlockToAir(side.getPos());
}
}
@@ -134,7 +134,7 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
{
if(fluidTank.getFluid().getFluid().canBePlacedInWorld())
{
worldObj.setBlockState(below, MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()).getDefaultState(), 3);
worldObj.setBlockState(below.getPos(), MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()).getDefaultState(), 3);
setEnergy(getEnergy() - energyPerTick);
fluidTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
@@ -184,7 +184,7 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
{
if(canReplace(coord, true, false))
{
worldObj.setBlockState(coord, MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()).getDefaultState(), 3);
worldObj.setBlockState(coord.getPos(), MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()).getDefaultState(), 3);
fluidTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
}
@@ -231,7 +231,7 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
return isPathfinding;
}
return coord.getBlock(worldObj).isReplaceable(worldObj, coord);
return coord.getBlock(worldObj).isReplaceable(worldObj, coord.getPos());
}
@Override
@@ -48,7 +48,7 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc
if(isActive)
{
MovingObjectPosition mop = LaserManager.fireLaserClient(this, facing, usage.laserUsage, worldObj);
Coord4D hitCoord = mop == null ? null : new Coord4D(mop);
Coord4D hitCoord = mop == null ? null : new Coord4D(mop, worldObj);
if(hitCoord == null || !hitCoord.equals(digging))
{
@@ -60,7 +60,7 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc
{
Block blockHit = hitCoord.getBlock(worldObj);
TileEntity tileHit = hitCoord.getTileEntity(worldObj);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos());
if(!(hardness < 0 || (tileHit instanceof ILaserReceptor && !((ILaserReceptor)tileHit).canLasersDig())))
{
@@ -80,7 +80,7 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc
setActive(true);
LaserInfo info = LaserManager.fireLaser(this, facing, usage.laserUsage, worldObj);
Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos);
Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos, worldObj);
if(hitCoord == null || !hitCoord.equals(digging))
{
@@ -92,7 +92,7 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc
{
Block blockHit = hitCoord.getBlock(worldObj);
TileEntity tileHit = hitCoord.getTileEntity(worldObj);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos());
if(!(hardness < 0 || (tileHit instanceof ILaserReceptor && !((ILaserReceptor)tileHit).canLasersDig())))
{
@@ -76,7 +76,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
if(on)
{
MovingObjectPosition mop = LaserManager.fireLaserClient(this, facing, lastFired, worldObj);
Coord4D hitCoord = mop == null ? null : new Coord4D(mop);
Coord4D hitCoord = mop == null ? null : new Coord4D(mop, worldObj);
if(hitCoord == null || !hitCoord.equals(digging))
{
@@ -88,7 +88,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
{
Block blockHit = hitCoord.getBlock(worldObj);
TileEntity tileHit = hitCoord.getTileEntity(worldObj);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos());
if(!(hardness < 0 || (tileHit instanceof ILaserReceptor && !((ILaserReceptor)tileHit).canLasersDig())))
{
@@ -128,7 +128,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
}
LaserInfo info = LaserManager.fireLaser(this, facing, firing, worldObj);
Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos);
Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos, worldObj);
if(hitCoord == null || !hitCoord.equals(digging))
{
@@ -140,7 +140,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
{
Block blockHit = hitCoord.getBlock(worldObj);
TileEntity tileHit = hitCoord.getTileEntity(worldObj);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos());
if(!(hardness < 0 || (tileHit instanceof ILaserReceptor && !((ILaserReceptor)tileHit).canLasersDig())))
{
@@ -64,7 +64,7 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme
if(on)
{
MovingObjectPosition mop = LaserManager.fireLaserClient(this, facing, lastFired, worldObj);
Coord4D hitCoord = mop == null ? null : new Coord4D(mop);
Coord4D hitCoord = mop == null ? null : new Coord4D(mop, worldObj);
if(hitCoord == null || !hitCoord.equals(digging))
{
@@ -76,7 +76,7 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme
{
Block blockHit = hitCoord.getBlock(worldObj);
TileEntity tileHit = hitCoord.getTileEntity(worldObj);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos());
if(!(hardness < 0 || (tileHit instanceof ILaserReceptor && !((ILaserReceptor)tileHit).canLasersDig())))
{
diggingProgress += lastFired;
@@ -103,7 +103,7 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme
}
LaserInfo info = LaserManager.fireLaser(this, facing, firing, worldObj);
Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos);
Coord4D hitCoord = info.movingPos == null ? null : new Coord4D(info.movingPos, worldObj);
if(hitCoord == null || !hitCoord.equals(digging))
{
@@ -115,7 +115,7 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme
{
Block blockHit = hitCoord.getBlock(worldObj);
TileEntity tileHit = hitCoord.getTileEntity(worldObj);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord);
float hardness = blockHit.getBlockHardness(worldObj, hitCoord.getPos());
if(!(hardness < 0 || (tileHit instanceof ILaserReceptor && !((ILaserReceptor)tileHit).canLasersDig())))
{
diggingProgress += firing;
@@ -118,11 +118,11 @@ public abstract class TileEntityMultiblock<T extends SynchronizedData<T>> extend
for(EnumFacing side : EnumFacing.VALUES)
{
Coord4D obj = Coord4D.get(this).offset(side);
TileEntity tile = obj.safeTileGet(worldObj);
TileEntity tile = obj.getTileEntity(worldObj);
if(!obj.isAirBlock(worldObj) && (tile == null || tile.getClass() != getClass()))
{
obj.getBlock(worldObj).onNeighborChange(worldObj, obj, getPos());
obj.getBlock(worldObj).onNeighborChange(worldObj, obj.getPos(), getPos());
}
}
@@ -179,7 +179,7 @@ public abstract class TileEntityMultiblock<T extends SynchronizedData<T>> extend
{
for(Coord4D obj : getSynchronizedData().locations)
{
TileEntityMultiblock<T> tileEntity = (TileEntityMultiblock<T>)obj.safeTileGet(worldObj);
TileEntityMultiblock<T> tileEntity = (TileEntityMultiblock<T>)obj.getTileEntity(worldObj);
if(tileEntity != null && tileEntity.isRendering)
{
@@ -268,7 +268,7 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
@Override
public void onPlace()
{
MekanismUtils.makeBoundingBlock(worldObj, Coord4D.get(this).offset(EnumFacing.UP), Coord4D.get(this));
MekanismUtils.makeBoundingBlock(worldObj, Coord4D.get(this).offset(EnumFacing.UP).getPos(), Coord4D.get(this));
}
@Override
@@ -19,7 +19,7 @@ public class TileEntityStructuralGlass extends TileEntity implements IStructural
{
if(master != null)
{
TileEntity masterTile = master.safeTileGet(worldObj);
TileEntity masterTile = master.getTileEntity(worldObj);
if(masterTile instanceof IMultiblock)
{
@@ -38,7 +38,7 @@ public class TileEntityStructuralGlass extends TileEntity implements IStructural
{
if(master != null)
{
TileEntity masterTile = master.safeTileGet(worldObj);
TileEntity masterTile = master.getTileEntity(worldObj);
if(masterTile instanceof IMultiblock)
{
@@ -88,7 +88,7 @@ public class TileEntityStructuralGlass extends TileEntity implements IStructural
for(EnumFacing side : EnumFacing.VALUES)
{
Coord4D coord = pos.offset(side);
TileEntity tile = coord.safeTileGet(worldObj);
TileEntity tile = coord.getTileEntity(worldObj);
if(!iterated.contains(coord))
{
@@ -4,7 +4,6 @@ import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@@ -17,7 +16,6 @@ import mekanism.common.MekanismBlocks;
import mekanism.common.PacketHandler;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.block.states.BlockStateMachine;
import mekanism.common.block.states.BlockStateMachine.MachineType;
import mekanism.common.chunkloading.IChunkLoader;
import mekanism.common.frequency.Frequency;
import mekanism.common.frequency.FrequencyManager;
@@ -30,7 +28,6 @@ import mekanism.common.security.ISecurityTile;
import mekanism.common.tile.component.TileComponentSecurity;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
@@ -44,12 +41,12 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -414,13 +411,13 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
if(player.isEntityAlive())
{
newWorld.spawnEntityInWorld(player);
player.setLocationAndAngles(coord.getX()+0.5, coord.getY()+1, coord.getZ()+0.5, player.rotationYaw, player.rotationPitch);
player.setLocationAndAngles(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, player.rotationYaw, player.rotationPitch);
newWorld.updateEntityWithOptionalForce(player, false);
player.setWorld(newWorld);
}
player.mcServer.getConfigurationManager().preparePlayer(player, oldWorld);
player.playerNetServerHandler.setPlayerLocation(coord.getX()+0.5, coord.getY()+1, coord.getZ()+0.5, player.rotationYaw, player.rotationPitch);
player.playerNetServerHandler.setPlayerLocation(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, player.rotationYaw, player.rotationPitch);
player.theItemInWorldManager.setWorld(newWorld);
player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, newWorld);
player.mcServer.getConfigurationManager().syncPlayerInventory(player);
@@ -435,7 +432,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, id, coord.dimensionId);
}
else {
player.playerNetServerHandler.setPlayerLocation(coord.getX()+0.5, coord.getY()+1, coord.getZ()+0.5, player.rotationYaw, player.rotationPitch);
player.playerNetServerHandler.setPlayerLocation(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, player.rotationYaw, player.rotationPitch);
}
}
@@ -449,7 +446,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
entity.isDead = false;
world.spawnEntityInWorld(entity);
entity.setLocationAndAngles(coord.getX()+0.5, coord.getY()+1, coord.getZ()+0.5, entity.rotationYaw, entity.rotationPitch);
entity.setLocationAndAngles(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, entity.rotationYaw, entity.rotationPitch);
world.updateEntityWithOptionalForce(entity, false);
entity.setWorld(world);
world.resetUpdateEntityTick();
@@ -466,7 +463,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
entity.isDead = true;
}
else {
entity.setLocationAndAngles(coord.getX()+0.5, coord.getY()+1, coord.getZ()+0.5, entity.rotationYaw, entity.rotationPitch);
entity.setLocationAndAngles(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, entity.rotationYaw, entity.rotationPitch);
Mekanism.packetHandler.sendToReceivers(new EntityMoveMessage(entity), new Range4D(new Coord4D(entity)));
}
}
@@ -533,7 +530,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
energyCost+=10000;
}
int distance = (int)entity.getDistance(coords.getX(), coords.getY(), coords.getZ());
int distance = (int)entity.getDistance(coords.xCoord, coords.yCoord, coords.zCoord);
energyCost+=(distance*10);
return energyCost;
@@ -349,10 +349,10 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
startPoint = startPoint.offset(EnumFacing.UP);
}
Coord4D test = startPoint.offset(EnumFacing.DOWN).offset(right, 2);
Coord4D test = startPoint.offset(EnumFacing.DOWN).getFromSide(right, 2);
isLeftOnFace = test.getTileEntity(worldObj) instanceof TileEntityThermalEvaporationBlock;
startPoint = startPoint.offset(left, isLeftOnFace ? 1 : 2);
startPoint = startPoint.getFromSide(left, isLeftOnFace ? 1 : 2);
if(!scanTopLayer(startPoint))
{
@@ -390,7 +390,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
{
for(int z = 0; z < 4; z++)
{
Coord4D pointer = current.offset(right, x).offset(back, z);
Coord4D pointer = current.getFromSide(right, x).getFromSide(back, z);
TileEntity pointerTile = pointer.getTileEntity(worldObj);
int corner = getCorner(x, z);
@@ -465,7 +465,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
{
for(int z = 0; z < 4; z++)
{
Coord4D pointer = current.offset(right, x).offset(back, z);
Coord4D pointer = current.getFromSide(right, x).getFromSide(back, z);
TileEntity pointerTile = pointer.getTileEntity(worldObj);
if((x == 1 || x == 2) && (z == 1 || z == 2))
@@ -557,7 +557,7 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
Coord4D startPoint = Coord4D.get(this).offset(right);
startPoint = isLeftOnFace ? startPoint.offset(right) : startPoint;
startPoint = startPoint.offset(right.getOpposite()).offset(MekanismUtils.getBack(facing)).add(0, -(height-2), 0);
startPoint = startPoint.offset(right.getOpposite()).offset(MekanismUtils.getBack(facing)).translate(0, -(height-2), 0);
return startPoint;
}
@@ -28,7 +28,7 @@ public class TileEntityThermalEvaporationValve extends TileEntityThermalEvaporat
if(!obj.isAirBlock(worldObj) && !(obj.getTileEntity(worldObj) instanceof TileEntityThermalEvaporationBlock))
{
obj.getBlock(worldObj).onNeighborChange(worldObj, obj, getPos());
obj.getBlock(worldObj).onNeighborChange(worldObj, obj.getPos(), getPos());
}
}
}
@@ -723,13 +723,13 @@ public final class MekanismUtils
{
IBlockState blockState = sideCoord.getBlockState(world);
Block block = blockState.getBlock();
boolean weakPower = block.shouldCheckWeakPower(world, coord, side);
boolean weakPower = block.shouldCheckWeakPower(world, coord.getPos(), side);
if(weakPower && isDirectlyGettingPowered(world, sideCoord))
{
return true;
}
else if(!weakPower && block.getWeakPower(world, sideCoord, blockState, side) > 0)
else if(!weakPower && block.getWeakPower(world, sideCoord.getPos(), blockState, side) > 0)
{
return true;
}
@@ -753,7 +753,7 @@ public final class MekanismUtils
if(sideCoord.exists(world))
{
if(world.getRedstonePower(coord, side) > 0)
if(world.getRedstonePower(coord.getPos(), side) > 0)
{
return true;
}
@@ -777,9 +777,9 @@ public final class MekanismUtils
if(offset.exists(world))
{
Block block1 = offset.getBlock(world);
block1.onNeighborChange(world, offset, coord);
block1.onNeighborChange(world, offset.getPos(), coord.getPos());
if(block1.isNormalCube(world, offset))
if(block1.isNormalCube(world, offset.getPos()))
{
offset = offset.offset(dir);
@@ -787,9 +787,9 @@ public final class MekanismUtils
{
block1 = offset.getBlock(world);
if(block1.getWeakChanges(world, offset))
if(block1.getWeakChanges(world, offset.getPos()))
{
block1.onNeighborChange(world, offset, coord);
block1.onNeighborChange(world, offset.getPos(), coord.getPos());
}
}
}
@@ -809,7 +809,7 @@ public final class MekanismUtils
if(!world.isRemote)
{
((TileEntityBoundingBlock)world.getTileEntity(boundingLocation)).setMainLocation(orig);
((TileEntityBoundingBlock)world.getTileEntity(boundingLocation)).setMainLocation(orig.getPos());
}
}
@@ -825,7 +825,7 @@ public final class MekanismUtils
if(!world.isRemote)
{
((TileEntityAdvancedBoundingBlock)world.getTileEntity(boundingLocation)).setMainLocation(orig);
((TileEntityAdvancedBoundingBlock)world.getTileEntity(boundingLocation)).setMainLocation(orig.getPos());
}
}
@@ -905,7 +905,7 @@ public final class MekanismUtils
if(state.getProperties().containsKey(BlockFluidBase.LEVEL) && state.getValue(BlockFluidBase.LEVEL) == 0)
{
return fluid.drain(world, pos, false);
return fluid.drain(world, pos.getPos(), false);
}
}
@@ -1233,7 +1233,7 @@ public final class MekanismUtils
*/
public static String getCoordDisplay(Coord4D obj)
{
return "[" + obj.getX() + ", " + obj.getY() + ", " + obj.getZ() + "]";
return "[" + obj.xCoord + ", " + obj.yCoord + ", " + obj.zCoord + "]";
}
@SideOnly(Side.CLIENT)
@@ -21,20 +21,20 @@ public final class MinerUtils
IBlockState state = obj.getBlockState(world);
Block block = state.getBlock();
if(block == null || block.isAir(world, obj))
if(block == null || block.isAir(world, obj.getPos()))
{
return new ArrayList<ItemStack>();
}
if(!silk)
{
return block.getDrops(world, obj, state, 0);
return block.getDrops(world, obj.getPos(), state, 0);
}
else {
List<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(block, 1, block.getMetaFromState(state)));
if(specialSilkIDs.contains(block) || (block.getDrops(world, obj, state, 0) != null && block.getDrops(world, obj, state, 0).size() > 0))
if(specialSilkIDs.contains(block) || (block.getDrops(world, obj.getPos(), state, 0) != null && block.getDrops(world, obj.getPos(), state, 0).size() > 0))
{
return ret;
}
@@ -211,7 +211,7 @@ public final class TransporterUtils
TransporterManager.remove(stack);
EntityItem entityItem = new EntityItem(tileEntity.world(), tileEntity.coord().getX() + pos[0], tileEntity.coord().getY() + pos[1], tileEntity.coord().getZ() + pos[2], stack.itemStack);
EntityItem entityItem = new EntityItem(tileEntity.world(), tileEntity.coord().xCoord + pos[0], tileEntity.coord().yCoord + pos[1], tileEntity.coord().zCoord + pos[2], stack.itemStack);
entityItem.motionX = 0;
entityItem.motionY = 0;
@@ -232,7 +232,7 @@ public final class TransporterUtils
itemFix = 0.1F;
}
return new float[] {0.5F + offset.getX()*progress, 0.5F + offset.getY()*progress - itemFix, 0.5F + offset.getZ()*progress};
return new float[] {0.5F + offset.xCoord*progress, 0.5F + offset.yCoord*progress - itemFix, 0.5F + offset.zCoord*progress};
}
public static void incrementColor(ILogisticalTransporter tileEntity)