Added a few cool textures, neatened up Salination Tank structure code
This commit is contained in:
parent
fb140d4318
commit
83ee208fb7
7 changed files with 93 additions and 85 deletions
|
@ -21,6 +21,7 @@ import mekanism.common.tile.TileEntityBin;
|
|||
import mekanism.common.tile.TileEntityDynamicTank;
|
||||
import mekanism.common.tile.TileEntityDynamicValve;
|
||||
import mekanism.common.tile.TileEntitySalinationController;
|
||||
import mekanism.common.tile.TileEntitySalinationTank;
|
||||
import mekanism.common.tile.TileEntitySalinationValve;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -35,7 +36,6 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
@ -124,7 +124,7 @@ public class BlockBasic extends Block
|
|||
icons[12][0] = register.registerIcon("mekanism:CopperBlock");
|
||||
icons[13][0] = register.registerIcon("mekanism:TinBlock");
|
||||
icons[14][0] = register.registerIcon("mekanism:SalinationController");
|
||||
icons[14][1] = register.registerIcon("mekanism:CopperBlock");
|
||||
icons[14][1] = register.registerIcon("mekanism:SalinationControllerOn");
|
||||
icons[15][0] = register.registerIcon("mekanism:SalinationValve");
|
||||
|
||||
glassRenderer.registerIcons(register);
|
||||
|
@ -564,7 +564,7 @@ public class BlockBasic extends Block
|
|||
@Override
|
||||
public boolean hasTileEntity(int metadata)
|
||||
{
|
||||
return metadata == 6 || metadata == 9 || metadata == 10 || metadata == 11 || metadata == 14 || metadata == 15;
|
||||
return metadata == 6 || metadata == 9 || metadata == 10 || metadata == 11 || metadata == 12 || metadata == 14 || metadata == 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -580,6 +580,8 @@ public class BlockBasic extends Block
|
|||
return new TileEntityDynamicTank();
|
||||
case 11:
|
||||
return new TileEntityDynamicValve();
|
||||
case 12:
|
||||
return new TileEntitySalinationTank();
|
||||
case 14:
|
||||
return new TileEntitySalinationController();
|
||||
case 15:
|
||||
|
|
|
@ -80,8 +80,10 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
|
|||
clearStructure();
|
||||
return false;
|
||||
}
|
||||
|
||||
solarsActive &= solarPanel.seesSun;
|
||||
}
|
||||
|
||||
return solarsActive;
|
||||
}
|
||||
|
||||
|
@ -99,7 +101,12 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
|
|||
ForgeDirection right = MekanismUtils.getRight(facing);
|
||||
|
||||
height = 0;
|
||||
if(!findBottomLayer()) { return false; }
|
||||
|
||||
if(!findBottomLayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Coord4D startPoint = Coord4D.get(this).getFromSide(right);
|
||||
startPoint = isLeftOnFace ? startPoint : startPoint.getFromSide(right);
|
||||
|
||||
|
@ -113,94 +120,58 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
|
|||
height = structured ? height + 1 : 0;
|
||||
return structured;
|
||||
}
|
||||
|
||||
public ForgeDirection[] getMatrix()
|
||||
{
|
||||
return new ForgeDirection[] {MekanismUtils.getBack(facing), MekanismUtils.getLeft(facing),
|
||||
ForgeDirection.getOrientation(facing), MekanismUtils.getRight(facing)};
|
||||
}
|
||||
|
||||
public boolean findTopLayer(Coord4D current)
|
||||
{
|
||||
ForgeDirection left = MekanismUtils.getLeft(facing);
|
||||
ForgeDirection right = MekanismUtils.getRight(facing);
|
||||
ForgeDirection back = MekanismUtils.getBack(facing);
|
||||
ForgeDirection front = ForgeDirection.getOrientation(facing);
|
||||
|
||||
for(int i = 1; i <= 2; i++)
|
||||
ForgeDirection[] matrix = getMatrix();
|
||||
|
||||
for(int side = 0; side < matrix.length; side++)
|
||||
{
|
||||
current = current.getFromSide(back);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
for(int i = 1; i <= 2; i++)
|
||||
{
|
||||
current = current.getFromSide(matrix[side]);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
|
||||
if(!addTankPart(tile))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
current = current.getFromSide(matrix[side]);
|
||||
TileEntity solar = current.getTileEntity(worldObj);
|
||||
|
||||
if(!addSolarPanel(solar, side))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
current = current.getFromSide(back);
|
||||
TileEntity solar = current.getTileEntity(worldObj);
|
||||
if(!addSolarPanel(solar, 0)) { return false; }
|
||||
|
||||
for(int i = 1; i <= 2; i++)
|
||||
{
|
||||
current = current.getFromSide(left);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
current = current.getFromSide(left);
|
||||
solar = current.getTileEntity(worldObj);
|
||||
if(!addSolarPanel(solar, 1)) { return false; }
|
||||
|
||||
for(int i = 1; i <= 2; i++)
|
||||
{
|
||||
current = current.getFromSide(front);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
current = current.getFromSide(front);
|
||||
solar = current.getTileEntity(worldObj);
|
||||
if(!addSolarPanel(solar, 2)) { return false; }
|
||||
|
||||
for(int i = 1; i <= 2; i++)
|
||||
{
|
||||
current = current.getFromSide(right);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
current = current.getFromSide(right);
|
||||
solar = current.getTileEntity(worldObj);
|
||||
if(!addSolarPanel(solar, 3)) { return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean findMiddleLayer(Coord4D current)
|
||||
{
|
||||
ForgeDirection left = MekanismUtils.getLeft(facing);
|
||||
ForgeDirection right = MekanismUtils.getRight(facing);
|
||||
ForgeDirection back = MekanismUtils.getBack(facing);
|
||||
ForgeDirection front = ForgeDirection.getOrientation(facing);
|
||||
ForgeDirection[] matrix = getMatrix();
|
||||
|
||||
for(int i = 1; i <= 3; i++)
|
||||
for(ForgeDirection side : matrix)
|
||||
{
|
||||
current = current.getFromSide(back);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
current = current.getFromSide(left);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
current = current.getFromSide(front);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
}
|
||||
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
current = current.getFromSide(right);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
current = current.getFromSide(side);
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
|
||||
if(!addTankPart(tile))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -213,16 +184,31 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
|
|||
ForgeDirection left = MekanismUtils.getLeft(facing);
|
||||
ForgeDirection right = MekanismUtils.getRight(facing);
|
||||
|
||||
if(!findBottomRow(baseBlock)) { return false; };
|
||||
if(!findBottomRow(baseBlock.getFromSide(left))) { return false; };
|
||||
if(!findBottomRow(baseBlock.getFromSide(right))) { return false; };
|
||||
if(!findBottomRow(baseBlock))
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
if(!findBottomRow(baseBlock.getFromSide(left)))
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
if(!findBottomRow(baseBlock.getFromSide(right)))
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
boolean twoLeft = findBottomRow(baseBlock.getFromSide(left).getFromSide(left));
|
||||
boolean twoRight = findBottomRow(baseBlock.getFromSide(right).getFromSide(right));
|
||||
|
||||
if(twoLeft == twoRight) { return false; }
|
||||
if(twoLeft == twoRight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
isLeftOnFace = twoLeft;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -234,7 +220,12 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
|
|||
for(int i = 1; i <= 4; i++)
|
||||
{
|
||||
TileEntity tile = current.getTileEntity(worldObj);
|
||||
if(!addTankPart(tile)) { return false; }
|
||||
|
||||
if(!addTankPart(tile))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
current = current.getFromSide(back);
|
||||
}
|
||||
|
||||
|
@ -247,6 +238,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
|
|||
{
|
||||
((TileEntitySalinationTank)tile).addToStructure(this);
|
||||
tankParts.add((TileEntitySalinationTank)tile);
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@ -287,7 +279,8 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
|
|||
{
|
||||
tankPart.controllerGone();
|
||||
}
|
||||
|
||||
tankParts.clear();
|
||||
solars = new TileEntityAdvancedSolarGenerator[]{null, null, null, null};
|
||||
solars = new TileEntityAdvancedSolarGenerator[] {null, null, null, null};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ public class TileEntitySalinationTank extends TileEntityContainerBlock
|
|||
public TileEntitySalinationTank()
|
||||
{
|
||||
super("SalinationTank");
|
||||
|
||||
inventory = new ItemStack[0];
|
||||
|
||||
}
|
||||
|
@ -17,9 +18,11 @@ public class TileEntitySalinationTank extends TileEntityContainerBlock
|
|||
public TileEntitySalinationTank(String fullName)
|
||||
{
|
||||
super(fullName);
|
||||
|
||||
inventory = new ItemStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {};
|
||||
|
||||
public void addToStructure(TileEntitySalinationController controller)
|
||||
|
|
|
@ -19,7 +19,9 @@ public class TileEntitySalinationValve extends TileEntitySalinationTank implemen
|
|||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if(master != null && resource.getFluid() == FluidRegistry.getFluid("brine"))
|
||||
{
|
||||
return master.brineTank.drain(resource.amount, doDrain);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -28,7 +30,9 @@ public class TileEntitySalinationValve extends TileEntitySalinationTank implemen
|
|||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
if(master != null)
|
||||
{
|
||||
return master.brineTank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -52,6 +56,7 @@ public class TileEntitySalinationValve extends TileEntitySalinationTank implemen
|
|||
{
|
||||
return new FluidTankInfo[0];
|
||||
}
|
||||
|
||||
return new FluidTankInfo[] {new FluidTankInfo(master.waterTank), new FluidTankInfo(master.brineTank)};
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 10
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue