Don't require FACING data

This commit is contained in:
Mariell Hoversholm 2020-08-23 19:01:04 +02:00
parent a7e8ccc630
commit 17cde37876

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
+++ b/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
@@ -6,11 +6,25 @@
@@ -6,47 +6,114 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock;
@ -12,6 +12,7 @@
+// CraftBukkit end
public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
+ private Direction enumdirection; // Paper - cache facing direction
private static final int DEFAULT_ACCURACY = 6;
@ -26,7 +27,19 @@
public DefaultDispenseItemBehavior() {}
@Override
@@ -27,26 +41,77 @@
public final ItemStack dispense(BlockSource pointer, ItemStack stack) {
+ enumdirection = pointer.state().getValue(DispenserBlock.FACING); // Paper - cache facing direction
ItemStack itemstack1 = this.execute(pointer, stack);
this.playSound(pointer);
- this.playAnimation(pointer, (Direction) pointer.state().getValue(DispenserBlock.FACING));
+ this.playAnimation(pointer, enumdirection); // Paper - cache facing direction
return itemstack1;
}
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
- Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING);
+ // Paper - cached enum direction
Position iposition = DispenserBlock.getDispensePosition(pointer);
ItemStack itemstack1 = stack.split(1);