diff options
author | Bjarne Koll <[email protected]> | 2024-06-14 11:07:50 +0200 |
---|---|---|
committer | Bjarne Koll <[email protected]> | 2024-06-14 11:07:50 +0200 |
commit | 4140de28eb242f5b9b16166384481bcfcaf996a4 (patch) | |
tree | 6d708e9a2c4db1c54a2ebe82e3d9d7afdadf176e /patches/unapplied/server | |
parent | a399f2390326d8179426ef5608dbc66f72fbab4e (diff) | |
download | Paper-4140de28eb242f5b9b16166384481bcfcaf996a4.tar.gz Paper-4140de28eb242f5b9b16166384481bcfcaf996a4.zip |
960
Diffstat (limited to 'patches/unapplied/server')
-rw-r--r-- | patches/unapplied/server/0969-Per-world-ticks-per-spawn-settings.patch | 35 | ||||
-rw-r--r-- | patches/unapplied/server/0970-Properly-track-the-changed-item-from-dispense-events.patch | 103 |
2 files changed, 0 insertions, 138 deletions
diff --git a/patches/unapplied/server/0969-Per-world-ticks-per-spawn-settings.patch b/patches/unapplied/server/0969-Per-world-ticks-per-spawn-settings.patch deleted file mode 100644 index ebdf89762d..0000000000 --- a/patches/unapplied/server/0969-Per-world-ticks-per-spawn-settings.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Sat, 13 Nov 2021 12:36:26 -0800 -Subject: [PATCH] Per world ticks per spawn settings - - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 51c4877ffb77ece41e90d9c6ac06c04dc941e35c..975fcd4b8f93cb8c602ddeb165c485214eac10a4 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -185,6 +185,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - return this.getChunkIfLoaded(chunkX, chunkZ) != null; - } - // Paper end - Use getChunkIfLoadedImmediately -+ // Paper start - per world ticks per spawn -+ private int getTicksPerSpawn(SpawnCategory spawnCategory) { -+ final int perWorld = this.paperConfig().entities.spawning.ticksPerSpawn.getInt(CraftSpawnCategory.toNMS(spawnCategory)); -+ if (perWorld >= 0) { -+ return perWorld; -+ } -+ return this.getCraftServer().getTicksPerSpawns(spawnCategory); -+ } -+ // Paper end - - public abstract ResourceKey<LevelStem> getTypeKey(); - -@@ -197,7 +206,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - // CraftBukkit Ticks things - for (SpawnCategory spawnCategory : SpawnCategory.values()) { - if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { -- this.ticksPerSpawnCategory.put(spawnCategory, (long) this.getCraftServer().getTicksPerSpawns(spawnCategory)); -+ this.ticksPerSpawnCategory.put(spawnCategory, this.getTicksPerSpawn(spawnCategory)); // Paper - } - } - diff --git a/patches/unapplied/server/0970-Properly-track-the-changed-item-from-dispense-events.patch b/patches/unapplied/server/0970-Properly-track-the-changed-item-from-dispense-events.patch deleted file mode 100644 index 9957c97ca3..0000000000 --- a/patches/unapplied/server/0970-Properly-track-the-changed-item-from-dispense-events.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Mon, 12 Dec 2022 12:14:03 -0800 -Subject: [PATCH] Properly track the changed item from dispense events - - -diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 32084df594649d8da04052bbfa111896d8ea1f91..5dab1e10303177e5a4d97a91ee46ede66f30ae35 100644 ---- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -133,10 +133,14 @@ public interface DispenseItemBehavior { - idispensebehavior.dispense(pointer, eventStack); - return stack; - } -+ // Paper start - track changed items in the dispense event -+ itemstack1 = CraftItemStack.unwrap(event.getItem()); // unwrap is safe because the stack won't be modified -+ entitytypes = ((SpawnEggItem) itemstack1.getItem()).getType(itemstack1); -+ // Paper end - track changed item from dispense event - } - - try { -- entitytypes.spawn(pointer.level(), stack, (Player) null, pointer.pos().relative(enumdirection), MobSpawnType.DISPENSER, enumdirection != Direction.UP, false); -+ entitytypes.spawn(pointer.level(), itemstack1, (Player) null, pointer.pos().relative(enumdirection), MobSpawnType.DISPENSER, enumdirection != Direction.UP, false); // Paper - track changed item in dispense event - } catch (Exception exception) { - DispenseItemBehavior.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", pointer.pos(), exception); // CraftBukkit - decompile error - return ItemStack.EMPTY; -@@ -191,9 +195,10 @@ public interface DispenseItemBehavior { - } - // CraftBukkit end - -+ final ItemStack newStack = CraftItemStack.unwrap(event.getItem()); // Paper - use event itemstack (unwrap is fine here because the stack won't be modified) - Consumer<ArmorStand> consumer = EntityType.appendDefaultStackConfig((entityarmorstand) -> { - entityarmorstand.setYRot(enumdirection.toYRot()); -- }, worldserver, stack, (Player) null); -+ }, worldserver, newStack, (Player) null); // Paper - track changed items in the dispense event - ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, consumer, blockposition, MobSpawnType.DISPENSER, false, false); - - if (entityarmorstand != null) { -@@ -413,6 +418,7 @@ public interface DispenseItemBehavior { - int y = blockposition.getY(); - int z = blockposition.getZ(); - BlockState iblockdata = worldserver.getBlockState(blockposition); -+ ItemStack dispensedItem = stack; // Paper - track changed item from the dispense event - // Paper start - correctly check if the bucket place will succeed - /* Taken from SolidBucketItem#emptyContents */ - boolean willEmptyContentsSolidBucketItem = dispensiblecontaineritem instanceof net.minecraft.world.item.SolidBucketItem && worldserver.isInWorldBounds(blockposition) && iblockdata.isAir(); -@@ -442,12 +448,15 @@ public interface DispenseItemBehavior { - } - } - -- dispensiblecontaineritem = (DispensibleContainerItem) CraftItemStack.asNMSCopy(event.getItem()).getItem(); -+ // Paper start - track changed item from dispense event -+ dispensedItem = CraftItemStack.unwrap(event.getItem()); // unwrap is safe here as the stack isn't mutated -+ dispensiblecontaineritem = (DispensibleContainerItem) dispensedItem.getItem(); -+ // Paper end - track changed item from dispense event - } - // CraftBukkit end - - if (dispensiblecontaineritem.emptyContents((Player) null, worldserver, blockposition, (BlockHitResult) null)) { -- dispensiblecontaineritem.checkExtraContent((Player) null, worldserver, stack, blockposition); -+ dispensiblecontaineritem.checkExtraContent((Player) null, worldserver, dispensedItem, blockposition); // Paper - track changed item from dispense event - // CraftBukkit start - Handle stacked buckets - Item item = Items.BUCKET; - stack.shrink(1); -diff --git a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -index 985954030654d521291cccbfc3ca49b67ee4357d..e37d2d29f3ba67cfe28abe4847a3dca07121f0be 100644 ---- a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -@@ -36,7 +36,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { - ServerLevel worldserver = pointer.level(); - Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING); - Position iposition = this.dispenseConfig.positionFunction().getDispensePosition(pointer, enumdirection); -- Projectile iprojectile = this.projectileItem.asProjectile(worldserver, iposition, stack, enumdirection); -+ // Paper - move down - - // CraftBukkit start - // this.projectileItem.shoot(iprojectile, (double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); -@@ -66,6 +66,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { - } - } - -+ Projectile iprojectile = this.projectileItem.asProjectile(worldserver, iposition, CraftItemStack.unwrap(event.getItem()), enumdirection); // Paper - move from above and track changed items in the dispense event; unwrap is safe here because all uses of the stack make their own copies - this.projectileItem.shoot(iprojectile, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); - ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -index 6f2adf2334e35e8a617a4ced0c1af2abf32bbd8d..cb308808906a8cdb127df8284e106e00553473ca 100644 ---- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -@@ -57,7 +57,12 @@ public class ShulkerBoxDispenseBehavior extends OptionalDispenseItemBehavior { - // CraftBukkit end - - try { -- this.setSuccess(((BlockItem) item).place(new DirectionalPlaceContext(pointer.level(), blockposition, enumdirection, stack, enumdirection1)).consumesAction()); -+ // Paper start - track changed items in the dispense event -+ this.setSuccess(((BlockItem) item).place(new DirectionalPlaceContext(pointer.level(), blockposition, enumdirection, CraftItemStack.asNMSCopy(event.getItem()), enumdirection1)).consumesAction()); -+ if (this.isSuccess()) { -+ stack.shrink(1); // vanilla shrink is in the place function above, manually handle it here -+ } -+ // Paper end - track changed items in the dispense event - } catch (Exception exception) { - ShulkerBoxDispenseBehavior.LOGGER.error("Error trying to place shulker box at {}", blockposition, exception); - } |