v5.5.5 Beta #6

*Fixed Dynamic Tanks!
This commit is contained in:
Aidan Brady 2013-04-30 23:07:16 -04:00
parent bc1a52d06f
commit 174a7b09e8
2 changed files with 47 additions and 33 deletions

View file

@ -52,6 +52,15 @@ public class Object3D
nbtTags.setInteger("dimensionId", dimensionId); nbtTags.setInteger("dimensionId", dimensionId);
} }
public Object3D translate(int x, int y, int z)
{
xCoord += x;
yCoord += y;
zCoord += z;
return this;
}
public Object3D getFromSide(ForgeDirection side) public Object3D getFromSide(ForgeDirection side)
{ {
return new Object3D(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ, dimensionId); return new Object3D(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ, dimensionId);

View file

@ -44,8 +44,10 @@ public class TankUpdateProtocol
int origX = tile.xCoord, origY = tile.yCoord, origZ = tile.zCoord; int origX = tile.xCoord, origY = tile.yCoord, origZ = tile.zCoord;
boolean isCorner = true; boolean isCorner = true;
boolean isHollowPrism = true; boolean isHollow = true;
boolean tooBig = false; boolean tooBig = false;
boolean rightBlocks = true;
boolean rightFrame = true;
Set<Object3D> locations = new HashSet<Object3D>(); Set<Object3D> locations = new HashSet<Object3D>();
@ -147,34 +149,34 @@ public class TankUpdateProtocol
{ {
if(!isViableNode(origX+x, origY+y, origZ+z)) if(!isViableNode(origX+x, origY+y, origZ+z))
{ {
isHollowPrism = false; rightBlocks = false;
break; break;
} }
else if(isFrame(new Object3D(origX+x, origY+y, origZ+z), origX+xmin, origX+xmax, origY+ymin, origY+ymax, origZ+zmin, origZ+zmax) && !isValidFrame(origX+x, origY+y, origZ+z)) else if(isFrame(Object3D.get(tile).translate(x, y, z), origX+xmin, origX+xmax, origY+ymin, origY+ymax, origZ+zmin, origZ+zmax) && !isValidFrame(origX+x, origY+y, origZ+z))
{ {
isHollowPrism = false; rightFrame = false;
break; break;
} }
else { else {
locations.add(new Object3D(origX+x, origY+y, origZ+z)); locations.add(Object3D.get(tile).translate(x, y, z));
} }
} }
else { else {
if(!isAir(origX+x, origY+y, origZ+z)) if(!isAir(origX+x, origY+y, origZ+z))
{ {
isHollowPrism = false; isHollow = false;
break; break;
} }
volume++; volume++;
} }
} }
if(!isHollowPrism) if(!isHollow || !rightBlocks || !rightFrame)
{ {
break; break;
} }
} }
if(!isHollowPrism) if(!isHollow || !rightBlocks || !rightFrame)
{ {
break; break;
} }
@ -182,35 +184,38 @@ public class TankUpdateProtocol
} }
} }
if(!tooBig && isHollowPrism && isCorner && volume > 0 && volume <= 4096 && locations.size() >= 9) if(volume > 0 && volume <= 4096 && locations.size() >= 9)
{ {
SynchronizedTankData structure = new SynchronizedTankData(); if(!tooBig && rightBlocks && rightFrame && isHollow && isCorner)
structure.locations = locations;
structure.volLength = Math.abs(xmax-xmin)+1;
structure.volHeight = Math.abs(ymax-ymin)+1;
structure.volWidth = Math.abs(zmax-zmin)+1;
structure.volume = volume;
structure.renderLocation = new Object3D(origX+1, origY+1, origZ+1);
for(Object3D obj : structure.locations)
{ {
if(obj.getTileEntity(pointer.worldObj) instanceof TileEntityDynamicValve) SynchronizedTankData structure = new SynchronizedTankData();
structure.locations = locations;
structure.volLength = Math.abs(xmax-xmin)+1;
structure.volHeight = Math.abs(ymax-ymin)+1;
structure.volWidth = Math.abs(zmax-zmin)+1;
structure.volume = volume;
structure.renderLocation = Object3D.get(tile).translate(1, 1, 1);
for(Object3D obj : structure.locations)
{ {
ValveData data = new ValveData(); if(obj.getTileEntity(pointer.worldObj) instanceof TileEntityDynamicValve)
data.location = obj; {
data.side = getSide(obj, origX+xmin, origX+xmax, origY+ymin, origY+ymax, origZ+zmin, origZ+zmax); ValveData data = new ValveData();
data.location = obj;
structure.valves.add(data); data.side = getSide(obj, origX+xmin, origX+xmax, origY+ymin, origY+ymax, origZ+zmin, origZ+zmax);
structure.valves.add(data);
}
}
if(structure.locations.contains(Object3D.get(pointer)) && isCorrectCorner(Object3D.get(tile), origX+xmin, origY+ymin, origZ+zmin))
{
structureFound = structure;
return;
}
else {
pointerNotPartOf = true;
} }
}
if(structure.locations.contains(Object3D.get(pointer)) && isCorrectCorner(new Object3D(origX, origY, origZ), origX+xmin, origY+ymin, origZ+zmin))
{
structureFound = structure;
return;
}
else {
pointerNotPartOf = true;
} }
} }