Another attempt at fixing saving

This commit is contained in:
Calclavia 2013-08-04 18:04:36 -04:00
parent 869c6c1861
commit 68b90336c8
3 changed files with 19 additions and 17 deletions

View file

@ -54,6 +54,11 @@ public class Vector3
this(entity.posX, entity.posY, entity.posZ); this(entity.posX, entity.posY, entity.posZ);
} }
public Vector3(ForgeDirection direction)
{
this(direction.offsetX, direction.offsetY, direction.offsetZ);
}
public Vector3 scale(double amount) public Vector3 scale(double amount)
{ {
return this.scale(new Vector3(amount)); return this.scale(new Vector3(amount));

View file

@ -39,12 +39,12 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
private ForgeDirection facing = ForgeDirection.UP; private ForgeDirection facing = ForgeDirection.UP;
public int pushDelay; private int pushDelay;
public float energyStored; private float energyStored;
public AxisAlignedBB operationBounds; private AxisAlignedBB operationBounds;
public AxisAlignedBB suckBounds; private AxisAlignedBB suckBounds;
/** /**
* true = suck, false = push * true = suck, false = push
@ -53,7 +53,7 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
private PathfinderEMContractor pathfinder; private PathfinderEMContractor pathfinder;
private Set<EntityItem> pathfindingTrackers = new HashSet<EntityItem>(); private Set<EntityItem> pathfindingTrackers = new HashSet<EntityItem>();
public TileEntityEMContractor linked; private TileEntityEMContractor linked;
/** Color of beam */ /** Color of beam */
private int dyeID = 13; private int dyeID = 13;
@ -70,7 +70,9 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
{ {
if (this.tempLinkVector.getTileEntity(this.worldObj) instanceof TileEntityEMContractor) if (this.tempLinkVector.getTileEntity(this.worldObj) instanceof TileEntityEMContractor)
{ {
this.linked = (TileEntityEMContractor) this.tempLinkVector.getTileEntity(this.worldObj); this.setLink((TileEntityEMContractor) this.tempLinkVector.getTileEntity(this.worldObj), true);
System.out.println("TEST"+this.linked);
} }
this.tempLinkVector = null; this.tempLinkVector = null;
@ -167,7 +169,7 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(this).translate(0.5), new Vector3(entityItem), TileEntityTesla.dyeColors[dyeID]); ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(this).translate(0.5), new Vector3(entityItem), TileEntityTesla.dyeColors[dyeID]);
} }
this.moveEntity(entityItem, this.getFacing(), new Vector3(this)); this.moveEntity(entityItem, this.getDirection(), new Vector3(this));
} }
} }
} }
@ -387,7 +389,7 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
setFacing(ForgeDirection.getOrientation(newOrdinal)); setFacing(ForgeDirection.getOrientation(newOrdinal));
} }
public ForgeDirection getFacing() public ForgeDirection getDirection()
{ {
return facing; return facing;
} }
@ -418,12 +420,7 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
this.suck = nbt.getBoolean("suck"); this.suck = nbt.getBoolean("suck");
this.energyStored = nbt.getFloat("energyStored"); this.energyStored = nbt.getFloat("energyStored");
this.dyeID = nbt.getInteger("dyeID"); this.dyeID = nbt.getInteger("dyeID");
int x = nbt.getInteger("link_x"); this.tempLinkVector = new Vector3(nbt.getInteger("link_x"), nbt.getInteger("link_y"), nbt.getInteger("link_z"));
int y = nbt.getInteger("link_y");
int z = nbt.getInteger("link_z");
this.tempLinkVector = new Vector3(x, y, z);
updateBounds(); updateBounds();
} }
@ -519,8 +516,8 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
if (this.linked != null) if (this.linked != null)
{ {
this.pathfinder = new PathfinderEMContractor(this.worldObj, new Vector3(this.linked)); this.pathfinder = new PathfinderEMContractor(this.worldObj, new Vector3(this.linked).translate(new Vector3(this.linked.getDirection())));
this.pathfinder.find(new Vector3(this)); this.pathfinder.find(new Vector3(this).translate(new Vector3(this.getDirection())));
} }
} }

View file

@ -24,7 +24,7 @@ public class RenderEMContractor extends TileEntitySpecialRenderer
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
switch (((TileEntityEMContractor) t).getFacing()) switch (((TileEntityEMContractor) t).getDirection())
{ {
case DOWN: case DOWN:
GL11.glRotatef(180, 0, 0, 1); GL11.glRotatef(180, 0, 0, 1);