diff options
author | Detrav <witalyezep@gmail.com> | 2016-10-30 18:26:18 +0300 |
---|---|---|
committer | Detrav <witalyezep@gmail.com> | 2016-10-30 18:26:18 +0300 |
commit | 4c7dc978fd515db743214f6e7d116bb7ee97fa97 (patch) | |
tree | ab8835a87cf28daf8c099c263e84c1de09d9555f | |
parent | 09327089161000d3b538e0df5f44ab5c5250e6ec (diff) | |
download | GT5-Unofficial-4c7dc978fd515db743214f6e7d116bb7ee97fa97.tar.gz GT5-Unofficial-4c7dc978fd515db743214f6e7d116bb7ee97fa97.tar.bz2 GT5-Unofficial-4c7dc978fd515db743214f6e7d116bb7ee97fa97.zip |
Update Anvil gui
4 files changed, 76 insertions, 1 deletions
diff --git a/src/main/java/com/detrav/gui/DetravPortableAnvilGui.java b/src/main/java/com/detrav/gui/DetravPortableAnvilGui.java new file mode 100644 index 0000000000..ba1f63562b --- /dev/null +++ b/src/main/java/com/detrav/gui/DetravPortableAnvilGui.java @@ -0,0 +1,32 @@ +package com.detrav.gui; + +import com.detrav.gui.containers.DetravPortableAnvilContainer; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; + +/** + * Created by Detrav on 30.10.2016. + */ +public class DetravPortableAnvilGui extends GuiContainer { + public static final int GUI_ID = 40; + + private static final ResourceLocation field_147093_u = new ResourceLocation("textures/gui/container/anvil.png"); + + public DetravPortableAnvilGui(InventoryPlayer inventory, World world, ItemStack currentEquippedItem) { + super(new DetravPortableAnvilContainer(inventory,world,currentEquippedItem)); + } + + @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); + this.mc.getTextureManager().bindTexture(field_147093_u); + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/main/java/com/detrav/gui/containers/DetravPortableAnvilContainer.java b/src/main/java/com/detrav/gui/containers/DetravPortableAnvilContainer.java new file mode 100644 index 0000000000..4136137d97 --- /dev/null +++ b/src/main/java/com/detrav/gui/containers/DetravPortableAnvilContainer.java @@ -0,0 +1,21 @@ +package com.detrav.gui.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Created by Detrav on 30.10.2016. + */ +public class DetravPortableAnvilContainer extends Container { + public DetravPortableAnvilContainer(InventoryPlayer inventory, World world, ItemStack currentEquippedItem) { + + } + + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) { + return true; + } +} diff --git a/src/main/java/com/detrav/items/behaviours/BehaviourDetravToolPortableAnvil.java b/src/main/java/com/detrav/items/behaviours/BehaviourDetravToolPortableAnvil.java index d6fbc6b326..2ede8057f5 100644 --- a/src/main/java/com/detrav/items/behaviours/BehaviourDetravToolPortableAnvil.java +++ b/src/main/java/com/detrav/items/behaviours/BehaviourDetravToolPortableAnvil.java @@ -1,9 +1,20 @@ package com.detrav.items.behaviours; +import com.detrav.DetravScannerMod; +import gregtech.api.items.GT_MetaBase_Item; import gregtech.common.items.behaviors.Behaviour_None; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; /** * Created by Detrav on 30.10.2016. */ public class BehaviourDetravToolPortableAnvil extends Behaviour_None { + + public ItemStack onItemRightClick(GT_MetaBase_Item aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + DetravScannerMod.proxy.openPortableAnvilGui(aPlayer); + return super.onItemRightClick(aItem, aStack, aWorld, aPlayer); + //aPlayer.openContainer + } } diff --git a/src/main/java/com/detrav/proxies/CommonProxy.java b/src/main/java/com/detrav/proxies/CommonProxy.java index 74eed0a3cf..a9eaf3156b 100644 --- a/src/main/java/com/detrav/proxies/CommonProxy.java +++ b/src/main/java/com/detrav/proxies/CommonProxy.java @@ -5,6 +5,8 @@ import com.detrav.enums.DetravItemList; import com.detrav.enums.DetravSimpleItems; import com.detrav.events.DetravEntityDropEvent; import com.detrav.gui.DetravGuiProPick; +import com.detrav.gui.DetravPortableAnvilGui; +import com.detrav.gui.containers.DetravPortableAnvilContainer; import com.detrav.gui.containers.DetravPortableChargerContainer; import com.detrav.gui.DetravPortableChargerGui; import com.detrav.items.DetravMetaGeneratedTool01; @@ -63,6 +65,8 @@ public class CommonProxy implements IGuiHandler { return null; case DetravPortableChargerGui.GUI_ID: return new DetravPortableChargerContainer(player.inventory,world,player.getCurrentEquippedItem()); + case DetravPortableAnvilGui.GUI_ID: + return new DetravPortableAnvilContainer(player.inventory,world,player.getCurrentEquippedItem()); default: return null; } @@ -75,6 +79,8 @@ public class CommonProxy implements IGuiHandler { return new DetravGuiProPick(); case DetravPortableChargerGui.GUI_ID: return new DetravPortableChargerGui(player.inventory,world,player.getCurrentEquippedItem()); + case DetravPortableAnvilGui.GUI_ID: + return new DetravPortableAnvilGui(player.inventory,world,player.getCurrentEquippedItem()); default: return null; } @@ -91,11 +97,16 @@ public class CommonProxy implements IGuiHandler { player.openGui(DetravScannerMod.instance, DetravPortableChargerGui.GUI_ID,player.worldObj,(int)player.posX,(int)player.posY,(int)player.posZ); } + public void openPortableAnvilGui(EntityPlayer player) + { + player.openGui(DetravScannerMod.instance, DetravPortableAnvilGui.GUI_ID,player.worldObj,(int)player.posX,(int)player.posY,(int)player.posZ); + } + public void onPreInit() { - + } public void sendPlayerExeption(String s) { |