mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
Merge branch 'dev/1.17' of github.com:PaperMC/Paper into dev/1.17
This commit is contained in:
@@ -145,11 +145,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ private static boolean skipPushModeEventFire = false;
|
+ private static boolean skipPushModeEventFire = false;
|
||||||
+ public static boolean skipHopperEvents = false;
|
+ public static boolean skipHopperEvents = false;
|
||||||
+
|
+
|
||||||
+ private static boolean hopperPush(Level level, BlockPos pos, Container iinventory, Direction enumdirection, HopperBlockEntity hopper) {
|
+ private static boolean hopperPush(Level level, BlockPos pos, Container destination, Direction enumdirection, HopperBlockEntity hopper) {
|
||||||
+ skipPushModeEventFire = skipHopperEvents;
|
+ skipPushModeEventFire = skipHopperEvents;
|
||||||
+ boolean foundItem = false;
|
+ boolean foundItem = false;
|
||||||
+ for (int i = 0; i < iinventory.getContainerSize(); ++i) {
|
+ for (int i = 0; i < hopper.getContainerSize(); ++i) {
|
||||||
+ ItemStack item = iinventory.getItem(i);
|
+ ItemStack item = hopper.getItem(i);
|
||||||
+ if (!item.isEmpty()) {
|
+ if (!item.isEmpty()) {
|
||||||
+ foundItem = true;
|
+ foundItem = true;
|
||||||
+ ItemStack origItemStack = item;
|
+ ItemStack origItemStack = item;
|
||||||
@@ -162,13 +162,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // We only need to fire the event once to give protection plugins a chance to cancel this event
|
+ // We only need to fire the event once to give protection plugins a chance to cancel this event
|
||||||
+ // Because nothing uses getItem, every event call should end up the same result.
|
+ // Because nothing uses getItem, every event call should end up the same result.
|
||||||
+ if (!skipPushModeEventFire) {
|
+ if (!skipPushModeEventFire) {
|
||||||
+ itemstack = callPushMoveEvent(iinventory, itemstack, hopper);
|
+ itemstack = callPushMoveEvent(destination, itemstack, hopper);
|
||||||
+ if (itemstack == null) { // cancelled
|
+ if (itemstack == null) { // cancelled
|
||||||
+ origItemStack.setCount(origCount);
|
+ origItemStack.setCount(origCount);
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ final ItemStack itemstack2 = addItem(hopper, iinventory, itemstack, enumdirection);
|
+ final ItemStack itemstack2 = addItem(hopper, destination, itemstack, enumdirection);
|
||||||
+ final int remaining = itemstack2.getCount();
|
+ final int remaining = itemstack2.getCount();
|
||||||
+ if (remaining != moved) {
|
+ if (remaining != moved) {
|
||||||
+ origItemStack = origItemStack.cloneItemStack(true);
|
+ origItemStack = origItemStack.cloneItemStack(true);
|
||||||
@@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ origItemStack.setCount(origCount - moved + remaining);
|
+ origItemStack.setCount(origCount - moved + remaining);
|
||||||
+ }
|
+ }
|
||||||
+ hopper.setItem(i, origItemStack);
|
+ hopper.setItem(i, origItemStack);
|
||||||
+ iinventory.setChanged();
|
+ destination.setChanged();
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ origItemStack.setCount(origCount);
|
+ origItemStack.setCount(origCount);
|
||||||
@@ -300,7 +300,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (HopperBlockEntity.isFullContainer(iinventory1, enumdirection)) {
|
if (HopperBlockEntity.isFullContainer(iinventory1, enumdirection)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
+ return hopperPush(world, blockposition, iinventory, enumdirection, hopper); /* // Paper - disable rest
|
+ return hopperPush(world, blockposition, iinventory1, enumdirection, hopper); /* // Paper - disable rest
|
||||||
for (int i = 0; i < iinventory.getContainerSize(); ++i) {
|
for (int i = 0; i < iinventory.getContainerSize(); ++i) {
|
||||||
if (!iinventory.getItem(i).isEmpty()) {
|
if (!iinventory.getItem(i).isEmpty()) {
|
||||||
ItemStack itemstack = iinventory.getItem(i).copy();
|
ItemStack itemstack = iinventory.getItem(i).copy();
|
||||||
|
Reference in New Issue
Block a user