mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-24 15:00:48 +00:00
trolling
This commit is contained in:
parent
29774caf77
commit
ba51590bda
@ -869,7 +869,6 @@ public class ModBlocks {
|
|||||||
public static Block machine_minirtg;
|
public static Block machine_minirtg;
|
||||||
public static Block machine_powerrtg;
|
public static Block machine_powerrtg;
|
||||||
public static Block machine_radiolysis;
|
public static Block machine_radiolysis;
|
||||||
public static final int guiID_machine_radiolysis = 125;
|
|
||||||
|
|
||||||
public static Block machine_well;
|
public static Block machine_well;
|
||||||
public static Block oil_pipe;
|
public static Block oil_pipe;
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public class MachineRadiolysis extends BlockDummyable {
|
|||||||
if(meta >= 12)
|
if(meta >= 12)
|
||||||
return new TileEntityMachineRadiolysis();
|
return new TileEntityMachineRadiolysis();
|
||||||
if(meta >= 6)
|
if(meta >= 6)
|
||||||
return new TileEntityProxyCombo(false, true, true);
|
return new TileEntityProxyCombo(true, true, true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ public class MachineRadiolysis extends BlockDummyable {
|
|||||||
if(pos == null)
|
if(pos == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_radiolysis, world, pos[0], pos[1], pos[2]);
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -28,10 +28,15 @@ public class GUIHandler implements IGuiHandler {
|
|||||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
TileEntity entity = world.getTileEntity(x, y, z);
|
TileEntity entity = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
|
/* yeah, that's better but something like UFFR's system would be best */
|
||||||
if(entity instanceof TileEntityMachineLiquefactor) {
|
if(entity instanceof TileEntityMachineLiquefactor) {
|
||||||
return new ContainerLiquefactor(player.inventory, (TileEntityMachineLiquefactor) entity);
|
return new ContainerLiquefactor(player.inventory, (TileEntityMachineLiquefactor) entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(entity instanceof TileEntityMachineRadiolysis) {
|
||||||
|
return new ContainerRadiolysis(player.inventory, (TileEntityMachineRadiolysis) entity);
|
||||||
|
}
|
||||||
|
|
||||||
switch(ID) {
|
switch(ID) {
|
||||||
case ModBlocks.guiID_test_difurnace: {
|
case ModBlocks.guiID_test_difurnace: {
|
||||||
if(entity instanceof TileEntityDiFurnace) {
|
if(entity instanceof TileEntityDiFurnace) {
|
||||||
@ -872,6 +877,10 @@ public class GUIHandler implements IGuiHandler {
|
|||||||
return new GUILiquefactor(player.inventory, (TileEntityMachineLiquefactor) entity);
|
return new GUILiquefactor(player.inventory, (TileEntityMachineLiquefactor) entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(entity instanceof TileEntityMachineRadiolysis) {
|
||||||
|
return new GUIRadiolysis(player.inventory, (TileEntityMachineRadiolysis) entity);
|
||||||
|
}
|
||||||
|
|
||||||
switch(ID) {
|
switch(ID) {
|
||||||
case ModBlocks.guiID_test_difurnace: {
|
case ModBlocks.guiID_test_difurnace: {
|
||||||
if(entity instanceof TileEntityDiFurnace) {
|
if(entity instanceof TileEntityDiFurnace) {
|
||||||
|
|||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.hbm.inventory.container;
|
||||||
|
|
||||||
|
import com.hbm.inventory.SlotMachineOutput;
|
||||||
|
import com.hbm.tileentity.machine.TileEntityMachineRadiolysis;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class ContainerRadiolysis extends Container {
|
||||||
|
|
||||||
|
private TileEntityMachineRadiolysis radiolysis;
|
||||||
|
|
||||||
|
public ContainerRadiolysis(InventoryPlayer playerInv, TileEntityMachineRadiolysis tile) {
|
||||||
|
radiolysis = tile;
|
||||||
|
|
||||||
|
//RTG
|
||||||
|
for(byte i = 0; i < 2; i++) {
|
||||||
|
for(byte j = 0; j < 5; j++) {
|
||||||
|
this.addSlotToContainer(new Slot(tile, j + i * 5, 188 + i * 18, 8 + j * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Fluid IO
|
||||||
|
this.addSlotToContainer(new Slot(tile, 10, 34, 17));
|
||||||
|
this.addSlotToContainer(new SlotMachineOutput(tile, 11, 34, 53));
|
||||||
|
|
||||||
|
//Sterilization
|
||||||
|
this.addSlotToContainer(new Slot(tile, 12, 148, 17));
|
||||||
|
this.addSlotToContainer(new SlotMachineOutput(tile, 13, 148, 53));
|
||||||
|
|
||||||
|
for(int i = 0; i < 3; i++) {
|
||||||
|
for(int j = 0; j < 9; j++) {
|
||||||
|
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(EntityPlayer player) {
|
||||||
|
return radiolysis.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** my eye, my eye, coctor coctor coctor **/
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||||
|
ItemStack var3 = null;
|
||||||
|
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||||
|
|
||||||
|
if(slot != null && slot.getHasStack()) {
|
||||||
|
ItemStack stack = slot.getStack();
|
||||||
|
var3 = stack.copy();
|
||||||
|
|
||||||
|
if(index <= 13) {
|
||||||
|
if(!this.mergeItemStack(stack, 14, this.inventorySlots.size(), true)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if(!this.mergeItemStack(stack, 0, 14, false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stack.stackSize == 0) {
|
||||||
|
slot.putStack((ItemStack) null);
|
||||||
|
} else {
|
||||||
|
slot.onSlotChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return var3;
|
||||||
|
}
|
||||||
|
}
|
||||||
65
src/main/java/com/hbm/inventory/gui/GUIRadiolysis.java
Normal file
65
src/main/java/com/hbm/inventory/gui/GUIRadiolysis.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package com.hbm.inventory.gui;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.hbm.inventory.FluidTank;
|
||||||
|
import com.hbm.inventory.container.ContainerRadiolysis;
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.tileentity.machine.TileEntityMachineRadiolysis;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class GUIRadiolysis extends GuiInfoContainer {
|
||||||
|
|
||||||
|
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_radiolysis.png");
|
||||||
|
private TileEntityMachineRadiolysis radiolysis;
|
||||||
|
|
||||||
|
public GUIRadiolysis(InventoryPlayer invPlayer, TileEntityMachineRadiolysis tedf) {
|
||||||
|
super(new ContainerRadiolysis(invPlayer, tedf));
|
||||||
|
radiolysis = tedf;
|
||||||
|
|
||||||
|
this.xSize = 230;
|
||||||
|
this.ySize = 166;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||||
|
super.drawScreen(mouseX, mouseY, f);
|
||||||
|
|
||||||
|
radiolysis.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 61, guiTop + 17, 8, 52);
|
||||||
|
radiolysis.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 17, 26, 16);
|
||||||
|
radiolysis.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 53, 26, 16);
|
||||||
|
|
||||||
|
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 17, 16, 52, radiolysis.power, radiolysis.maxPower);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||||
|
|
||||||
|
String name = this.radiolysis.hasCustomInventoryName() ? this.radiolysis.getInventoryName() : I18n.format(this.radiolysis.getInventoryName());
|
||||||
|
|
||||||
|
this.fontRendererObj.drawString(name, 88 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||||
|
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 i = (int)(radiolysis.getPower() * 52 / radiolysis.getMaxPower());
|
||||||
|
drawTexturedModalRect(guiLeft + 8, guiTop + 69 - i, 240, 52 - i, 16, i);
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(radiolysis.tanks[0].getSheet());
|
||||||
|
radiolysis.tanks[0].renderTank(this, guiLeft + 61, guiTop + 69, radiolysis.tanks[0].getTankType().textureX() * FluidTank.x, radiolysis.tanks[0].getTankType().textureY() * FluidTank.y, 8, 52);
|
||||||
|
|
||||||
|
for(byte j = 0; j < 2; j++) {
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(radiolysis.tanks[j].getSheet());
|
||||||
|
radiolysis.tanks[j + 1].renderTank(this, guiLeft + 80, guiTop + 33 + j * 36, radiolysis.tanks[j + 1].getTankType().textureX() * FluidTank.x, radiolysis.tanks[j + 1].getTankType().textureY() * FluidTank.y, 26, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.interfaces.IFluidAcceptor;
|
import com.hbm.interfaces.IFluidAcceptor;
|
||||||
import com.hbm.interfaces.IFluidContainer;
|
import com.hbm.interfaces.IFluidContainer;
|
||||||
import com.hbm.interfaces.IFluidSource;
|
import com.hbm.interfaces.IFluidSource;
|
||||||
@ -21,10 +22,12 @@ import com.hbm.util.RTGUtil;
|
|||||||
import com.hbm.util.Tuple.Pair;
|
import com.hbm.util.Tuple.Pair;
|
||||||
|
|
||||||
import api.hbm.energy.IEnergyGenerator;
|
import api.hbm.energy.IEnergyGenerator;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemFood;
|
import net.minecraft.item.ItemFood;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityMachineRadiolysis extends TileEntityMachineBase implements IEnergyGenerator, IFluidAcceptor, IFluidSource, IFluidContainer {
|
public class TileEntityMachineRadiolysis extends TileEntityMachineBase implements IEnergyGenerator, IFluidAcceptor, IFluidSource, IFluidContainer {
|
||||||
//TODO: TileMapping, Render file + resource location, container, gui, gui texture, further recipes; add registerRadiolysis to PostLoad
|
//TODO: TileMapping, Render file + resource location, container, gui, gui texture, further recipes; add registerRadiolysis to PostLoad
|
||||||
@ -99,15 +102,20 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
|||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
int heat = RTGUtil.updateRTGs(slots, slot_io);
|
int heat = RTGUtil.updateRTGs(slots, slot_rtg);
|
||||||
power += heat * 15;
|
power += heat * 15;
|
||||||
|
|
||||||
if(power > maxPower)
|
if(power > maxPower)
|
||||||
power = maxPower;
|
power = maxPower;
|
||||||
|
|
||||||
|
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||||
|
this.sendPower(worldObj, xCoord + 2, yCoord, zCoord, dir);
|
||||||
|
this.sendPower(worldObj, xCoord - 2, yCoord, zCoord, dir);
|
||||||
|
this.sendPower(worldObj, xCoord, yCoord, zCoord + 2, dir);
|
||||||
|
this.sendPower(worldObj, xCoord, yCoord, zCoord - 2, dir);
|
||||||
|
|
||||||
tanks[0].setType(10, 11, slots);
|
tanks[0].setType(10, 11, slots);
|
||||||
setupTanks();
|
setupTanks();
|
||||||
tanks[0].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
|
||||||
|
|
||||||
if(heat > 0) {
|
if(heat > 0) {
|
||||||
if(heat >= 100 && worldObj.getTotalWorldTime() % 40 == 0)
|
if(heat >= 100 && worldObj.getTotalWorldTime() % 40 == 0)
|
||||||
@ -117,9 +125,17 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
|||||||
sterilize();
|
sterilize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(worldObj.getTotalWorldTime() % 10 == 0) {
|
||||||
|
fillFluidInit(tanks[1].getTankType());
|
||||||
|
fillFluidInit(tanks[2].getTankType());
|
||||||
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
data.setLong("power", power);
|
data.setLong("power", power);
|
||||||
this.networkPack(data, 50);
|
this.networkPack(data, 50);
|
||||||
|
|
||||||
|
for(byte i = 0; i < 3; i++)
|
||||||
|
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,14 +151,14 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
|||||||
|
|
||||||
if(tanks[0].getFill() >= 100 && hasSpace(left, right)) {
|
if(tanks[0].getFill() >= 100 && hasSpace(left, right)) {
|
||||||
tanks[0].setFill(tanks[0].getFill() - 100);
|
tanks[0].setFill(tanks[0].getFill() - 100);
|
||||||
tanks[1].setFill(tanks[2].getFill() + left);
|
tanks[1].setFill(tanks[1].getFill() + left);
|
||||||
tanks[2].setFill(tanks[3].getFill() + right);
|
tanks[2].setFill(tanks[2].getFill() + right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasSpace(int left, int right) {
|
private boolean hasSpace(int left, int right) {
|
||||||
return tanks[2].getFill() + left <= tanks[2].getMaxFill() && tanks[3].getFill() + right <= tanks[3].getMaxFill();
|
return tanks[1].getFill() + left <= tanks[1].getMaxFill() && tanks[2].getFill() + right <= tanks[2].getMaxFill();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupTanks() {
|
private void setupTanks() {
|
||||||
@ -254,18 +270,20 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxFluidFill(FluidType type) {
|
public int getMaxFluidFill(FluidType type) {
|
||||||
if(type == tanks[0].getTankType())
|
for(FluidTank tank : tanks) {
|
||||||
return tanks[0].getMaxFill();
|
if(tank.getTankType() == type) {
|
||||||
else
|
return tank.getMaxFill();
|
||||||
return 0;
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillFluidInit(FluidType type) {
|
public void fillFluidInit(FluidType type) {
|
||||||
fillFluid(xCoord + 1, yCoord, zCoord, this.getTact(), type);
|
fillFluid(this.xCoord + 2, this.yCoord, this.zCoord, this.getTact(), type);
|
||||||
fillFluid(xCoord - 1, yCoord, zCoord, this.getTact(), type);
|
fillFluid(this.xCoord - 2, this.yCoord, this.zCoord, this.getTact(), type);
|
||||||
fillFluid(xCoord, yCoord, zCoord + 1, this.getTact(), type);
|
fillFluid(this.xCoord, this.yCoord, this.zCoord + 2, this.getTact(), type);
|
||||||
fillFluid(xCoord, yCoord, zCoord - 1, this.getTact(), type);
|
fillFluid(this.xCoord, this.yCoord, this.zCoord - 2, this.getTact(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -275,7 +293,7 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getTact() {
|
public boolean getTact() {
|
||||||
return worldObj.getTotalWorldTime() % 10 == 0;
|
return worldObj.getTotalWorldTime() % 20 < 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
BIN
src/main/resources/assets/hbm/textures/gui/gui_radiolysis.png
Normal file
BIN
src/main/resources/assets/hbm/textures/gui/gui_radiolysis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Loading…
x
Reference in New Issue
Block a user