From 97ebb51fc9006ad139ec2de4deb3a6ff5a66f879 Mon Sep 17 00:00:00 2001 From: Azanor Date: Mon, 24 Nov 2014 09:48:32 +0200 Subject: [PATCH] 1.0.1.9 updates fix for drop on death issue. Closes #81 --- build.gradle | 4 ++-- src/main/java/baubles/common/Baubles.java | 4 ++-- .../common/container/InventoryBaubles.java | 21 ++++++++++++++++++- .../common/event/EventHandlerEntity.java | 4 ++-- src/main/resources/changelog.txt | 4 ++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index f5b7064..7e3e94a 100644 --- a/build.gradle +++ b/build.gradle @@ -17,12 +17,12 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.0.1.8" +version = "1.7.10-1.0.1.9" group= "com.azanor.baubles" archivesBaseName = "Baubles" minecraft { - version = "1.7.10-10.13.0.1177" + version = "1.7.10-10.13.2.1236" assetDir = "eclipse/assets" } diff --git a/src/main/java/baubles/common/Baubles.java b/src/main/java/baubles/common/Baubles.java index ad27b94..d38c2d7 100644 --- a/src/main/java/baubles/common/Baubles.java +++ b/src/main/java/baubles/common/Baubles.java @@ -20,13 +20,13 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; -@Mod(modid = Baubles.MODID, name = Baubles.MODNAME, version = Baubles.VERSION, dependencies="required-after:Forge@[10.13.0.1177,);") +@Mod(modid = Baubles.MODID, name = Baubles.MODNAME, version = Baubles.VERSION, dependencies="required-after:Forge@[10.13.2,);") public class Baubles { public static final String MODID = "Baubles"; public static final String MODNAME = "Baubles"; - public static final String VERSION = "1.0.1.8"; + public static final String VERSION = "1.0.1.9"; @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 a5b7143..1995ac7 100644 --- a/src/main/java/baubles/common/container/InventoryBaubles.java +++ b/src/main/java/baubles/common/container/InventoryBaubles.java @@ -3,6 +3,7 @@ package baubles.common.container; import java.lang.ref.WeakReference; import java.util.ArrayList; +import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -14,7 +15,6 @@ import net.minecraft.util.MathHelper; import baubles.api.BaubleType; import baubles.api.IBauble; import baubles.common.Baubles; -import baubles.common.lib.PlayerHandler; import baubles.common.network.PacketHandler; import baubles.common.network.PacketSyncBauble; @@ -267,6 +267,25 @@ public class InventoryBaubles implements IInventory { } } } + + public void dropItemsAt(ArrayList drops, Entity e) { + for (int i = 0; i < 4; ++i) { + if (this.stackList[i] != null) { + EntityItem ei = new EntityItem(e.worldObj, + e.posX, e.posY + e.getEyeHeight(), e.posZ, + this.stackList[i].copy()); + ei.delayBeforeCanPickup = 40; + float f1 = e.worldObj.rand.nextFloat() * 0.5F; + float f2 = e.worldObj.rand.nextFloat() * (float) Math.PI * 2.0F; + ei.motionX = (double) (-MathHelper.sin(f2) * f1); + ei.motionZ = (double) (MathHelper.cos(f2) * f1); + ei.motionY = 0.20000000298023224D; + drops.add(ei); + this.stackList[i] = null; + syncSlotToClients(i); + } + } + } public void syncSlotToClients(int slot) { try { diff --git a/src/main/java/baubles/common/event/EventHandlerEntity.java b/src/main/java/baubles/common/event/EventHandlerEntity.java index f5fb4a3..2484fec 100644 --- a/src/main/java/baubles/common/event/EventHandlerEntity.java +++ b/src/main/java/baubles/common/event/EventHandlerEntity.java @@ -43,8 +43,8 @@ public class EventHandlerEntity { && !event.entity.worldObj.isRemote && !event.entity.worldObj.getGameRules() .getGameRuleBooleanValue("keepInventory")) { - PlayerHandler.getPlayerBaubles(event.entityPlayer).dropItems( - event.drops); + PlayerHandler.getPlayerBaubles(event.entityPlayer).dropItemsAt( + event.drops,event.entityPlayer); } } diff --git a/src/main/resources/changelog.txt b/src/main/resources/changelog.txt index b98e986..75bc3cc 100644 --- a/src/main/resources/changelog.txt +++ b/src/main/resources/changelog.txt @@ -1,3 +1,7 @@ +1.0.1.9 +- Update to Forge 10.13.2+ +- possible fix for baubles dropping near player spawn location instead of at where he died. + 1.0.1.8 - change save filenames back to using username instead of UUID to prevent issues in offline mode. - saves will break if you change your username, but it is the lesser of two evils imo and easy enough to fix by hand