mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
GUI time
This commit is contained in:
parent
ed79ad396e
commit
fca9fe50da
@ -4,8 +4,11 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityICFPress;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -29,7 +32,7 @@ public class MachineICFPress extends BlockContainer implements ITooltipProvider
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return null;
|
||||
return new TileEntityICFPress();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,6 +47,19 @@ public class MachineICFPress extends BlockContainer implements ITooltipProvider
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotTakeOnly;
|
||||
import com.hbm.tileentity.machine.TileEntityICFPress;
|
||||
|
||||
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 ContainerICFPress extends Container {
|
||||
|
||||
private TileEntityICFPress press;
|
||||
|
||||
public ContainerICFPress(InventoryPlayer invPlayer, TileEntityICFPress tedf) {
|
||||
|
||||
press = tedf;
|
||||
|
||||
//Empty Capsule
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 98, 18));
|
||||
//Filled Capsule
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 1, 98, 54));
|
||||
//Filled Muon
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 8, 18));
|
||||
//Empty Muon
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 3, 8, 54));
|
||||
//Solid Fuels
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 62, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 134, 54));
|
||||
//Fluid IDs
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 62, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 134, 18));
|
||||
|
||||
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, 97 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 155));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return press.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,6 @@ import com.hbm.tileentity.machine.TileEntityMachineDiesel;
|
||||
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;
|
||||
|
||||
@ -39,13 +38,7 @@ public class ContainerMachineDiesel extends Container {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
|
||||
46
src/main/java/com/hbm/inventory/gui/GUIICFPress.java
Normal file
46
src/main/java/com/hbm/inventory/gui/GUIICFPress.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerICFPress;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityICFPress;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIICFPress extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_icf_press.png");
|
||||
private TileEntityICFPress diesel;
|
||||
|
||||
public GUIICFPress(InventoryPlayer invPlayer, TileEntityICFPress tedf) {
|
||||
super(new ContainerICFPress(invPlayer, tedf));
|
||||
diesel = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 179;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diesel.hasCustomInventoryName() ? this.diesel.getInventoryName() : I18n.format(this.diesel.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - 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);
|
||||
}
|
||||
}
|
||||
@ -162,6 +162,7 @@ public class TileMappings {
|
||||
put(TileEntityMachineMiniRTG.class, "tileentity_mini_rtg");
|
||||
put(TileEntityITER.class, "tileentity_iter");
|
||||
put(TileEntityBlockICF.class, "tileentity_block_icf");
|
||||
put(TileEntityICFPress.class, "tileentity_icf_press");
|
||||
put(TileEntityICFController.class, "tileentity_icf_controller");
|
||||
put(TileEntityICF.class, "tileentity_icf");
|
||||
put(TileEntityMachinePlasmaHeater.class, "tileentity_plasma_heater");
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.inventory.container.ContainerICFPress;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIICFPress;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityICFPress extends TileEntityMachineBase implements IGUIProvider {
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public int muon;
|
||||
public static final int maxMuon = 16;
|
||||
|
||||
public TileEntityICFPress() {
|
||||
super(8);
|
||||
this.tanks = new FluidTank[2];
|
||||
this.tanks[0] = new FluidTank(Fluids.DEUTERIUM, 16_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.TRITIUM, 16_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.machineICFPress";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
|
||||
buf.writeByte((byte) muon);
|
||||
tanks[0].serialize(buf);
|
||||
tanks[1].serialize(buf);
|
||||
}
|
||||
|
||||
@Override public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
|
||||
this.muon = buf.readByte();
|
||||
tanks[0].deserialize(buf);
|
||||
tanks[1].deserialize(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerICFPress(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIICFPress(player.inventory, this);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.3 KiB |
Loading…
x
Reference in New Issue
Block a user