Skip to content

Commit c2c4724

Browse files
committed
readd wrongly dropped diff
1 parent 3bf9976 commit c2c4724

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

paper-server/patches/sources/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch

+21-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
blockSource.level().gameEvent(null, GameEvent.ENTITY_PLACE, blockSource.pos());
4949
return item;
5050
}
51-
@@ -110,8 +_,20 @@
51+
@@ -110,12 +_,38 @@
5252
Direction direction = blockSource.state().getValue(DispenserBlock.FACING);
5353
BlockPos blockPos = blockSource.pos().relative(direction);
5454
ServerLevel serverLevel = blockSource.level();
@@ -63,13 +63,32 @@
6363
+ if (event.isCancelled()) {
6464
+ return item;
6565
+ }
66+
+
67+
+ boolean shrink = true;
68+
+ if (!event.getItem().equals(craftItem)) {
69+
+ shrink = false;
70+
+ // Chain to handler for new item
71+
+ ItemStack eventStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getItem());
72+
+ DispenseItemBehavior dispenseBehavior = DispenserBlock.getDispenseBehavior(blockSource, eventStack);
73+
+ if (dispenseBehavior != DispenseItemBehavior.NOOP && dispenseBehavior != this) {
74+
+ dispenseBehavior.dispense(blockSource, eventStack);
75+
+ return item;
76+
+ }
77+
+ }
78+
+ // CraftBukkit end
79+
+
6680
+ final ItemStack newStack = org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getItem()); // Paper - use event itemstack (unwrap is fine here because the stack won't be modified)
6781
Consumer<ArmorStand> consumer = EntityType.appendDefaultStackConfig(
6882
- armorStand1 -> armorStand1.setYRot(direction.toYRot()), serverLevel, item, null
6983
+ armorStand1 -> armorStand1.setYRot(direction.toYRot()), serverLevel, newStack, null // Paper - track changed items in the dispense event
7084
);
7185
ArmorStand armorStand = EntityType.ARMOR_STAND.spawn(serverLevel, consumer, blockPos, EntitySpawnReason.DISPENSER, false, false);
7286
if (armorStand != null) {
87+
- item.shrink(1);
88+
+ if (shrink) item.shrink(1); // Paper
89+
}
90+
91+
return item;
7392
@@ -135,8 +_,35 @@
7493
new AABB(blockPos),
7594
abstractChestedHorse1 -> abstractChestedHorse1.isAlive() && !abstractChestedHorse1.hasChest()
@@ -289,7 +308,7 @@
289308
- serverLevel.gameEvent(null, GameEvent.ENTITY_PLACE, blockPos);
290309
- item.shrink(1);
291310
+ serverLevel.gameEvent(null, GameEvent.ENTITY_PLACE, org.bukkit.craftbukkit.util.CraftVector.toBlockPos(event.getVelocity())); // Paper - update game event position
292-
+ if (shrink) item.shrink(1);
311+
+ if (shrink) item.shrink(1); // Paper
293312
this.setSuccess(true);
294313
return item;
295314
}

paper-server/patches/sources/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
+
4141
+ // SPIGOT-7923: Avoid create projectiles with empty item
4242
+ if (!singleItemStack.isEmpty()) {
43-
+ Projectile iprojectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(serverLevel, dispensePosition, org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getItem()), direction), serverLevel, singleItemStack, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); // Paper - track changed items in the dispense event; unwrap is safe here because all uses of the stack make their own copies
44-
+ iprojectile.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(blockSource.blockEntity());
43+
+ Projectile projectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(serverLevel, dispensePosition, org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getItem()), direction), serverLevel, singleItemStack, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); // Paper - track changed items in the dispense event; unwrap is safe here because all uses of the stack make their own copies
44+
+ projectile.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(blockSource.blockEntity());
4545
+ }
4646
+ if (shrink) item.shrink(1);
4747
+ // CraftBukkit end

paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch

+4-7
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
this.serverTextFilter = ServerTextFilter.createFromConfig(settings.getProperties());
3434
this.serverLinks = createServerLinks(settings);
3535
}
36-
@@ -102,26 +_,53 @@
36+
@@ -102,6 +_,10 @@
3737
Thread thread = new Thread("Server console handler") {
3838
@Override
3939
public void run() {
@@ -42,16 +42,13 @@
4242
+ new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start();
4343
+ /*
4444
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
45-
-
45+
4646
String string1;
47-
try {
48-
while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning() && (string1 = bufferedReader.readLine()) != null) {
49-
DedicatedServer.this.handleConsoleInput(string1, DedicatedServer.this.createCommandSourceStack());
47+
@@ -111,17 +_,41 @@
5048
}
5149
} catch (IOException var4) {
52-
- DedicatedServer.LOGGER.error("Exception handling console input", (Throwable)var4);
50+
DedicatedServer.LOGGER.error("Exception handling console input", (Throwable)var4);
5351
- }
54-
+ DedicatedServer.LOGGER.error("Exception handling console input", (Throwable) var4);
5552
+ }*/
5653
+ // Paper end - Use TerminalConsoleAppender
5754
}

paper-server/patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
+ private static void applyEffects(
111111
+ Level level, BlockPos pos, int beaconLevel, @Nullable Holder<MobEffect> primaryEffect, @Nullable Holder<MobEffect> secondaryEffect, @Nullable BeaconBlockEntity blockEntity
112112
+ ) {
113-
+ // Paper emd - pass beacon block entity
113+
+ // Paper end - pass beacon block entity
114114
if (!level.isClientSide && primaryEffect != null) {
115115
- double d = beaconLevel * 10 + 10;
116116
- int i = 0;

0 commit comments

Comments
 (0)