mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
b5f80f96f1
@ -1,11 +1,14 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticReformer;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineCatalyticReformer extends BlockDummyable {
|
||||
|
||||
@ -15,11 +18,25 @@ public class MachineCatalyticReformer extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
if(meta >= 12) return new TileEntityMachineCatalyticReformer();
|
||||
|
||||
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return standardOpenBehavior(world, x, y, z, player, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ + 1);
|
||||
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ - 1);
|
||||
this.makeExtra(world, x - dir.offsetX - 1, y, z - dir.offsetZ + 1);
|
||||
this.makeExtra(world, x - dir.offsetX - 1, y, z - dir.offsetZ - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
|
||||
@ -0,0 +1,96 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotMachineOutput;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticReformer;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerMachineCatalyticReformer extends Container {
|
||||
|
||||
private TileEntityMachineCatalyticReformer reformer;
|
||||
|
||||
public ContainerMachineCatalyticReformer(InventoryPlayer invPlayer, TileEntityMachineCatalyticReformer tedf) {
|
||||
|
||||
reformer = tedf;
|
||||
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 17, 90));
|
||||
//Canister Input
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 35, 90));
|
||||
//Canister Output
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 2, 35, 108));
|
||||
//Reformate Input
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 107, 90));
|
||||
//Reformate Output
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 4, 107, 108));
|
||||
//Gas Input
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 125, 90));
|
||||
//Gas Output
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 6, 125, 108));
|
||||
//Hydrogen Input
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 143, 90));
|
||||
//Hydrogen Oil Output
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 8, 143, 108));
|
||||
//Fluid ID
|
||||
this.addSlotToContainer(new Slot(tedf, 9, 17, 108));
|
||||
//Catalyst
|
||||
this.addSlotToContainer(new Slot(tedf, 10, 71, 36));
|
||||
|
||||
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, 156 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 214));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if(par2 <= 10) {
|
||||
if(!this.mergeItemStack(var5, 11, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if(!this.mergeItemStack(var5, 0, 1, false))
|
||||
if(!this.mergeItemStack(var5, 1, 2, false))
|
||||
if(!this.mergeItemStack(var5, 3, 4, false))
|
||||
if(!this.mergeItemStack(var5, 5, 6, false))
|
||||
if(!this.mergeItemStack(var5, 7, 8, false))
|
||||
if(!this.mergeItemStack(var5, 9, 11, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return reformer.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineCatalyticReformer;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticReformer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineCatalyticReformer extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_catalytic_reformer.png");
|
||||
private TileEntityMachineCatalyticReformer refinery;
|
||||
|
||||
public GUIMachineCatalyticReformer(InventoryPlayer invPlayer, TileEntityMachineCatalyticReformer tedf) {
|
||||
super(new ContainerMachineCatalyticReformer(invPlayer, tedf));
|
||||
refinery = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 238;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
refinery.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 44, guiTop + 70 - 52, 16, 52);
|
||||
refinery.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 70 - 52, 16, 52);
|
||||
refinery.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 98, guiTop + 70 - 52, 16, 52);
|
||||
refinery.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 70 - 52, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 70 - 52, 16, 52, refinery.power, refinery.maxPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.refinery.hasCustomInventoryName() ? this.refinery.getInventoryName() : I18n.format(this.refinery.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 0xffffff);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 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);
|
||||
|
||||
int j = (int) (refinery.power * 54 / refinery.maxPower);
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 70 - j, 176, 52 - j, 16, j);
|
||||
|
||||
refinery.tanks[0].renderTank(guiLeft + 44, guiTop + 70, this.zLevel, 16, 52);
|
||||
refinery.tanks[1].renderTank(guiLeft + 80, guiTop + 70, this.zLevel, 16, 52);
|
||||
refinery.tanks[2].renderTank(guiLeft + 98, guiTop + 70, this.zLevel, 16, 52);
|
||||
refinery.tanks[3].renderTank(guiLeft + 116, guiTop + 70, this.zLevel, 16, 52);
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,41 @@
|
||||
package com.hbm.tileentity.machine.oil;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineCatalyticReformer;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineCatalyticReformer;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase {
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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 TileEntityMachineCatalyticReformer extends TileEntityMachineBase implements IEnergyUser, IFluidStandardTransceiver, IPersistentNBT, IGUIProvider {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1_000_000;
|
||||
|
||||
public FluidTank[] tanks;
|
||||
|
||||
public TileEntityMachineCatalyticReformer() {
|
||||
super(0);
|
||||
super(11);
|
||||
|
||||
this.tanks = new FluidTank[4];
|
||||
this.tanks[0] = new FluidTank(Fluids.NAPHTHA, 64_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.REFORMATE, 24_000);
|
||||
this.tanks[2] = new FluidTank(Fluids.PETROLEUM, 24_000);
|
||||
this.tanks[3] = new FluidTank(Fluids.HYDROGEN, 24_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -17,5 +47,116 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase {
|
||||
public void updateEntity() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
power = nbt.getLong("power");
|
||||
tanks[0].readFromNBT(nbt, "input");
|
||||
tanks[1].readFromNBT(nbt, "o1");
|
||||
tanks[2].readFromNBT(nbt, "o2");
|
||||
tanks[3].readFromNBT(nbt, "o3");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setLong("power", power);
|
||||
tanks[0].writeToNBT(nbt, "input");
|
||||
tanks[1].writeToNBT(nbt, "o1");
|
||||
tanks[2].writeToNBT(nbt, "o2");
|
||||
tanks[3].writeToNBT(nbt, "o3");
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 2,
|
||||
yCoord,
|
||||
zCoord - 2,
|
||||
xCoord + 3,
|
||||
yCoord + 7,
|
||||
zCoord + 3
|
||||
);
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] {tanks[1], tanks[2], tanks[3], tanks[4]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(FluidType type, ForgeDirection dir) {
|
||||
return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
if(tanks[0].getFill() == 0 && tanks[1].getFill() == 0 && tanks[2].getFill() == 0 && tanks[3].getFill() == 0 && tanks[4].getFill() == 0) return;
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
for(int i = 0; i < 4; i++) this.tanks[i].writeToNBT(data, "" + i);
|
||||
nbt.setTag(NBT_PERSISTENT_KEY, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound data = nbt.getCompoundTag(NBT_PERSISTENT_KEY);
|
||||
for(int i = 0; i < 4; i++) this.tanks[i].readFromNBT(data, "" + i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerMachineCatalyticReformer(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineCatalyticReformer(player.inventory, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,6 +200,11 @@ public class TileEntityMachineVacuumDistill extends TileEntityMachineBase implem
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(FluidType type, ForgeDirection dir) {
|
||||
return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
Loading…
x
Reference in New Issue
Block a user