diff --git a/patches/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/net/minecraft/entity/player/InventoryPlayer.java.patch index 11ad63a..8be8a33 100644 --- a/patches/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -2,7 +2,9 @@ +@@ -2,10 +2,13 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -10,21 +10,28 @@ import net.minecraft.block.Block; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; -@@ -13,7 +15,13 @@ ++import net.minecraft.entity.item.EntityItem; + import net.minecraft.inventory.IInventory; + import net.minecraft.item.Item; + import net.minecraft.item.ItemArmor; +@@ -13,7 +16,16 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.ReportedException; ++import net.minecraftforge.common.util.EntitySnapshot; + +// CraftBukkit start +import java.util.List; - ++ +import org.bukkit.craftbukkit.entity.CraftHumanEntity; +import org.bukkit.entity.HumanEntity; +// CraftBukkit end ++import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; + public class InventoryPlayer implements IInventory { public ItemStack[] mainInventory = new ItemStack[36]; -@@ -25,7 +33,46 @@ +@@ -25,7 +37,46 @@ private ItemStack itemStack; public boolean inventoryChanged; private static final String __OBFID = "CL_00001709"; @@ -71,7 +78,7 @@ public InventoryPlayer(EntityPlayer p_i1750_1_) { this.player = p_i1750_1_; -@@ -81,6 +128,34 @@ +@@ -81,6 +132,34 @@ return -1; } @@ -106,7 +113,18 @@ public int getFirstEmptyStack() { for (int i = 0; i < this.mainInventory.length; ++i) -@@ -430,25 +505,24 @@ +@@ -350,6 +429,10 @@ + { + if (p_70441_1_ != null && p_70441_1_.stackSize != 0 && p_70441_1_.getItem() != null) + { ++ if(player.worldObj.captureBlockSnapshots){ ++ player.worldObj.capturedItems.add(ItemStack.copyItemStack(p_70441_1_)); ++ return true; ++ } + try + { + int i; +@@ -430,25 +513,24 @@ if (aitemstack[p_70298_1_] != null) { @@ -140,7 +158,7 @@ } else { -@@ -658,7 +732,7 @@ +@@ -658,7 +740,7 @@ if (this.mainInventory[i] != null) { this.player.func_146097_a(this.mainInventory[i], true, false); @@ -149,7 +167,7 @@ } } -@@ -667,7 +741,7 @@ +@@ -667,7 +749,7 @@ if (this.armorInventory[i] != null) { this.player.func_146097_a(this.armorInventory[i], true, false); diff --git a/patches/net/minecraft/world/World.java.patch b/patches/net/minecraft/world/World.java.patch index 46c70a5..53e08c9 100644 --- a/patches/net/minecraft/world/World.java.patch +++ b/patches/net/minecraft/world/World.java.patch @@ -152,7 +152,6 @@ int[] lightUpdateBlockList; + // Cauldron start + public boolean captureTreeGeneration = false; -+ public ArrayList capturedItems = new ArrayList(); + public int entitiesTicked; + public int tilesTicked; + public CauldronWorldConfig cauldronConfig; @@ -209,7 +208,8 @@ public boolean restoringBlockSnapshots = false; public boolean captureBlockSnapshots = false; public ArrayList capturedBlockSnapshots = new ArrayList(); -+ public ArrayList capturedEntityItemSnapshots=new ArrayList(); ++ public ArrayList capturedEntitySnapshots=new ArrayList(); ++ public ArrayList capturedItems=new ArrayList(); public BiomeGenBase getBiomeGenForCoords(final int p_72807_1_, final int p_72807_2_) { @@ -631,7 +631,7 @@ + if(p_72838_1_ instanceof net.minecraft.entity.item.EntityItem&&this.restoringBlockSnapshots) + return false; + if(this.captureBlockSnapshots&&!(p_72838_1_ instanceof EntityPlayerMP)){ -+ this.capturedEntityItemSnapshots.add(new net.minecraftforge.common.util.EntitySnapshot(this,p_72838_1_,spawnReason)); ++ this.capturedEntitySnapshots.add(new net.minecraftforge.common.util.EntitySnapshot(this,p_72838_1_,spawnReason)); + return true; + } + } diff --git a/patches/net/minecraftforge/common/ForgeHooks.java.patch b/patches/net/minecraftforge/common/ForgeHooks.java.patch index 24af66c..434fd5e 100644 --- a/patches/net/minecraftforge/common/ForgeHooks.java.patch +++ b/patches/net/minecraftforge/common/ForgeHooks.java.patch @@ -65,7 +65,7 @@ { // Let the client know the block still exists entityPlayer.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); -@@ -500,81 +514,144 @@ +@@ -500,81 +514,157 @@ if (!(itemstack.getItem() instanceof ItemBucket)) // if not bucket { world.captureBlockSnapshots = true; @@ -169,8 +169,10 @@ + List blockSnapshots = (List) world.capturedBlockSnapshots + .clone(); + world.capturedBlockSnapshots.clear(); -+ List tDropItemSnapshots=(List)world.capturedEntityItemSnapshots.clone(); -+ world.capturedEntityItemSnapshots.clear(); ++ List tDropItemSnapshots=(List)world.capturedEntitySnapshots.clone(); ++ world.capturedEntitySnapshots.clear(); ++ List tCaptureItems=(List)world.capturedItems.clone(); ++ world.capturedItems.clear(); + + // make sure to set pre-placement item data for event + itemstack.setItemDamage(meta); @@ -247,6 +249,17 @@ + for(net.minecraftforge.common.util.EntitySnapshot sEntityItem : tDropItemSnapshots){ + sEntityItem.apply(); + } ++ if(!tCaptureItems.isEmpty()){ ++ boolean tAdded=false; ++ for(ItemStack sItem : tCaptureItems){ ++ if(!player.inventory.addItemStackToInventory(sItem)){ ++ world.spawnEntityInWorld(new EntityItem(world,player.posX,player.posY,player.posZ,sItem)); ++ }else{ ++ tAdded=true; ++ } ++ } ++ if(tAdded) player.openContainer.detectAndSendChanges(); ++ } + player.addStat(StatList.objectUseStats[Item.getIdFromItem(itemstack.getItem())], 1); } - player.addStat(StatList.objectUseStats[Item.getIdFromItem(itemstack.getItem())], 1);