mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
and now for something completely different
This commit is contained in:
parent
1ffb2737aa
commit
647c837909
@ -26,12 +26,12 @@ public class MachineElectrolyser extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 4, 4, 2, 2};
|
||||
return new int[] {0, 0, 5, 5, 1, 3};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 4;
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,33 +42,39 @@ public class MachineElectrolyser 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);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {1, 0, 4, 4, 1, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -1, 4, 4, 0, 0}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, 1, -1, -2, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, 1, -1, -1, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, 3, -3, -2, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, 3, -3, -1, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, -1, 1, -2, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, -1, 1, -1, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, -3, 3, -2, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, -3, 3, -1, 1}, this, dir);
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {2, -1, 5, 5, 1, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -3, 5, 5, 0, 0}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, 4, -4, -3, 3}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, 2, -2, -3, 3}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, 0, 0, -3, 3}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, -2, 2, -3, 3}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, -4, 4, -3, 3}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, 4, -4, -1, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, 2, -2, -1, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, 0, 0, -1, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, -2, 2, -1, 2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, -4, 4, -1, 2}, this, dir);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {1, 0, 4, 4, 1, 1}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -1, 4, 4, 0, 0}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, 1, -1, -2, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, 1, -1, -1, 1}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, 3, -3, -2, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, 3, -3, -1, 1}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, -1, 1, -2, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, -1, 1, -1, 1}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, -3, 3, -2, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, -3, 3, -1, 1}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y , z + dir.offsetZ * o, getDimensions(), x, y, z, dir)) return false;
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {2, -1, 5, 5, 1, 1}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -3, 5, 5, 0, 0}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, 4, -4, -3, 3}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, 2, -2, -3, 3}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, 0, 0, -3, 3}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, -2, 2, -3, 3}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {3, -1, -4, 4, -3, 3}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, 4, -4, -1, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, 2, -2, -1, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, -2, 2, -1, 2}, x, y, z, dir)) return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + 3, z + dir.offsetZ * o, new int[] {0, 0, -4, 4, -1, 2}, x, y, z, dir)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
public interface IControlReceiver {
|
||||
|
||||
public boolean hasPermission(EntityPlayer player);
|
||||
|
||||
|
||||
public void receiveControl(NBTTagCompound data);
|
||||
/* this was the easiest way of doing this without needing to change all 7 quadrillion implementors */
|
||||
public default void receiveControl(EntityPlayer player, NBTTagCompound data) { }
|
||||
}
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotTakeOnly;
|
||||
import com.hbm.tileentity.machine.TileEntityElectrolyser;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerElectrolyserFluid extends Container {
|
||||
|
||||
private TileEntityElectrolyser electrolyser;
|
||||
|
||||
public ContainerElectrolyserFluid(InventoryPlayer invPlayer, TileEntityElectrolyser tedf) {
|
||||
electrolyser = tedf;
|
||||
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 186, 109));
|
||||
//Upgrades
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 186, 140));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 186, 158));
|
||||
//Fluid ID
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 6, 18));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 6, 54));
|
||||
//Input
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 24, 18));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 6, 24, 54));
|
||||
//Output
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 78, 18));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 8, 78, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 9, 134, 18));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 10, 134, 54));
|
||||
//Byproducts
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 11, 154, 18));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 12, 154, 36));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 13, 154, 54));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 122 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 180));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return electrolyser.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerElectrolyserFluid;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityElectrolyser;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIElectrolyserFluid extends GuiInfoContainer {
|
||||
|
||||
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_electrolyser_fluid.png");
|
||||
private TileEntityElectrolyser electrolyser;
|
||||
|
||||
public GUIElectrolyserFluid(InventoryPlayer invPlayer, TileEntityElectrolyser electrolyser) {
|
||||
super(new ContainerElectrolyserFluid(invPlayer, electrolyser));
|
||||
this.electrolyser = electrolyser;
|
||||
|
||||
this.xSize = 210;
|
||||
this.ySize = 204;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
electrolyser.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 42, guiTop + 18, 16, 52);
|
||||
electrolyser.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 96, guiTop + 18, 16, 52);
|
||||
electrolyser.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 18, 16, 52);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 186, guiTop + 18, 16, 89, electrolyser.power, electrolyser.maxPower);
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.electrolyser.hasCustomInventoryName() ? this.electrolyser.getInventoryName() : I18n.format(this.electrolyser.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, (this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2) - 16, 7, 0xffffff);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 94, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
electrolyser.tanks[0].renderTank(guiLeft + 42, guiTop + 70, this.zLevel, 16, 52);
|
||||
electrolyser.tanks[1].renderTank(guiLeft + 96, guiTop + 70, this.zLevel, 16, 52);
|
||||
electrolyser.tanks[2].renderTank(guiLeft + 116, guiTop + 70, this.zLevel, 16, 52);
|
||||
}
|
||||
}
|
||||
@ -32,7 +32,6 @@ public class NBTControlPacket implements IMessage {
|
||||
|
||||
try {
|
||||
buffer.writeNBTTagCompoundToBuffer(nbt);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -45,9 +44,8 @@ public class NBTControlPacket implements IMessage {
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
|
||||
if (buffer == null) {
|
||||
buffer = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
if(buffer == null) buffer = new PacketBuffer(Unpooled.buffer());
|
||||
|
||||
buffer.writeBytes(buf);
|
||||
}
|
||||
|
||||
@ -58,9 +56,8 @@ public class NBTControlPacket implements IMessage {
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
|
||||
if (buffer == null) {
|
||||
buffer = new PacketBuffer(Unpooled.buffer());
|
||||
}
|
||||
if (buffer == null) buffer = new PacketBuffer(Unpooled.buffer());
|
||||
|
||||
buf.writeBytes(buffer);
|
||||
}
|
||||
|
||||
@ -85,8 +82,10 @@ public class NBTControlPacket implements IMessage {
|
||||
|
||||
IControlReceiver tile = (IControlReceiver)te;
|
||||
|
||||
if(tile.hasPermission(p))
|
||||
if(tile.hasPermission(p)) {
|
||||
tile.receiveControl(p, nbt);
|
||||
tile.receiveControl(nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,17 +1,10 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.container.ContainerElectrolyser;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerElectrolyserFluid;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIElectrolyser;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.inventory.gui.GUIElectrolyserFluid;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
@ -24,9 +17,8 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityElectrolyser extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidAcceptor, IGUIProvider /* TODO: new fluid API */ {
|
||||
public class TileEntityElectrolyser extends TileEntityMachineBase implements IEnergyUser, IControlReceiver, IGUIProvider {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 20000000;
|
||||
@ -43,11 +35,19 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
public FluidTank[] tanks;
|
||||
|
||||
public TileEntityElectrolyser() {
|
||||
super(24);
|
||||
tanks = new FluidTank[3];
|
||||
tanks[0] = new FluidTank(Fluids.WATER, 16000, 0);
|
||||
tanks[1] = new FluidTank(Fluids.HYDROGEN, 16000, 1);
|
||||
tanks[2] = new FluidTank(Fluids.OXYGEN, 16000, 2);
|
||||
//0: Battery
|
||||
//1-2: Upgrades
|
||||
//// FLUID
|
||||
//3-4: Fluid ID
|
||||
//5-10: Fluid IO
|
||||
//11-13: Byproducts
|
||||
//// METAL
|
||||
super(21);
|
||||
tanks = new FluidTank[4];
|
||||
tanks[0] = new FluidTank(Fluids.WATER, 16000);
|
||||
tanks[1] = new FluidTank(Fluids.HYDROGEN, 16000);
|
||||
tanks[2] = new FluidTank(Fluids.OXYGEN, 16000);
|
||||
tanks[3] = new FluidTank(Fluids.NITRIC_ACID, 16000);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,9 +60,6 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.tanks[0].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", this.power);
|
||||
data.setInteger("progressFluid", this.progressFluid);
|
||||
@ -70,25 +67,20 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
data.setInteger("usage", this.usage);
|
||||
data.setInteger("processFluidTime", this.processFluidTime);
|
||||
data.setInteger("processOreTime", this.processOreTime);
|
||||
for(int i = 0; i < 4; i++) tanks[i].writeToNBT(data, "t" + i);
|
||||
this.networkPack(data, 50);
|
||||
|
||||
fillFluidInit(tanks[1].getTankType());
|
||||
fillFluidInit(tanks[2].getTankType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
fillFluid(xCoord + dir.offsetX * 5 + rot.offsetX * -1, yCoord-1, zCoord + dir.offsetZ * 5 + rot.offsetZ * -1, getTact(), type);
|
||||
fillFluid(xCoord + dir.offsetX * 5 + rot.offsetX * -1, yCoord-1, zCoord + dir.offsetZ * 5 + rot.offsetZ * 1, getTact(), type);
|
||||
fillFluid(xCoord + dir.offsetX * -5 + rot.offsetX * -1, yCoord-1, zCoord + dir.offsetZ * 5 + rot.offsetZ * -1, getTact(), type);
|
||||
fillFluid(xCoord + dir.offsetX * -5 + rot.offsetX * -1, yCoord-1, zCoord + dir.offsetZ * 5 + rot.offsetZ * 1, getTact(), type);
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
this.progressFluid = nbt.getInteger("progressFluid");
|
||||
this.progressOre = nbt.getInteger("progressOre");
|
||||
this.usage = nbt.getInteger("usage");
|
||||
this.processFluidTime = nbt.getInteger("processFluidTime");
|
||||
this.processOreTime = nbt.getInteger("processOreTime");
|
||||
for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "t" + i);
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
@ -98,12 +90,12 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 3,
|
||||
xCoord - 5,
|
||||
yCoord - 0,
|
||||
zCoord - 4,
|
||||
xCoord + 3,
|
||||
zCoord - 5,
|
||||
xCoord + 6,
|
||||
yCoord + 4,
|
||||
zCoord + 4
|
||||
zCoord + 6
|
||||
);
|
||||
}
|
||||
|
||||
@ -126,65 +118,6 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillForSync(int fill, int index) {
|
||||
tanks[index].setFill(fill);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int fill, FluidType type) {
|
||||
for(int i = 0; i < 3; i++) {
|
||||
if(type == tanks[i].getTankType())
|
||||
tanks[i].setFill(fill);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeForSync(FluidType type, int index) {
|
||||
tanks[index].setTankType(type);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
for(int i = 0; i < 3; i++) {
|
||||
if(type == tanks[i].getTankType() && tanks[i].getFill() != 0)
|
||||
return tanks[i].getFill();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
for(int i = 0; i < 3; i++) {
|
||||
if(type == tanks[i].getTankType() && tanks[i].getMaxFill() != 0)
|
||||
return tanks[i].getMaxFill();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
|
||||
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
return worldObj.getTotalWorldTime() % 20 < 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
return new ArrayList<IFluidAcceptor>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList(FluidType type) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
this.power = power;
|
||||
@ -192,13 +125,27 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerElectrolyser(player.inventory, this);
|
||||
return new ContainerElectrolyserFluid(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIElectrolyser(player.inventory, this);
|
||||
return new GUIElectrolyserFluid(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(EntityPlayer player, NBTTagCompound data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(EntityPlayer player) {
|
||||
return this.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 5.8 KiB |
Loading…
x
Reference in New Issue
Block a user