mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
drone GUI crap
This commit is contained in:
parent
abec6b14d1
commit
2986382029
@ -147,30 +147,10 @@ public class MachineBoiler extends BlockContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(world.isRemote)
|
if(world.isRemote) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
} else if(!player.isSneaking())
|
} else if(!player.isSneaking()) {
|
||||||
{
|
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if(te instanceof TileEntityMachineBoiler) {
|
|
||||||
|
|
||||||
TileEntityMachineBoiler entity = (TileEntityMachineBoiler) te;
|
|
||||||
if(entity != null)
|
|
||||||
{
|
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(te instanceof TileEntityMachineBoilerElectric) {
|
|
||||||
|
|
||||||
TileEntityMachineBoilerElectric entity = (TileEntityMachineBoilerElectric) te;
|
|
||||||
if(entity != null)
|
|
||||||
{
|
|
||||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1,13 +1,18 @@
|
|||||||
package com.hbm.blocks.network;
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.network.TileEntityDroneDock;
|
import com.hbm.tileentity.network.TileEntityDroneDock;
|
||||||
|
import com.hbm.tileentity.network.TileEntityDroneProvider;
|
||||||
|
import com.hbm.tileentity.network.TileEntityDroneRequester;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -23,8 +28,10 @@ public class DroneDock extends BlockContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
|
||||||
if(this == ModBlocks.drone_dock) return new TileEntityDroneDock();
|
if(this == ModBlocks.drone_dock) return new TileEntityDroneDock();
|
||||||
|
if(this == ModBlocks.drone_crate_provider) return new TileEntityDroneProvider();
|
||||||
|
if(this == ModBlocks.drone_crate_requester) return new TileEntityDroneRequester();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -42,4 +49,16 @@ public class DroneDock extends BlockContainer {
|
|||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : this.blockIcon);
|
return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.hbm.inventory.container;
|
||||||
|
|
||||||
|
import com.hbm.tileentity.network.TileEntityDroneDock;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
|
||||||
|
public class ContainerDroneDock extends ContainerCrateBase {
|
||||||
|
|
||||||
|
public ContainerDroneDock(InventoryPlayer invPlayer, TileEntityDroneDock tedf) {
|
||||||
|
super(tedf);
|
||||||
|
|
||||||
|
for(int i = 0; i < 34; i++) {
|
||||||
|
for(int j = 0; j < 3; j++) {
|
||||||
|
this.addSlotToContainer(new Slot(tedf, j + i * 3, 62 + j * 18, 17 + i * 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, 103 + i * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 161));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.hbm.inventory.container;
|
||||||
|
|
||||||
|
import com.hbm.tileentity.network.TileEntityDroneProvider;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
|
||||||
|
public class ContainerDroneProvider extends ContainerCrateBase {
|
||||||
|
|
||||||
|
public ContainerDroneProvider(InventoryPlayer invPlayer, TileEntityDroneProvider tedf) {
|
||||||
|
super(tedf);
|
||||||
|
|
||||||
|
for(int i = 0; i < 34; i++) {
|
||||||
|
for(int j = 0; j < 3; j++) {
|
||||||
|
this.addSlotToContainer(new Slot(tedf, j + i * 3, 62 + j * 18, 17 + i * 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, 103 + i * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 161));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
39
src/main/java/com/hbm/inventory/gui/GUIDroneDock.java
Normal file
39
src/main/java/com/hbm/inventory/gui/GUIDroneDock.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package com.hbm.inventory.gui;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.hbm.inventory.container.ContainerDroneDock;
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.tileentity.network.TileEntityDroneDock;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class GUIDroneDock extends GuiInfoContainer {
|
||||||
|
|
||||||
|
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_drone_dock.png");
|
||||||
|
private TileEntityDroneDock diFurnace;
|
||||||
|
|
||||||
|
public GUIDroneDock(InventoryPlayer invPlayer, TileEntityDroneDock tedf) {
|
||||||
|
super(new ContainerDroneDock(invPlayer, tedf));
|
||||||
|
diFurnace = tedf;
|
||||||
|
this.xSize = 176;
|
||||||
|
this.ySize = 185;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||||
|
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
42
src/main/java/com/hbm/inventory/gui/GUIDroneProvider.java
Normal file
42
src/main/java/com/hbm/inventory/gui/GUIDroneProvider.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package com.hbm.inventory.gui;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.hbm.inventory.container.ContainerDroneProvider;
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.tileentity.network.TileEntityDroneProvider;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class GUIDroneProvider extends GuiContainer {
|
||||||
|
|
||||||
|
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_drone_provider.png");
|
||||||
|
private TileEntityDroneProvider diFurnace;
|
||||||
|
|
||||||
|
public GUIDroneProvider(InventoryPlayer invPlayer, TileEntityDroneProvider tedf) {
|
||||||
|
super(new ContainerDroneProvider(invPlayer, tedf));
|
||||||
|
diFurnace = tedf;
|
||||||
|
|
||||||
|
this.xSize = 176;
|
||||||
|
this.ySize = 186;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||||
|
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,17 @@
|
|||||||
package com.hbm.tileentity.network;
|
package com.hbm.tileentity.network;
|
||||||
|
|
||||||
public class TileEntityDroneDock extends TileEntityRequestNetworkContainer {
|
import com.hbm.inventory.container.ContainerDroneDock;
|
||||||
|
import com.hbm.inventory.gui.GUIDroneDock;
|
||||||
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
|
|
||||||
|
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.world.World;
|
||||||
|
|
||||||
|
public class TileEntityDroneDock extends TileEntityRequestNetworkContainer implements IGUIProvider {
|
||||||
|
|
||||||
public TileEntityDroneDock() {
|
public TileEntityDroneDock() {
|
||||||
super(9);
|
super(9);
|
||||||
@ -15,4 +26,15 @@ public class TileEntityDroneDock extends TileEntityRequestNetworkContainer {
|
|||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
return new ContainerDroneDock(player.inventory, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
return new GUIDroneDock(player.inventory, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.hbm.tileentity.network;
|
||||||
|
|
||||||
|
import com.hbm.inventory.container.ContainerDroneProvider;
|
||||||
|
import com.hbm.inventory.gui.GUIDroneProvider;
|
||||||
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
|
|
||||||
|
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.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class TileEntityDroneProvider extends TileEntityRequestNetworkContainer implements IGUIProvider {
|
||||||
|
|
||||||
|
public TileEntityDroneProvider() {
|
||||||
|
super(9);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "container.droneProvider";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getAccessibleSlotsFromSide(int side) {
|
||||||
|
return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int i, ItemStack stack, int j) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
return new ContainerDroneProvider(player.inventory, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
return new GUIDroneProvider(player.inventory, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
package com.hbm.tileentity.network;
|
||||||
|
|
||||||
|
import com.hbm.module.ModulePatternMatcher;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class TileEntityDroneRequester extends TileEntityRequestNetworkContainer {
|
||||||
|
|
||||||
|
public ModulePatternMatcher matcher;
|
||||||
|
|
||||||
|
public TileEntityDroneRequester() {
|
||||||
|
super(18);
|
||||||
|
this.matcher = new ModulePatternMatcher(9);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "container.droneRequester";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matchesFilter(ItemStack stack) {
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
ItemStack filter = slots[i];
|
||||||
|
|
||||||
|
if(filter != null && this.matcher.isValidForFilter(filter, i, stack)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void nextMode(int i) {
|
||||||
|
this.matcher.nextMode(worldObj, slots[i], i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getAccessibleSlotsFromSide(int side) {
|
||||||
|
return new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 17 };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int i, ItemStack stack, int j) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user