This commit is contained in:
Boblet 2023-02-10 13:01:09 +01:00
parent c9172c5cf8
commit 9242c79ee3
6 changed files with 116 additions and 20 deletions

View File

@ -1,10 +1,12 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.tileentity.machine.TileEntityMachineHephaestus;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineHephaestus extends BlockDummyable {
@ -14,7 +16,7 @@ public class MachineHephaestus extends BlockDummyable {
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return null;
return new TileEntityMachineHephaestus();
}
@Override
@ -26,4 +28,21 @@ public class MachineHephaestus extends BlockDummyable {
public int getOffset() {
return 1;
}
@Override
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
x -= dir.offsetX;
z -= dir.offsetZ;
this.makeExtra(world, x + 1, y, z);
this.makeExtra(world, x - 1, y, z);
this.makeExtra(world, x, y, z + 1);
this.makeExtra(world, x, y, z - 1);
this.makeExtra(world, x + 1, y + 11, z);
this.makeExtra(world, x - 1, y + 11, z);
this.makeExtra(world, x, y + 11, z + 1);
this.makeExtra(world, x, y + 11, z - 1);
}
}

View File

@ -74,12 +74,12 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler {
}
}
boolean pX = Library.canConnectFluid(world, x + 1, y, z, Library.NEG_X, type);
boolean nX = Library.canConnectFluid(world, x - 1, y, z, Library.POS_X, type);
boolean pY = Library.canConnectFluid(world, x, y + 1, z, Library.NEG_Y, type);
boolean nY = Library.canConnectFluid(world, x, y - 1, z, Library.POS_Y, type);
boolean pZ = Library.canConnectFluid(world, x, y, z + 1, Library.NEG_Z, type);
boolean nZ = Library.canConnectFluid(world, x, y, z - 1, Library.POS_Z, type);
boolean pX = Library.canConnectFluid(world, x + 1, y, z, Library.POS_X, type);
boolean nX = Library.canConnectFluid(world, x - 1, y, z, Library.NEG_X, type);
boolean pY = Library.canConnectFluid(world, x, y + 1, z, Library.POS_Y, type);
boolean nY = Library.canConnectFluid(world, x, y - 1, z, Library.NEG_Y, type);
boolean pZ = Library.canConnectFluid(world, x, y, z + 1, Library.POS_Z, type);
boolean nZ = Library.canConnectFluid(world, x, y, z - 1, Library.NEG_Z, type);
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0);

View File

@ -163,12 +163,12 @@ public class RenderCableClassic implements ISimpleBlockRenderingHandler {
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
boolean pX = Library.canConnect(world, x + 1, y, z, Library.NEG_X);
boolean nX = Library.canConnect(world, x - 1, y, z, Library.POS_X);
boolean pY = Library.canConnect(world, x, y + 1, z, Library.NEG_Y);
boolean nY = Library.canConnect(world, x, y - 1, z, Library.POS_Y);
boolean pZ = Library.canConnect(world, x, y, z + 1, Library.NEG_Z);
boolean nZ = Library.canConnect(world, x, y, z - 1, Library.POS_Z);
boolean pX = Library.canConnect(world, x + 1, y, z, Library.POS_X);
boolean nX = Library.canConnect(world, x - 1, y, z, Library.NEG_X);
boolean pY = Library.canConnect(world, x, y + 1, z, Library.POS_Y);
boolean nY = Library.canConnect(world, x, y - 1, z, Library.NEG_Y);
boolean pZ = Library.canConnect(world, x, y, z + 1, Library.POS_Z);
boolean nZ = Library.canConnect(world, x, y, z - 1, Library.NEG_Z);
double uv_cL = iicon.getMinU();
double uv_cR = iicon.getInterpolatedU(5);

View File

@ -122,12 +122,12 @@ public class RenderDiode implements ISimpleBlockRenderingHandler {
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(1, 1, 1);
boolean pX = Library.canConnect(world, x + 1, y, z, Library.NEG_X);
boolean nX = Library.canConnect(world, x - 1, y, z, Library.POS_X);
boolean pY = Library.canConnect(world, x, y + 1, z, Library.NEG_Y);
boolean nY = Library.canConnect(world, x, y - 1, z, Library.POS_Y);
boolean pZ = Library.canConnect(world, x, y, z + 1, Library.NEG_Z);
boolean nZ = Library.canConnect(world, x, y, z - 1, Library.POS_Z);
boolean pX = Library.canConnect(world, x + 1, y, z, Library.POS_X);
boolean nX = Library.canConnect(world, x - 1, y, z, Library.NEG_X);
boolean pY = Library.canConnect(world, x, y + 1, z, Library.POS_Y);
boolean nY = Library.canConnect(world, x, y - 1, z, Library.NEG_Y);
boolean pZ = Library.canConnect(world, x, y, z + 1, Library.POS_Z);
boolean nZ = Library.canConnect(world, x, y, z - 1, Library.NEG_Z);
tessellator.addTranslation(x + 0.5F, y + 0.5F, z + 0.5F);

View File

@ -20,7 +20,6 @@ import com.hbm.inventory.fluid.trait.FT_Heatable;
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingStep;
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.saveddata.TomSaveData;
import com.hbm.tileentity.IConfigurableMachine;
import com.hbm.tileentity.INBTPacketReceiver;

View File

@ -0,0 +1,78 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.Library;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.fluid.IFluidStandardTransceiver;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements INBTPacketReceiver, IFluidStandardTransceiver {
public FluidTank input;
public FluidTank output;
public TileEntityMachineHephaestus() {
this.input = new FluidTank(Fluids.OIL, 24_000);
this.output = new FluidTank(Fluids.HOTOIL, 24_000);
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
this.updateConnections();
}
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
}
private void updateConnections() {
for(DirPos pos : getConPos()) {
this.trySubscribe(input.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
private DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord + 1, yCoord, zCoord, Library.POS_X),
new DirPos(xCoord - 1, yCoord, zCoord, Library.NEG_X),
new DirPos(xCoord, yCoord, zCoord + 1, Library.POS_Z),
new DirPos(xCoord, yCoord, zCoord - 1, Library.NEG_Z),
new DirPos(xCoord + 1, yCoord + 11, zCoord, Library.POS_X),
new DirPos(xCoord - 1, yCoord + 11, zCoord, Library.NEG_X),
new DirPos(xCoord, yCoord + 11, zCoord + 1, Library.POS_Z),
new DirPos(xCoord, yCoord + 11, zCoord - 1, Library.NEG_Z)
};
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] {input, output};
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {output};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {input};
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.UP && dir != ForgeDirection.DOWN;
}
}