mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Prevent ContainerOpenersCounter openCount from going negative
This commit is contained in:
parent
0919b52439
commit
c472c71eca
@ -45,11 +45,12 @@
|
|||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
this.onOpen(world, pos, state);
|
this.onOpen(world, pos, state);
|
||||||
world.gameEvent((Entity) player, (Holder) GameEvent.CONTAINER_OPEN, pos);
|
world.gameEvent((Entity) player, (Holder) GameEvent.CONTAINER_OPEN, pos);
|
||||||
@@ -42,8 +68,19 @@
|
@@ -42,8 +68,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decrementOpeners(Player player, Level world, BlockPos pos, BlockState state) {
|
public void decrementOpeners(Player player, Level world, BlockPos pos, BlockState state) {
|
||||||
+ int oldPower = Math.max(0, Math.min(15, this.openCount)); // CraftBukkit - Get power before new viewer is added
|
+ int oldPower = Math.max(0, Math.min(15, this.openCount)); // CraftBukkit - Get power before new viewer is added
|
||||||
|
+ if (this.openCount == 0) return; // Paper - Prevent ContainerOpenersCounter openCount from going negative
|
||||||
int i = this.openCount--;
|
int i = this.openCount--;
|
||||||
|
|
||||||
+ // CraftBukkit start - Call redstone event
|
+ // CraftBukkit start - Call redstone event
|
||||||
@ -65,7 +66,7 @@
|
|||||||
if (this.openCount == 0) {
|
if (this.openCount == 0) {
|
||||||
this.onClose(world, pos, state);
|
this.onClose(world, pos, state);
|
||||||
world.gameEvent((Entity) player, (Holder) GameEvent.CONTAINER_CLOSE, pos);
|
world.gameEvent((Entity) player, (Holder) GameEvent.CONTAINER_CLOSE, pos);
|
||||||
@@ -72,6 +109,7 @@
|
@@ -72,6 +110,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = list.size();
|
int i = list.size();
|
||||||
|
Loading…
Reference in New Issue
Block a user