More work on logistical transporters, getting these logistics down!

This commit is contained in:
Aidan C. Brady committed 2013-10-21 20:54:28 -04:00
1 parent 4b82ab6cc1
commit b4e53a5c54
6 files changed
+244 -53

No files matched your search

+19
View File
@@ -1,5 +1,7 @@
package mekanism.api;
import java.util.ArrayList;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
@@ -7,6 +9,8 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import com.google.common.io.ByteArrayDataInput;
public class Object3D
{
public int xCoord;
@@ -46,7 +50,10 @@ public class Object3D
public TileEntity getTileEntity(IBlockAccess world)
{
if(!(world instanceof World && ((World)world).blockExists(xCoord, yCoord, zCoord)))
{
return null;
}
return world.getBlockTileEntity(xCoord, yCoord, zCoord);
}
@@ -58,6 +65,13 @@ public class Object3D
nbtTags.setInteger("dimensionId", dimensionId);
}
public void write(ArrayList data)
{
data.add(xCoord);
data.add(yCoord);
data.add(zCoord);
}
public Object3D translate(int x, int y, int z)
{
xCoord += x;
@@ -82,6 +96,11 @@ public class Object3D
return new Object3D(nbtTags.getInteger("x"), nbtTags.getInteger("y"), nbtTags.getInteger("z"), nbtTags.getInteger("dimensionId"));
}
public static Object3D read(ByteArrayDataInput dataStream)
{
return new Object3D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
public Object3D difference(Object3D other)
{
return new Object3D(xCoord-other.xCoord, yCoord-other.yCoord, zCoord-other.zCoord);