mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +00:00
Reorganize folders for modules
This commit is contained in:
1 parent
2c14f315de
commit
e2f0558b6f
370 files changed
+4274
-4788
No files matched your search
@@ -0,0 +1,157 @@
|
||||
package tconstruct.smeltery.component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mantle.blocks.iface.IServantLogic;
|
||||
import mantle.world.CoordTuple;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagIntArray;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import tconstruct.library.component.TankLayerScan;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
|
||||
public class SmelteryScan extends TankLayerScan
|
||||
{
|
||||
public ArrayList<CoordTuple> lavaTanks = new ArrayList<CoordTuple>();
|
||||
|
||||
public SmelteryScan(TileEntity te, Block... id)
|
||||
{
|
||||
super(te, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkValidStructure ()
|
||||
{
|
||||
lavaTanks.clear();
|
||||
super.checkValidStructure();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkAir (int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == null || world.isAirBlock(x, y, z) || block == TinkerSmeltery.tankAir)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkServant (int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == null || world.isAirBlock(x, y, z) || !isValidBlock(x, y, z))
|
||||
return false;
|
||||
|
||||
if (!block.hasTileEntity(world.getBlockMetadata(x, y, z)))
|
||||
return false;
|
||||
|
||||
TileEntity be = world.getTileEntity(x, y, z);
|
||||
if (be instanceof IServantLogic)
|
||||
{
|
||||
boolean ret = ((IServantLogic) be).setPotentialMaster(this.imaster, this.world, x, y, z);
|
||||
if (ret && block == TinkerSmeltery.lavaTank)
|
||||
lavaTanks.add(new CoordTuple(x, y, z));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalizeStructure ()
|
||||
{
|
||||
super.finalizeStructure();
|
||||
if (lavaTanks.size() < 1)
|
||||
completeStructure = false;
|
||||
else
|
||||
{
|
||||
for (CoordTuple coord : airCoords)
|
||||
{
|
||||
if (world.getBlock(coord.x, coord.y, coord.z) != TinkerSmeltery.tankAir)
|
||||
{
|
||||
world.setBlock(coord.x, coord.y, coord.z, TinkerSmeltery.tankAir);
|
||||
IServantLogic servant = (IServantLogic) world.getTileEntity(coord.x, coord.y, coord.z);
|
||||
servant.verifyMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void invalidateStructure ()
|
||||
{
|
||||
super.invalidateStructure();
|
||||
for (CoordTuple coord : airCoords)
|
||||
{
|
||||
TileEntity servant = world.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (servant instanceof IServantLogic)
|
||||
((IServantLogic) servant).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void invalidateBlocksAbove (int height)
|
||||
{
|
||||
for (CoordTuple coord : airCoords)
|
||||
{
|
||||
if (coord.y < height)
|
||||
continue;
|
||||
|
||||
TileEntity servant = world.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (servant instanceof IServantLogic)
|
||||
((IServantLogic) servant).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup ()
|
||||
{
|
||||
super.cleanup();
|
||||
Iterator i = airCoords.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
CoordTuple coord = (CoordTuple) i.next();
|
||||
TileEntity te = world.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (te != null && te instanceof IServantLogic)
|
||||
{
|
||||
((IServantLogic) te).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sync lava tanks for fuel values
|
||||
@Override
|
||||
public void readNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.readNetworkNBT(tags);
|
||||
|
||||
NBTTagList tanks = tags.getTagList("Tanks", 10);
|
||||
if (tanks != null)
|
||||
{
|
||||
lavaTanks.clear();
|
||||
|
||||
for (int i = 0; i < tanks.tagCount(); ++i)
|
||||
{
|
||||
int[] coord = tanks.func_150306_c(i);
|
||||
layerAirCoords.add(new CoordTuple(coord[0], coord[1], coord[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.writeNetworkNBT(tags);
|
||||
|
||||
NBTTagList tanks = new NBTTagList();
|
||||
for (CoordTuple coord : lavaTanks)
|
||||
{
|
||||
tanks.appendTag(new NBTTagIntArray(new int[] { coord.x, coord.y, coord.z }));
|
||||
}
|
||||
tags.setTag("Tanks", tanks);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user