From 5d7c4825e5c1875ac92f29d70cfe9ee887e2df09 Mon Sep 17 00:00:00 2001 From: Azanor Date: Fri, 4 Apr 2014 10:01:04 +0200 Subject: [PATCH] allow other mods to force a save by marking the inventory as dirty --- build.gradle | 2 +- src/main/java/baubles/common/Baubles.java | 2 +- .../java/baubles/common/container/InventoryBaubles.java | 7 ++++++- src/main/resources/changelog.txt | 3 +++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index b89071f..aa5bb95 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.2-1.0.0.3" +version = "1.7.2-1.0.0.4" group= "com.azanor.baubles" archivesBaseName = "Baubles" diff --git a/src/main/java/baubles/common/Baubles.java b/src/main/java/baubles/common/Baubles.java index 6e41e3b..8854616 100644 --- a/src/main/java/baubles/common/Baubles.java +++ b/src/main/java/baubles/common/Baubles.java @@ -26,7 +26,7 @@ public class Baubles { public static final String MODID = "Baubles"; public static final String MODNAME = "Baubles"; - public static final String VERSION = "1.0.0.3"; + public static final String VERSION = "1.0.0.4"; @SidedProxy(clientSide = "baubles.client.ClientProxy", serverSide = "baubles.common.CommonProxy") public static CommonProxy proxy; diff --git a/src/main/java/baubles/common/container/InventoryBaubles.java b/src/main/java/baubles/common/container/InventoryBaubles.java index 22c65c8..37be973 100644 --- a/src/main/java/baubles/common/container/InventoryBaubles.java +++ b/src/main/java/baubles/common/container/InventoryBaubles.java @@ -10,6 +10,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import baubles.api.BaubleType; import baubles.api.IBauble; +import baubles.common.lib.PlayerHandler; public class InventoryBaubles implements IInventory { public ItemStack[] stackList; @@ -140,7 +141,11 @@ public class InventoryBaubles implements IInventory { * to disk later - the game won't think it hasn't changed and skip it. */ @Override - public void markDirty() { } + public void markDirty() { + try { + PlayerHandler.updatePlayerBaubles(player.get()); + } catch (Exception e) { } + } /** * Do not make give this method the name canInteractWith because it clashes diff --git a/src/main/resources/changelog.txt b/src/main/resources/changelog.txt index 2ebdb37..f504d03 100644 --- a/src/main/resources/changelog.txt +++ b/src/main/resources/changelog.txt @@ -1,3 +1,6 @@ +1.0.0.4 +- allow other mods to force a save by marking the inventory as dirty + 1.0.0.3 - example ring can now be rightclicked like armor to equip it