mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
[Bleeding] Return correct drops for Cocoa blocks. Fixes BUKKIT-5159
For Cocoa Blocks, Block.getDropType() returns the item form of the Cocoa block, rather than the Cocoa Bean item. Because of this, Cocoa blocks need to have explicit handling in order to return the proper drop contents.
This commit is contained in:
parent
1ff8132bdd
commit
a565486ee1
1 changed files with 7 additions and 0 deletions
|
@ -6,6 +6,7 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.server.BiomeBase;
|
import net.minecraft.server.BiomeBase;
|
||||||
|
import net.minecraft.server.BlockCocoa;
|
||||||
import net.minecraft.server.BlockRedstoneWire;
|
import net.minecraft.server.BlockRedstoneWire;
|
||||||
import net.minecraft.server.Blocks;
|
import net.minecraft.server.Blocks;
|
||||||
import net.minecraft.server.EnumSkyBlock;
|
import net.minecraft.server.EnumSkyBlock;
|
||||||
|
@ -428,6 +429,12 @@ public class CraftBlock implements Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
drops.add(CraftItemStack.asBukkitCopy(nmsStack));
|
drops.add(CraftItemStack.asBukkitCopy(nmsStack));
|
||||||
|
// We don't want to drop cocoa blocks, we want to drop cocoa beans.
|
||||||
|
} else if (Blocks.COCOA == block) {
|
||||||
|
int dropAmount = (BlockCocoa.c(data) >= 2 ? 3 : 1);
|
||||||
|
for (int j = 0; j < dropAmount; ++j) {
|
||||||
|
drops.add(new ItemStack(Material.INK_SACK, 1, (short) 3));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1, (short) block.getDropData(data)));
|
drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1, (short) block.getDropData(data)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue