mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
some more chemfac work, expanded fluid acceptor interface
This commit is contained in:
parent
9477cf8b68
commit
dbce273e03
@ -6,6 +6,7 @@ import com.hbm.tileentity.machine.TileEntityMachineChemfac;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -41,5 +42,24 @@ public class MachineChemfac extends BlockDummyable {
|
||||
@Override
|
||||
public 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 * o;
|
||||
z += dir.offsetZ * o;
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
||||
|
||||
this.safeRem = true;
|
||||
|
||||
for(int i = -3; i < 3; i++) {
|
||||
this.makeExtra(world, x + rot.offsetX * 2 + dir.offsetX * i, y + 3, z + rot.offsetZ * 2 + dir.offsetZ * i);
|
||||
this.makeExtra(world, x - rot.offsetX * 3 + dir.offsetX * i, y + 3, z - rot.offsetZ * 3 + dir.offsetZ * i);
|
||||
|
||||
this.makeExtra(world, x + rot.offsetX * 3 + dir.offsetX * i, y + 1, z + rot.offsetZ * 3 + dir.offsetZ * i);
|
||||
this.makeExtra(world, x + rot.offsetX * 3 + dir.offsetX * i, y + 2, z + rot.offsetZ * 3 + dir.offsetZ * i);
|
||||
|
||||
this.makeExtra(world, x - rot.offsetX * 4 + dir.offsetX * i, y + 1, z - rot.offsetZ * 4 + dir.offsetZ * i);
|
||||
this.makeExtra(world, x - rot.offsetX * 4 + dir.offsetX * i, y + 2, z - rot.offsetZ * 4 + dir.offsetZ * i);
|
||||
}
|
||||
|
||||
this.safeRem = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,4 +5,16 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
public interface IFluidAcceptor extends IFluidContainer {
|
||||
|
||||
int getMaxFluidFill(FluidType type);
|
||||
|
||||
public default void setFluidFillForReceive(int fill, FluidType type) {
|
||||
this.setFluidFill(fill, type);
|
||||
}
|
||||
|
||||
public default int getFluidFillForReceive(FluidType type) {
|
||||
return this.getFluidFill(type);
|
||||
}
|
||||
|
||||
public default int getMaxFluidFillForReceive(FluidType type) {
|
||||
return this.getMaxFluidFill(type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,28 +611,28 @@ public class Library {
|
||||
}
|
||||
}
|
||||
|
||||
if(tileentity instanceof IFluidAcceptor && newTact && ((IFluidAcceptor)tileentity).getMaxFluidFill(type) > 0 &&
|
||||
((IFluidAcceptor)tileentity).getMaxFluidFill(type) - ((IFluidAcceptor)tileentity).getFluidFill(type) > 0) {
|
||||
if(tileentity instanceof IFluidAcceptor && newTact && ((IFluidAcceptor)tileentity).getMaxFluidFillForReceive(type) > 0 &&
|
||||
((IFluidAcceptor)tileentity).getMaxFluidFillForReceive(type) - ((IFluidAcceptor)tileentity).getFluidFillForReceive(type) > 0) {
|
||||
that.getFluidList(type).add((IFluidAcceptor)tileentity);
|
||||
}
|
||||
|
||||
if(!newTact)
|
||||
{
|
||||
if(!newTact) {
|
||||
int size = that.getFluidList(type).size();
|
||||
if(size > 0)
|
||||
{
|
||||
|
||||
if(size > 0) {
|
||||
int part = that.getFluidFill(type) / size;
|
||||
for(IFluidAcceptor consume : that.getFluidList(type))
|
||||
{
|
||||
if(consume.getFluidFill(type) < consume.getMaxFluidFill(type))
|
||||
{
|
||||
if(consume.getMaxFluidFill(type) - consume.getFluidFill(type) >= part)
|
||||
{
|
||||
|
||||
for(IFluidAcceptor consume : that.getFluidList(type)) {
|
||||
|
||||
if(consume.getFluidFillForReceive(type) < consume.getMaxFluidFillForReceive(type)) {
|
||||
|
||||
if(consume.getMaxFluidFillForReceive(type) - consume.getFluidFillForReceive(type) >= part) {
|
||||
that.setFluidFill(that.getFluidFill(type) - part, type);
|
||||
consume.setFluidFill(consume.getFluidFill(type) + part, type);
|
||||
consume.setFluidFillForReceive(consume.getFluidFillForReceive(type) + part, type);
|
||||
|
||||
} else {
|
||||
that.setFluidFill(that.getFluidFill(type) - (consume.getMaxFluidFill(type) - consume.getFluidFill(type)), type);
|
||||
consume.setFluidFill(consume.getMaxFluidFill(type), type);
|
||||
that.setFluidFill(that.getFluidFill(type) - (consume.getMaxFluidFillForReceive(type) - consume.getFluidFillForReceive(type)), type);
|
||||
consume.setFluidFillForReceive(consume.getMaxFluidFillForReceive(type), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
@ -78,4 +79,23 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
|
||||
public String getName() {
|
||||
return "container.machineChemFac";
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 5,
|
||||
yCoord,
|
||||
zCoord - 5,
|
||||
xCoord + 5,
|
||||
yCoord + 4,
|
||||
zCoord + 5
|
||||
);
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 6.3 KiB |
Loading…
x
Reference in New Issue
Block a user