mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 22:44:32 +00:00
This commit is contained in:
1 parent
a8734e368d
commit
72f037b0fa
13 files changed
+77
-100
No files matched your search
@@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_)
|
||||
@@ -568,20 +565,17 @@
|
||||
@@ -568,20 +565,16 @@
|
||||
|
||||
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
|
||||
{
|
||||
@@ -99,12 +99,11 @@
|
||||
+ if (!p_180653_1_.field_72995_K && !p_180653_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
|
||||
{
|
||||
- int i = this.func_149679_a(p_180653_5_, p_180653_1_.field_73012_v);
|
||||
+ List<ItemStack> items = NonNullList.func_191196_a();
|
||||
+ items.addAll(getDrops(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_));
|
||||
+ p_180653_4_ = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_, p_180653_4_, false, harvesters.get());
|
||||
+ List<ItemStack> drops = getDrops(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_); // use the old method until it gets removed, for backward compatibility
|
||||
+ p_180653_4_ = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(drops, p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_, p_180653_4_, false, harvesters.get());
|
||||
|
||||
- for (int j = 0; j < i; ++j)
|
||||
+ for (ItemStack item : items)
|
||||
+ for (ItemStack drop : drops)
|
||||
{
|
||||
if (p_180653_1_.field_73012_v.nextFloat() <= p_180653_4_)
|
||||
{
|
||||
@@ -114,11 +113,11 @@
|
||||
- {
|
||||
- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item, 1, this.func_180651_a(p_180653_3_)));
|
||||
- }
|
||||
+ func_180635_a(p_180653_1_, p_180653_2_, item);
|
||||
+ func_180635_a(p_180653_1_, p_180653_2_, drop);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -589,8 +583,13 @@
|
||||
@@ -589,8 +582,13 @@
|
||||
|
||||
public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_)
|
||||
{
|
||||
@@ -133,7 +132,7 @@
|
||||
float f = 0.5F;
|
||||
double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
|
||||
double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
|
||||
@@ -619,6 +618,7 @@
|
||||
@@ -619,6 +617,7 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -141,7 +140,7 @@
|
||||
public float func_149638_a(Entity p_149638_1_)
|
||||
{
|
||||
return this.field_149781_w / 5.0F;
|
||||
@@ -657,7 +657,7 @@
|
||||
@@ -657,7 +656,7 @@
|
||||
|
||||
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
|
||||
{
|
||||
@@ -150,7 +149,7 @@
|
||||
}
|
||||
|
||||
public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumHand p_180639_5_, EnumFacing p_180639_6_, float p_180639_7_, float p_180639_8_, float p_180639_9_)
|
||||
@@ -669,6 +669,8 @@
|
||||
@@ -669,6 +668,8 @@
|
||||
{
|
||||
}
|
||||
|
||||
@@ -159,7 +158,7 @@
|
||||
public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_)
|
||||
{
|
||||
return this.func_176203_a(p_180642_7_);
|
||||
@@ -710,21 +712,35 @@
|
||||
@@ -710,21 +711,35 @@
|
||||
p_180657_2_.func_71029_a(StatList.func_188055_a(this));
|
||||
p_180657_2_.func_71020_j(0.005F);
|
||||
|
||||
@@ -198,7 +197,7 @@
|
||||
}
|
||||
|
||||
protected ItemStack func_180643_i(IBlockState p_180643_1_)
|
||||
@@ -810,6 +826,7 @@
|
||||
@@ -810,6 +825,7 @@
|
||||
p_176216_2_.field_70181_x = 0.0D;
|
||||
}
|
||||
|
||||
@@ -206,7 +205,7 @@
|
||||
public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_)
|
||||
{
|
||||
return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_));
|
||||
@@ -921,6 +938,7 @@
|
||||
@@ -921,6 +937,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +213,7 @@
|
||||
public SoundType func_185467_w()
|
||||
{
|
||||
return this.field_149762_H;
|
||||
@@ -936,6 +954,1216 @@
|
||||
@@ -936,6 +953,1218 @@
|
||||
{
|
||||
}
|
||||
|
||||
@@ -525,30 +524,38 @@
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * This returns a complete list of items dropped from this block.
|
||||
+ * @deprecated use {@link #getDrops(NonNullList, IBlockAccess, BlockPos, IBlockState, int)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
+ {
|
||||
+ NonNullList<ItemStack> ret = NonNullList.func_191196_a();
|
||||
+ getDrops(ret, world, pos, state, fortune);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * This gets a complete list of items dropped from this block.
|
||||
+ *
|
||||
+ * @param drops add all items this block drops to this drops list
|
||||
+ * @param world The current world
|
||||
+ * @param pos Block position in world
|
||||
+ * @param state Current state
|
||||
+ * @param fortune Breakers fortune level
|
||||
+ * @return A ArrayList containing all items this block drops
|
||||
+ */
|
||||
+ public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
+ public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
+ {
|
||||
+ List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
|
||||
+
|
||||
+ Random rand = world instanceof World ? ((World)world).field_73012_v : RANDOM;
|
||||
+
|
||||
+ int count = quantityDropped(state, fortune, rand);
|
||||
+ for(int i = 0; i < count; i++)
|
||||
+ for (int i = 0; i < count; i++)
|
||||
+ {
|
||||
+ Item item = this.func_180660_a(state, rand, fortune);
|
||||
+ if (item != Items.field_190931_a)
|
||||
+ {
|
||||
+ ret.add(new ItemStack(item, 1, this.func_180651_a(state)));
|
||||
+ drops.add(new ItemStack(item, 1, this.func_180651_a(state)));
|
||||
+ }
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -1335,21 +1342,15 @@
|
||||
+ return func_180664_k() == layer;
|
||||
+ }
|
||||
+ // For Internal use only to capture droped items inside getDrops
|
||||
+ protected static ThreadLocal<Boolean> captureDrops = new ThreadLocal<Boolean>()
|
||||
+ {
|
||||
+ @Override protected Boolean initialValue() { return false; }
|
||||
+ };
|
||||
+ protected static ThreadLocal<List<ItemStack>> capturedDrops = new ThreadLocal<List<ItemStack>>()
|
||||
+ {
|
||||
+ @Override protected List<ItemStack> initialValue() { return new java.util.ArrayList<ItemStack>(); }
|
||||
+ };
|
||||
+ protected List<ItemStack> captureDrops(boolean start)
|
||||
+ protected static ThreadLocal<Boolean> captureDrops = ThreadLocal.withInitial(() -> false);
|
||||
+ protected static ThreadLocal<NonNullList<ItemStack>> capturedDrops = ThreadLocal.withInitial(NonNullList::func_191196_a);
|
||||
+ protected NonNullList<ItemStack> captureDrops(boolean start)
|
||||
+ {
|
||||
+ if (start)
|
||||
+ {
|
||||
+ captureDrops.set(true);
|
||||
+ capturedDrops.get().clear();
|
||||
+ return java.util.Collections.emptyList();
|
||||
+ return NonNullList.func_191196_a();
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
@@ -1431,7 +1432,7 @@
|
||||
public static void func_149671_p()
|
||||
{
|
||||
func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air"));
|
||||
@@ -1247,14 +2475,7 @@
|
||||
@@ -1247,14 +2476,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user