From 2c1e33c0c83684d60a62ea363f8059baa96eed5c Mon Sep 17 00:00:00 2001 From: Azanor Date: Tue, 2 May 2017 08:50:28 +0200 Subject: [PATCH] fixed item lost on baubles button click --- build.gradle | 2 +- src/main/java/baubles/client/gui/GuiBaublesButton.java | 3 ++- src/main/java/baubles/common/Baubles.java | 3 +-- .../baubles/common/container/ContainerPlayerExpanded.java | 2 ++ .../baubles/common/network/PacketOpenBaublesInventory.java | 5 ++++- src/main/resources/changelog.txt | 4 ++++ 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index de481904..ea90e174 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ buildscript { apply plugin: 'net.minecraftforge.gradle.forge' -version = "1.11-1.4.3" +version = "1.11-1.4.4" group= "com.azanor.baubles" archivesBaseName = "Baubles" diff --git a/src/main/java/baubles/client/gui/GuiBaublesButton.java b/src/main/java/baubles/client/gui/GuiBaublesButton.java index 3867e150..01d2132b 100644 --- a/src/main/java/baubles/client/gui/GuiBaublesButton.java +++ b/src/main/java/baubles/client/gui/GuiBaublesButton.java @@ -7,6 +7,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; public class GuiBaublesButton extends GuiButton { @@ -49,7 +50,7 @@ public void drawButton(Minecraft mc, int xx, int yy) this.drawTexturedModalRect(this.xPosition + potionShift, this.yPosition, 200, 48, 10, 10); } else { this.drawTexturedModalRect(this.xPosition + potionShift, this.yPosition, 210, 48, 10, 10); - this.drawCenteredString(fontrenderer, this.displayString, + this.drawCenteredString(fontrenderer, I18n.format(this.displayString, new Object[0]), this.xPosition + 5 + potionShift, this.yPosition + this.height, 0xffffff); } diff --git a/src/main/java/baubles/common/Baubles.java b/src/main/java/baubles/common/Baubles.java index de354af6..dacb4efa 100644 --- a/src/main/java/baubles/common/Baubles.java +++ b/src/main/java/baubles/common/Baubles.java @@ -28,12 +28,11 @@ name = Baubles.MODNAME, version = Baubles.VERSION, guiFactory = "baubles.client.gui.BaublesGuiFactory") - //dependencies="required-after:Forge@[13.19.0.2180,);") public class Baubles { public static final String MODID = "baubles"; public static final String MODNAME = "Baubles"; - public static final String VERSION = "1.4.3"; + public static final String VERSION = "1.4.4"; @SidedProxy(clientSide = "baubles.client.ClientProxy", serverSide = "baubles.common.CommonProxy") public static CommonProxy proxy; diff --git a/src/main/java/baubles/common/container/ContainerPlayerExpanded.java b/src/main/java/baubles/common/container/ContainerPlayerExpanded.java index b4cf8643..98f87d8b 100644 --- a/src/main/java/baubles/common/container/ContainerPlayerExpanded.java +++ b/src/main/java/baubles/common/container/ContainerPlayerExpanded.java @@ -300,5 +300,7 @@ public boolean canMergeSlot(ItemStack stack, Slot slot) { return slot.inventory != this.craftResult && super.canMergeSlot(stack, slot); } + + } diff --git a/src/main/java/baubles/common/network/PacketOpenBaublesInventory.java b/src/main/java/baubles/common/network/PacketOpenBaublesInventory.java index fa21c782..9e1cbe4f 100644 --- a/src/main/java/baubles/common/network/PacketOpenBaublesInventory.java +++ b/src/main/java/baubles/common/network/PacketOpenBaublesInventory.java @@ -3,6 +3,8 @@ import baubles.common.Baubles; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.util.IThreadListener; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; @@ -24,7 +26,8 @@ public void fromBytes(ByteBuf buffer) {} @Override public IMessage onMessage(PacketOpenBaublesInventory message, MessageContext ctx) { IThreadListener mainThread = (WorldServer) ctx.getServerHandler().playerEntity.world; - mainThread.addScheduledTask(new Runnable(){ public void run() { + mainThread.addScheduledTask(new Runnable(){ public void run() { + ctx.getServerHandler().playerEntity.openContainer.onContainerClosed(ctx.getServerHandler().playerEntity); ctx.getServerHandler().playerEntity.openGui(Baubles.instance, Baubles.GUI, ctx.getServerHandler().playerEntity.world, (int)ctx.getServerHandler().playerEntity.posX, (int)ctx.getServerHandler().playerEntity.posY, (int)ctx.getServerHandler().playerEntity.posZ); }}); return null; diff --git a/src/main/resources/changelog.txt b/src/main/resources/changelog.txt index 2e5a8dda..36637aad 100644 --- a/src/main/resources/changelog.txt +++ b/src/main/resources/changelog.txt @@ -1,3 +1,7 @@ +1.4.4 +- item on cursor will no longer be lost if you click on the baubles ring button +- fixed baubles button display text + 1.4.3 - added player references to capabilities container and added checks for item validity.