my workspace died again

This commit is contained in:
70000hp 2023-12-28 10:53:07 -05:00
parent 1505314260
commit b6f1d422e8
4 changed files with 47 additions and 18 deletions

View File

@ -67,11 +67,16 @@ public class MachineStrandCaster extends BlockDummyable implements ICrucibleAcce
//up,down;forward,backward;left,right
MultiblockHandlerXR.fillSpace(world, x, y, z, new int[]{2, 0, 1, 0, 1, 0}, this, dir);
this.makeExtra(world, x + rot.offsetX, y, z + rot.offsetZ);
//Fluid ports
this.makeExtra(world, x + rot.offsetX - dir.offsetX, y, z + rot.offsetZ - dir.offsetZ);
this.makeExtra(world, x - dir.offsetX, y, z - dir.offsetZ);
this.makeExtra(world, x - dir.offsetX * 5, y, z - dir.offsetZ * 5);
this.makeExtra(world, x + rot.offsetX - dir.offsetX * 5, y, z + rot.offsetZ - dir.offsetZ * 5);
//Molten slop ports
this.makeExtra(world, x + rot.offsetX - dir.offsetX, y + 2, z + rot.offsetZ - dir.offsetZ);
this.makeExtra(world, x - dir.offsetX, y + 2, z - dir.offsetZ);
this.makeExtra(world, x + rot.offsetX, y + 2, z + rot.offsetZ);
this.makeExtra(world, x, y + 2, z);
}
@Override

View File

@ -16,16 +16,16 @@ public class RenderStrandCaster extends TileEntitySpecialRenderer implements IIt
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glTranslated(x + 0.5, y, z + 0.5);
switch(te.getBlockMetadata() - BlockDummyable.offset) {
case 4: GL11.glRotatef(90, 0F, 1F, 0F); break;
case 3: GL11.glRotatef(180, 0F, 1F, 0F); break;
case 5: GL11.glRotatef(270, 0F, 1F, 0F); break;
case 2: GL11.glRotatef(0, 0F, 1F, 0F); break;
}
GL11.glTranslated( 0.5, 0, 0.5);
GL11.glRotated(180, 0, 1, 0);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);

View File

@ -432,6 +432,7 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
this.inventory = nbt.getBoolean("inv");
this.power = nbt.getBoolean("power");
this.fluid = nbt.getBoolean("fluid");
this.moltenMetal = nbt.getBoolean("metal");
this.heat = nbt.getBoolean("heat");
}
@ -442,6 +443,7 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
nbt.setBoolean("inv", inventory);
nbt.setBoolean("power", power);
nbt.setBoolean("fluid", fluid);
nbt.setBoolean("metal", moltenMetal);
nbt.setBoolean("heat", heat);
}

View File

@ -4,7 +4,6 @@ import api.hbm.block.ICrucibleAcceptor;
import api.hbm.fluid.IFluidStandardTransceiver;
import com.hbm.blocks.BlockDummyable;
import com.hbm.inventory.container.ContainerMachineStrandCaster;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineStrandCaster;
@ -28,7 +27,6 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -79,10 +77,7 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
this.type = null;
}
if (worldObj.getTotalWorldTime() % 20 == 0) {
this.updateConnections();
}
this.updateConnections();
ItemMold.Mold mold = this.getInstalledMold();
@ -137,18 +132,31 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
return false;
}
public DirPos[] getConPos() {
public DirPos[] getFluidConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new DirPos[] {
new DirPos(xCoord + rot.offsetX * 2, yCoord, zCoord + rot.offsetZ * 2, rot),
new DirPos(xCoord - rot.offsetX, yCoord, zCoord - rot.offsetZ, rot.getOpposite()),
new DirPos(xCoord + rot.offsetX * 2 - dir.offsetX, yCoord, zCoord + rot.offsetZ * 2 - dir.offsetZ, rot),
new DirPos(xCoord - rot.offsetX - dir.offsetX, yCoord, zCoord - rot.offsetZ - dir.offsetZ, rot.getOpposite()),
new DirPos(xCoord + rot.offsetX * 2 - dir.offsetX * 5, yCoord, zCoord + rot.offsetZ * 2 - dir.offsetZ * 5, rot),
new DirPos(xCoord - rot.offsetX - dir.offsetX * 5, yCoord, zCoord - rot.offsetZ + dir.offsetZ * 5, rot.getOpposite()),
};
}
public int[][] getMetalPourPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new int[][] {
new int[]{xCoord + rot.offsetX - dir.offsetX, yCoord + 2, zCoord + rot.offsetZ - dir.offsetZ},
new int[]{xCoord - dir.offsetX, yCoord + 2, zCoord - dir.offsetZ},
new int[]{xCoord + rot.offsetX, yCoord + 2, zCoord + rot.offsetZ},
new int[]{xCoord, yCoord + 2, zCoord},
};
}
@Override
public ItemMold.Mold getInstalledMold() {
if(slots[0] == null) return null;
@ -163,10 +171,24 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
public int getMoldSize() {
return getInstalledMold().size;
}
@Override
public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, Mats.MaterialStack stack) {
if(side != ForgeDirection.UP) return false;
for (int[] pos : getMetalPourPos()) {
if (pos[0]== x && pos[1] == y && pos[2] == z){
return this.standardCheck(world, x, y, z, side, stack);
}
}
return false;
}
@Override
public boolean standardCheck(World world, int x, int y, int z, ForgeDirection side, Mats.MaterialStack stack) {
if(this.type != null && this.type != stack.material) return false;
return this.amount >= this.getCapacity() && getInstalledMold() == null;
return !(this.amount >= this.getCapacity() || getInstalledMold() == null);
}
@Override
public int getCapacity() {
@ -178,10 +200,10 @@ public class TileEntityMachineStrandCaster extends TileEntityFoundryCastingBase
}
private void updateConnections() {
for(DirPos pos : getConPos()) {
for(DirPos pos : getFluidConPos()) {
this.trySubscribe(water.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
for(DirPos pos : getConPos()) {
for(DirPos pos : getFluidConPos()) {
sendFluid(steam, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}