[ci skip] Remove extraneous diff added in 1.20.3 update (#10101)

This commit is contained in:
Jake Potrebic 2024-01-02 10:29:53 -08:00 committed by GitHub
parent 983377b55a
commit 58e120b77c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 70 deletions

View file

@ -86,7 +86,7 @@ index 90e1914599b43c8bf813596b3b428d8be3bac1b5..6df0db8b4cdab23494ea34236949ece4
} }
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41cce9222e 100644 index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..415d387f8cfa3ae99b1c809233c86c18b76ad1e2 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -217,7 +217,7 @@ public interface DispenseItemBehavior { @@ -217,7 +217,7 @@ public interface DispenseItemBehavior {
@ -237,13 +237,13 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
} }
if (event.isCancelled()) { if (event.isCancelled()) {
+ // stack.grow(1); // Paper - shrink below (this was actually missing and should be here, added it commented out just for less confusion) + // stack.grow(1); // Paper - shrink below (this was actually missing and should be here, added it commented out to be consistent)
return stack; return stack;
} }
+ boolean shrink = true; // Paper + boolean shrink = true; // Paper
if (!event.getItem().equals(craftItem)) { if (!event.getItem().equals(craftItem)) {
+ shrink = false; // Paper - shrink below (this was actually missing and should be here, added it commented out just for less confusion) + shrink = false; // Paper - shrink below
// Chain to handler for new item // Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@ -333,15 +333,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z)); BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z));
if (!DispenserBlock.eventFired) { if (!DispenserBlock.eventFired) {
@@ -631,6 +641,7 @@ public interface DispenseItemBehavior { @@ -694,7 +704,7 @@ public interface DispenseItemBehavior {
return stack;
}
+ boolean shrink = true; // Paper
if (!event.getItem().equals(craftItem)) {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
@@ -694,7 +705,7 @@ public interface DispenseItemBehavior {
// CraftBukkit start // CraftBukkit start
org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos());
@ -350,17 +342,16 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
if (!DispenserBlock.eventFired) { if (!DispenserBlock.eventFired) {
@@ -752,7 +763,9 @@ public interface DispenseItemBehavior { @@ -741,7 +751,7 @@ public interface DispenseItemBehavior {
return stack;
}
+ boolean shrink = true; // Paper // CraftBukkit start
if (!event.getItem().equals(craftItem)) { org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos());
+ shrink = false; // Paper - shrink below (this was actually missing and should be here, added it commented out just for less confusion) - CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack);
// Chain to handler for new item + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); // Paper - ignore stack size on damageable items
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
@@ -802,7 +815,7 @@ public interface DispenseItemBehavior { if (!DispenserBlock.eventFired) {
@@ -802,7 +812,7 @@ public interface DispenseItemBehavior {
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING)); BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
// CraftBukkit start // CraftBukkit start
org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos());
@ -369,15 +360,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
if (!DispenserBlock.eventFired) { if (!DispenserBlock.eventFired) {
@@ -813,6 +826,7 @@ public interface DispenseItemBehavior { @@ -868,7 +878,7 @@ public interface DispenseItemBehavior {
return stack;
}
+ boolean shrink = true; // Paper
if (!event.getItem().equals(craftItem)) {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
@@ -868,7 +882,7 @@ public interface DispenseItemBehavior {
// CraftBukkit start // CraftBukkit start
// EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null); // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
@ -386,7 +369,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos());
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
@@ -878,12 +892,13 @@ public interface DispenseItemBehavior { @@ -878,12 +888,13 @@ public interface DispenseItemBehavior {
} }
if (event.isCancelled()) { if (event.isCancelled()) {
@ -402,7 +385,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
// Chain to handler for new item // Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@@ -899,7 +914,7 @@ public interface DispenseItemBehavior { @@ -899,7 +910,7 @@ public interface DispenseItemBehavior {
worldserver.addFreshEntity(entitytntprimed); worldserver.addFreshEntity(entitytntprimed);
worldserver.playSound((Player) null, entitytntprimed.getX(), entitytntprimed.getY(), entitytntprimed.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F); worldserver.playSound((Player) null, entitytntprimed.getX(), entitytntprimed.getY(), entitytntprimed.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F);
worldserver.gameEvent((Entity) null, GameEvent.ENTITY_PLACE, blockposition); worldserver.gameEvent((Entity) null, GameEvent.ENTITY_PLACE, blockposition);
@ -411,7 +394,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
return stack; return stack;
} }
}); });
@@ -926,7 +941,7 @@ public interface DispenseItemBehavior { @@ -926,7 +937,7 @@ public interface DispenseItemBehavior {
// CraftBukkit start // CraftBukkit start
org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos());
@ -420,19 +403,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
if (!DispenserBlock.eventFired) { if (!DispenserBlock.eventFired) {
@@ -934,9 +949,11 @@ public interface DispenseItemBehavior { @@ -975,7 +986,7 @@ public interface DispenseItemBehavior {
}
if (event.isCancelled()) {
+ // stack.grow(1); // Paper - shrink below (this was actually missing and should be here, added it commented out just for less confusion)
return stack;
}
+ boolean shrink = true; // Paper
if (!event.getItem().equals(craftItem)) {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
@@ -975,7 +992,7 @@ public interface DispenseItemBehavior {
// CraftBukkit start // CraftBukkit start
org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos());
@ -441,15 +412,7 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
if (!DispenserBlock.eventFired) { if (!DispenserBlock.eventFired) {
@@ -986,6 +1003,7 @@ public interface DispenseItemBehavior { @@ -1048,7 +1059,7 @@ public interface DispenseItemBehavior {
return stack;
}
+ boolean shrink = true; // Paper
if (!event.getItem().equals(craftItem)) {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
@@ -1048,7 +1066,7 @@ public interface DispenseItemBehavior {
// CraftBukkit start // CraftBukkit start
org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos());
@ -458,14 +421,19 @@ index b65d0c2ac5b4f7eb3da85b693c354463c6f49694..dd017c33ff89a516022378160410bc41
BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
if (!DispenserBlock.eventFired) { if (!DispenserBlock.eventFired) {
@@ -1059,6 +1077,7 @@ public interface DispenseItemBehavior { diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
return stack; index e17090003988ad2c890d48666c2234b14d511345..45d356c1ed888b4d749379ceaa8a95d7d7c876d5 100644
} --- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
@@ -37,7 +37,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
ServerLevel worldserver = pointer.level();
// CraftBukkit start
org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos());
- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack);
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); // Paper - ignore stack size on damageable items
+ boolean shrink = true; // Paper BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
if (!event.getItem().equals(craftItem)) { if (!DispenserBlock.eventFired) {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
diff --git a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java diff --git a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java
index f84987c36a16df19286d6f1badfb1ffb9cc7e770..6f2adf2334e35e8a617a4ced0c1af2abf32bbd8d 100644 index f84987c36a16df19286d6f1badfb1ffb9cc7e770..6f2adf2334e35e8a617a4ced0c1af2abf32bbd8d 100644
--- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java --- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Call missing BlockDispenseEvent
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index dd017c33ff89a516022378160410bc41cce9222e..105bb94b844c5ee85b53aca95360e7b2caf374cc 100644 index 415d387f8cfa3ae99b1c809233c86c18b76ad1e2..0286740aabe04e6e78ad6efd003a1e1a1ab6a460 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -1114,6 +1114,13 @@ public interface DispenseItemBehavior { @@ -1106,6 +1106,13 @@ public interface DispenseItemBehavior {
this.setSuccess(true); this.setSuccess(true);
if (iblockdata.is(Blocks.RESPAWN_ANCHOR)) { if (iblockdata.is(Blocks.RESPAWN_ANCHOR)) {
if ((Integer) iblockdata.getValue(RespawnAnchorBlock.CHARGE) != 4) { if ((Integer) iblockdata.getValue(RespawnAnchorBlock.CHARGE) != 4) {
@ -22,7 +22,7 @@ index dd017c33ff89a516022378160410bc41cce9222e..105bb94b844c5ee85b53aca95360e7b2
RespawnAnchorBlock.charge((Entity) null, worldserver, blockposition, iblockdata); RespawnAnchorBlock.charge((Entity) null, worldserver, blockposition, iblockdata);
stack.shrink(1); stack.shrink(1);
} else { } else {
@@ -1136,6 +1143,13 @@ public interface DispenseItemBehavior { @@ -1128,6 +1135,13 @@ public interface DispenseItemBehavior {
Optional<BlockState> optional = HoneycombItem.getWaxed(iblockdata); Optional<BlockState> optional = HoneycombItem.getWaxed(iblockdata);
if (optional.isPresent()) { if (optional.isPresent()) {
@ -36,7 +36,7 @@ index dd017c33ff89a516022378160410bc41cce9222e..105bb94b844c5ee85b53aca95360e7b2
worldserver.setBlockAndUpdate(blockposition, (BlockState) optional.get()); worldserver.setBlockAndUpdate(blockposition, (BlockState) optional.get());
worldserver.levelEvent(3003, blockposition, 0); worldserver.levelEvent(3003, blockposition, 0);
stack.shrink(1); stack.shrink(1);
@@ -1161,6 +1175,12 @@ public interface DispenseItemBehavior { @@ -1153,6 +1167,12 @@ public interface DispenseItemBehavior {
if (!worldserver.getBlockState(blockposition1).is(BlockTags.CONVERTABLE_TO_MUD)) { if (!worldserver.getBlockState(blockposition1).is(BlockTags.CONVERTABLE_TO_MUD)) {
return this.defaultDispenseItemBehavior.dispense(pointer, stack); return this.defaultDispenseItemBehavior.dispense(pointer, stack);
} else { } else {
@ -50,7 +50,7 @@ index dd017c33ff89a516022378160410bc41cce9222e..105bb94b844c5ee85b53aca95360e7b2
for (int k = 0; k < 5; ++k) { for (int k = 0; k < 5; ++k) {
worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D); worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D);
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 864ff2d3c8e2e2bef744e8048ba0cdbb42787268..c62396041c1546f3136ab6de3b174983f49287b3 100644 index d55e1611028a836a34dd85f08c4463f1ec15662e..eeed64faf94e55b247ae13eba67336a48834bba6 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -2098,6 +2098,32 @@ public class CraftEventFactory { @@ -2098,6 +2098,32 @@ public class CraftEventFactory {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Only capture actual tree growth
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index 105bb94b844c5ee85b53aca95360e7b2caf374cc..e6ac20a38f31bb0cd6b8840b2518f6992ef7f518 100644 index 0286740aabe04e6e78ad6efd003a1e1a1ab6a460..f42a86549e389ec53962f7a5e7a625f351cd4724 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -866,6 +866,7 @@ public interface DispenseItemBehavior { @@ -862,6 +862,7 @@ public interface DispenseItemBehavior {
if (!fertilizeEvent.isCancelled()) { if (!fertilizeEvent.isCancelled()) {
for (org.bukkit.block.BlockState blockstate : blocks) { for (org.bukkit.block.BlockState blockstate : blocks) {
blockstate.update(true); blockstate.update(true);