Fix up block drops for skulls and cocoa
This commit is contained in:
parent
d8dda4c2fd
commit
aca35c7571
2 changed files with 126 additions and 0 deletions
50
patches/minecraft/net/minecraft/block/BlockCocoa.java.patch
Normal file
50
patches/minecraft/net/minecraft/block/BlockCocoa.java.patch
Normal file
|
@ -0,0 +1,50 @@
|
|||
--- ../src_base/minecraft/net/minecraft/block/BlockCocoa.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockCocoa.java
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
@@ -172,7 +174,14 @@
|
||||
*/
|
||||
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
|
||||
{
|
||||
- int var8 = func_72219_c(par5);
|
||||
+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> dropped = super.getBlockDropped(world, x, y, z, metadata, fortune);
|
||||
+ int var8 = func_72219_c(metadata);
|
||||
byte var9 = 1;
|
||||
|
||||
if (var8 >= 2)
|
||||
@@ -182,8 +191,9 @@
|
||||
|
||||
for (int var10 = 0; var10 < var9; ++var10)
|
||||
{
|
||||
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.dyePowder, 1, 3));
|
||||
- }
|
||||
+ dropped.add(new ItemStack(Item.dyePowder, 1, 3));
|
||||
+ }
|
||||
+ return dropped;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -203,4 +213,10 @@
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public int idDropped(int par1, Random par2Random, int par3)
|
||||
+ {
|
||||
+ return 0;
|
||||
+ }
|
||||
}
|
76
patches/minecraft/net/minecraft/block/BlockSkull.java.patch
Normal file
76
patches/minecraft/net/minecraft/block/BlockSkull.java.patch
Normal file
|
@ -0,0 +1,76 @@
|
|||
--- ../src_base/minecraft/net/minecraft/block/BlockSkull.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockSkull.java
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
@@ -133,11 +135,6 @@
|
||||
}
|
||||
|
||||
/**
|
||||
- * Drops the block items with a specified chance of dropping the specified items
|
||||
- */
|
||||
- public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) {}
|
||||
-
|
||||
- /**
|
||||
* Called when the block is attempted to be harvested
|
||||
*/
|
||||
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer)
|
||||
@@ -156,26 +153,32 @@
|
||||
*/
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
- if (!par1World.isRemote)
|
||||
- {
|
||||
- if ((par6 & 8) == 0)
|
||||
- {
|
||||
- ItemStack var7 = new ItemStack(Item.skull.shiftedIndex, 1, this.getDamageValue(par1World, par2, par3, par4));
|
||||
- TileEntitySkull var8 = (TileEntitySkull)par1World.getBlockTileEntity(par2, par3, par4);
|
||||
-
|
||||
- if (var8.func_82117_a() == 3 && var8.func_82120_c() != null && var8.func_82120_c().length() > 0)
|
||||
- {
|
||||
- var7.setTagCompound(new NBTTagCompound());
|
||||
- var7.getTagCompound().setString("SkullOwner", var8.func_82120_c());
|
||||
- }
|
||||
-
|
||||
- this.dropBlockAsItem_do(par1World, par2, par3, par4, var7);
|
||||
- }
|
||||
-
|
||||
- super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ dropBlockAsItem(par1World, par2, par3, par4, par5, par6);
|
||||
+ super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
+ if ((metadata & 8) == 0)
|
||||
+ {
|
||||
+ ItemStack var7 = new ItemStack(Item.skull.shiftedIndex, 1, this.getDamageValue(world, x, y, z));
|
||||
+ TileEntitySkull var8 = (TileEntitySkull)world.getBlockTileEntity(x, y, z);
|
||||
+
|
||||
+ if (var8 == null)
|
||||
+ {
|
||||
+ return drops;
|
||||
+ }
|
||||
+ if (var8.func_82117_a() == 3 && var8.func_82120_c() != null && var8.func_82120_c().length() > 0)
|
||||
+ {
|
||||
+ var7.setTagCompound(new NBTTagCompound());
|
||||
+ var7.getTagCompound().setString("SkullOwner", var8.func_82120_c());
|
||||
+ }
|
||||
+ drops.add(var7);
|
||||
+ }
|
||||
+ return drops;
|
||||
+ }
|
||||
/**
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
Loading…
Reference in a new issue