mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 12:19:48 +00:00
Merge branch 'master' of github.com:mDiyo/TinkersConstruct
This commit is contained in:
commit
65590e3523
7 files changed
+88
-18
No files matched your search
@@ -238,6 +238,7 @@ StorageMetals.Steel.name=Stahlblock
|
||||
StorageMetals.Ender.name=Block Soliden Enders
|
||||
|
||||
tile.decoration.stonetorch.name=Fackel
|
||||
tile.decoration.stoneladder.name=Leiter
|
||||
tile.CraftingStation.name=Handwerksstation
|
||||
|
||||
block.glass.pure.name=Klares Glas
|
||||
|
||||
@@ -238,6 +238,7 @@ StorageMetals.Steel.name=Blocco d'Acciaio
|
||||
StorageMetals.Ender.name=Blocco di Ender Solido
|
||||
|
||||
tile.decoration.stonetorch.name=Torcia
|
||||
tile.decoration.stoneladder.name=Scala a Pioli
|
||||
tile.CraftingStation.name=Tavolo da Lavoro
|
||||
|
||||
block.glass.pure.name=Vetro Chiaro
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -204,7 +204,7 @@ public class AdvancedDrawbridgeLogic extends InventoryLogic implements IFacingLo
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z) {
|
||||
return new AdvancedDrawbridgeContainer(inventoryplayer, this);
|
||||
@@ -519,14 +519,21 @@ public class AdvancedDrawbridgeLogic extends InventoryLogic implements IFacingLo
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack content) {
|
||||
super.setInventorySlotContents(slot, content);
|
||||
if (slot == 0)
|
||||
if (slot == 0 && worldObj != null)
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged() {
|
||||
super.onInventoryChanged();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
if(worldObj != null){
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit(){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class TProxyClient extends TProxyCommon
|
||||
if (ID == craftingStationID)
|
||||
return new CraftingStationGui(player.inventory, (CraftingStationLogic) world.getBlockTileEntity(x, y, z), x, y, z);
|
||||
if (ID == advDrawbridgeID)
|
||||
return new AdvDrawbridgeGui(player.inventory, (AdvancedDrawbridgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
return new AdvDrawbridgeGui(player, (AdvancedDrawbridgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
|
||||
|
||||
if (ID == manualGuiID)
|
||||
{
|
||||
|
||||
@@ -5,22 +5,26 @@ import java.io.*;
|
||||
import java.util.Iterator;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.blocks.logic.AdvancedDrawbridgeLogic;
|
||||
import tconstruct.inventory.AdvancedDrawbridgeContainer;
|
||||
|
||||
public class AdvDrawbridgeGui extends GuiContainer
|
||||
{
|
||||
public AdvancedDrawbridgeLogic logic;
|
||||
|
||||
public boolean isGuiExpanded = false;
|
||||
public boolean containerNeglectMouse = false;
|
||||
|
||||
public AdvDrawbridgeGui(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic frypan, World world, int x, int y, int z)
|
||||
public AdvDrawbridgeGui(EntityPlayer player, AdvancedDrawbridgeLogic frypan, World world, int x, int y, int z)
|
||||
{
|
||||
super(frypan.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
super(frypan.getGuiContainer(player.inventory, world, x, y, z));
|
||||
this.inventorySlots = new AdvancedDrawbridgeContainer(player.inventory, frypan, this);
|
||||
player.openContainer = this.inventorySlots;
|
||||
logic = frypan;
|
||||
}
|
||||
|
||||
@@ -42,8 +46,15 @@ public class AdvDrawbridgeGui extends GuiContainer
|
||||
if(!isGuiExpanded){
|
||||
drawTexturedModalRect(cornerX + 34, cornerY + 35, 238, 0, 18, 18);
|
||||
}else{
|
||||
drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40);
|
||||
drawTexturedModalRect(cornerX + 173, cornerY + 29, 10, 167, 10, 40);
|
||||
for(int index = 0; index < 16; index++){
|
||||
drawTexturedModalRect(index < 8 ? cornerX + 9 + 20 * index : cornerX + 9 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1), 238, 0, 18, 18);
|
||||
if(index != 15){
|
||||
drawTexturedModalRect(index < 8 ? cornerX + 26 + 20 * index : cornerX + 26 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1) + 6, 253, 18, 3, 5);
|
||||
}
|
||||
}
|
||||
// drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40);
|
||||
// drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40);
|
||||
// drawTexturedModalRect(cornerX + 173, cornerY + 29, 10, 167, 10, 40);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +64,7 @@ public class AdvDrawbridgeGui extends GuiContainer
|
||||
int cornerX = (this.width - this.xSize) / 2;
|
||||
int cornerY = (this.height - this.ySize) / 2;
|
||||
|
||||
this.setExpanded(false);
|
||||
this.buttonList.clear();
|
||||
GuiButton button = new DrawbridgeButton(0, cornerX + 131, cornerY + 18, 176, 0, 21, 22);
|
||||
if (logic.getPlacementDirection() == 0)
|
||||
@@ -80,7 +92,7 @@ public class AdvDrawbridgeGui extends GuiContainer
|
||||
|
||||
public void setExpanded(boolean flag){
|
||||
this.isGuiExpanded = flag;
|
||||
|
||||
this.containerNeglectMouse = true;
|
||||
Iterator<GuiButton> i1 = this.buttonList.iterator();
|
||||
while(i1.hasNext()){
|
||||
GuiButton b = i1.next();
|
||||
@@ -90,6 +102,7 @@ public class AdvDrawbridgeGui extends GuiContainer
|
||||
b.drawButton = !flag;
|
||||
}
|
||||
}
|
||||
((AdvancedDrawbridgeContainer)this.inventorySlots).updateContainerSlots();
|
||||
}
|
||||
|
||||
protected void actionPerformed (GuiButton button)
|
||||
@@ -135,4 +148,10 @@ public class AdvDrawbridgeGui extends GuiContainer
|
||||
|
||||
PacketDispatcher.sendPacketToServer(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen(){
|
||||
super.updateScreen();
|
||||
this.containerNeglectMouse = false;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package tconstruct.inventory;
|
||||
|
||||
import tconstruct.client.gui.AdvDrawbridgeGui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import java.util.Iterator;
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.blocks.logic.*;
|
||||
import tconstruct.blocks.logic.AdvancedDrawbridgeLogic;
|
||||
import tconstruct.client.gui.AdvDrawbridgeGui;
|
||||
|
||||
public class AdvancedDrawbridgeContainer extends Container {
|
||||
public AdvancedDrawbridgeLogic logic;
|
||||
@@ -26,7 +28,7 @@ public class AdvancedDrawbridgeContainer extends Container {
|
||||
public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic, AdvDrawbridgeGui gui) {
|
||||
this.logic = logic;
|
||||
this.gui = gui;
|
||||
|
||||
|
||||
addContainerSlots(logic);
|
||||
bindPlayerInventory(inventoryplayer);
|
||||
updateContainerSlots();
|
||||
@@ -46,9 +48,12 @@ public class AdvancedDrawbridgeContainer extends Container {
|
||||
|
||||
public void addContainerSlots(AdvancedDrawbridgeLogic logic) {
|
||||
this.addSlotToContainer(new SlotOpaqueBlocksOnly(logic.camoInventory, 0, 35, 36));
|
||||
|
||||
for(int i = 0; i < logic.getSizeInventory(); i++){
|
||||
this.addSlotToContainer(new DrawbridgeSlot(logic, i, -2 + 18 * i, 40, logic));
|
||||
|
||||
for (int i = 0; i < logic.getSizeInventory(); i++) {
|
||||
int ind = (int) (Math.floor(i / 8) * 8);
|
||||
int x = i < 8 ? 10 + 20 * i : 10 + 20 * (i - 8);
|
||||
int y = 35 + (int) Math.floor(i / 8) * 18 + (i < 8 ? 0 : 1);
|
||||
this.addSlotToContainer(new DrawbridgeSlot(logic, i, x, y, logic));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +90,45 @@ public class AdvancedDrawbridgeContainer extends Container {
|
||||
}
|
||||
|
||||
public void updateContainerSlots() {
|
||||
if (gui == null || gui.isGuiExpanded) {
|
||||
|
||||
if (gui == null) {
|
||||
return;
|
||||
} else if (gui.isGuiExpanded) {
|
||||
Iterator<Slot> i1 = inventorySlots.iterator();
|
||||
int index = 0;
|
||||
while (i1.hasNext()) {
|
||||
Slot sl = i1.next();
|
||||
if (index == 0) {
|
||||
sl.xDisplayPosition = -1000;
|
||||
sl.yDisplayPosition = -1000;
|
||||
} else if (sl instanceof DrawbridgeSlot) {
|
||||
sl.xDisplayPosition = (index - 1) < 8 ? 10 + 20 * (index - 1) : 10 + 20 * ((index - 1) - 8);
|
||||
sl.yDisplayPosition = 35 + (int) Math.floor((index - 1) / 8) * 18 + ((index - 1) < 8 ? 0 : 1);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
Iterator<Slot> i1 = inventorySlots.iterator();
|
||||
int index = 0;
|
||||
while (i1.hasNext()) {
|
||||
Slot sl = i1.next();
|
||||
if (index == 0) {
|
||||
sl.xDisplayPosition = 35;
|
||||
sl.yDisplayPosition = 36;
|
||||
} else if (sl instanceof DrawbridgeSlot) {
|
||||
sl.xDisplayPosition = -1000;
|
||||
sl.yDisplayPosition = -1000;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer){
|
||||
if(gui != null && gui.containerNeglectMouse){
|
||||
return null;
|
||||
}else{
|
||||
return super.slotClick(par1, par2, par3, par4EntityPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user