3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 15:20:11 +01:00

Apply and move up non-optimization patches

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-25 12:27:57 +02:00
Ursprung f6ea3736a7
Commit ec4ada852e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
34 geänderte Dateien mit 217 neuen und 299 gelöschten Zeilen

9
a.sh
Datei anzeigen

@ -1,9 +0,0 @@
#!/bin/bash
cd patches/server
for file in [0-9][0-9][0-9][0-9]-*.patch; do
suffix=$(echo $file | cut -d'-' -f2-)
mv "$file" "$suffix"
done

Datei anzeigen

@ -17,7 +17,7 @@ index c01b4393439838976965823298f12e4762e72eff..218bf89fd7583d6db9f64754c4db8fcc
node = loader.load();
this.verifyGlobalConfigVersion(node);
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 31f34ac1c70df3ef6eb6f6dfd0f870b1b275adfa..30fe1c0645a07d663b08c0f988a1ab3a750bf7c4 100644
index 0b283171294eca65a898ddd9ab1b7295ad183b0d..481cfe3a291196c0391c2ec8560e566e0e1e2fb8 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@ -29,10 +29,10 @@ index 31f34ac1c70df3ef6eb6f6dfd0f870b1b275adfa..30fe1c0645a07d663b08c0f988a1ab3a
return instance;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f03f6922d15541c5491e5b37a3efa7ef0abef211..2dc07e5ef249636e85ad9c78e3729e9e066a8fe8 100644
index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..325ba58a1c79fd928ac22d8f1ef93605357300d2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1155,6 +1155,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1132,6 +1132,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long tickSection = Util.getNanos();
long currentTime;
// Paper end - further improve server tick loop
@ -47,10 +47,10 @@ index f03f6922d15541c5491e5b37a3efa7ef0abef211..2dc07e5ef249636e85ad9c78e3729e9e
+ // Paper end - Add onboarding message for initial server start
+
while (this.running) {
// Paper start - rewrite chunk system
// guarantee that nothing can stop the server from halting if it can at least still tick
long i;
diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
index c42a9949c4d37d45883867a54222a7ab33944b39..7704a5951ac3d02020ed0f40d76500dd6ba005af 100644
index 4d3fe4f56e0b264fa030409919caf52d5f421d46..759062d219ff490a3cb19e710c4d18e3e08288e0 100644
--- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
@@ -90,6 +90,7 @@ public class MinecraftServerGui extends JComponent {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max block/fluid ticks
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6907d1be36fbdf0856c0e11983218d2fd1f9cb46..4bca3d20d1a01270a10c1e643a312fe462305b5d 100644
index 06c185eae0063ff1b1714be0a5c7b0cdd538816b..b6a4feb182975b36c397a7b6e8ee37e4dbaddb64 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -849,9 +849,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -500,9 +500,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!this.isDebug() && flag) {
j = this.getGameTime();
gameprofilerfiller.push("blockTicks");

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Disable memory reserve allocating
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index e047dee632022abfe05865d1e71838be8d5d053a..99c5038672b09d0874125e3df280174c1e8151e6 100644
index 06c514b2d0674cd7df6692981f020437ea0f2f91..bcb6a3b3cd17ce5db9aaf6bd3ec7a0ec1b44b979 100644
--- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java
@@ -253,7 +253,7 @@ public class CrashReport {
@@ -250,7 +250,7 @@ public class CrashReport {
}
public static void preload() {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fire EntityDamageByEntityEvent for unowned wither skulls
diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
index 35e76fc8667d9fde5a8fc426699a617fb0a08e4b..5c7a6fe97b1f0b55b4a5dddbb684e4424688f866 100644
index 729aa0125479ab839792a3f35c981046899421b5..02931861de955352e71d6f5ffc720a17304815fe 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
@@ -72,7 +72,7 @@ public class WitherSkull extends AbstractHurtingProjectile {

Datei anzeigen

@ -7,10 +7,10 @@ Uses the correct entity in the EntityDamageByEntity event
Returns the correct entity for API's DamageSource#getCausingEntity
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 1561b85a45f52a8162f43553f8485bfe084b8f1f..b26e4d58ea1898a5e4b31c3d6ab33f38835ab2c6 100644
index a78fd4f9ce97ebece45979908382de8f5fc14c1b..160dc3216e8f5db5f9b3cce5e2d655f2b35b208a 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -27,7 +27,8 @@ public class DamageSource {
@@ -28,7 +28,8 @@ public class DamageSource {
private boolean withSweep = false;
private boolean melting = false;
private boolean poison = false;
@ -20,7 +20,7 @@ index 1561b85a45f52a8162f43553f8485bfe084b8f1f..b26e4d58ea1898a5e4b31c3d6ab33f38
public DamageSource sweep() {
this.withSweep = true;
@@ -56,13 +57,18 @@ public class DamageSource {
@@ -57,18 +58,18 @@ public class DamageSource {
return this.poison;
}
@ -32,10 +32,14 @@ index 1561b85a45f52a8162f43553f8485bfe084b8f1f..b26e4d58ea1898a5e4b31c3d6ab33f38
}
- public DamageSource customCausingEntity(Entity entity) {
- // This method is not intended for change the causing entity if is already set
- // also is only necessary if the entity passed is not the direct entity or different from the current causingEntity
- if (this.customCausingEntity != null || this.directEntity == entity || this.causingEntity == entity) {
- return this;
+ public DamageSource customEventDamager(Entity entity) {
+ if (this.directEntity != null) {
+ throw new IllegalStateException("Cannot set a custom event damager entity when a direct entity is already set (report as a bug to Paper)");
+ }
+ throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to Paper)");
}
DamageSource damageSource = this.cloneInstance();
- damageSource.customCausingEntity = entity;
+ damageSource.customEventDamager = entity;
@ -44,10 +48,10 @@ index 1561b85a45f52a8162f43553f8485bfe084b8f1f..b26e4d58ea1898a5e4b31c3d6ab33f38
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7992375dc55492aeb6defb204b28dd267be4a6e7..637478fd8a284e6833cf8f5fa17ccf9d73d1dd3f 100644
index 4e96b6c05bf8b8235e91bdd26e5615c5299fd9aa..3c1bcf8d1a07b35a8688160c9f05f792451338a3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3462,7 +3462,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3195,7 +3195,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return;
}
@ -57,10 +61,10 @@ index 7992375dc55492aeb6defb204b28dd267be4a6e7..637478fd8a284e6833cf8f5fa17ccf9d
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
index dbdb6c432448b151fa4421f14235f8bad23dc720..2eb099957a3d0bae3339ff4edbab103fb348abed 100644
index 3eabf1e94c0a1086f471e30bf523581907169c58..ffffa53fcaa6ec8681b283fa20bb5a3320ad9c11 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -336,7 +336,7 @@ public class Turtle extends Animal {
@@ -334,7 +334,7 @@ public class Turtle extends Animal {
@Override
public void thunderHit(ServerLevel world, LightningBolt lightning) {
@ -70,10 +74,10 @@ index dbdb6c432448b151fa4421f14235f8bad23dc720..2eb099957a3d0bae3339ff4edbab103f
@Override
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index 4dea85a8ab8ae16d02e35d226fd155891ce2319a..eaad15a4d201356c34c1a09c7fbe5c35f76a2176 100644
index 0ffff5329fa2c7833f9ec71528cb7f951cf78109..bf2d91bbb4bf401696f5f5d14a67e3920a179084 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -204,7 +204,7 @@ public abstract class HangingEntity extends Entity {
@@ -203,7 +203,7 @@ public abstract class HangingEntity extends Entity {
} else {
if (!this.isRemoved() && !this.level().isClientSide) {
// CraftBukkit start - fire break events
@ -82,11 +86,24 @@ index 4dea85a8ab8ae16d02e35d226fd155891ce2319a..eaad15a4d201356c34c1a09c7fbe5c35
HangingBreakEvent event;
if (damager != null) {
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), source.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index 4b94e21d05d6deae75f0c2fb711e43a4c7d06f90..8db431cb9778cd38c8e7ef939a055c4b72232c75 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -271,7 +271,7 @@ public class Creeper extends Monster implements PowerableMob {
if (!event.isCancelled()) {
// CraftBukkit end
this.dead = true;
- this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customCausingEntity(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit
+ this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customEventDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit
this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
this.spawnLingeringCloud();
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java
index a729460e35bbef134bdf0d72d8894c3df007f7b8..e6f549f1fcd261f96f0e4fc4cbe26a04c389d191 100644
index eb764829bde34a835a151934267bfcf36d5239fa..f8aa723f18e28b02d4b7055404922ff8d7a73f8d 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java
@@ -132,7 +132,7 @@ public class EvokerFangs extends Entity implements TraceableEntity {
@@ -133,7 +133,7 @@ public class EvokerFangs extends Entity implements TraceableEntity {
if (target.isAlive() && !target.isInvulnerable() && target != entityliving1) {
if (entityliving1 == null) {
@ -109,7 +126,7 @@ index 28690877c443ceb2bdf20e6d251c9d32f667814c..1fb1e729d6879568d8b4943071fa9403
// CraftBukkit end
this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_TELEPORT, SoundSource.PLAYERS);
diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
index 5c7a6fe97b1f0b55b4a5dddbb684e4424688f866..6f49b9b8707d74330adb973e0db3cd5bccf138b6 100644
index 02931861de955352e71d6f5ffc720a17304815fe..55b4b5ad5f084c9a271a716d076672478d6486ba 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
@@ -72,7 +72,7 @@ public class WitherSkull extends AbstractHurtingProjectile {
@ -122,10 +139,10 @@ index 5c7a6fe97b1f0b55b4a5dddbb684e4424688f866..6f49b9b8707d74330adb973e0db3cd5b
if (flag && entity instanceof LivingEntity) {
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index b678da2cbb93cea7971bc3c4d324cfca18b0bc97..90a82bd7977ebe520bdcc2ab99e11452d5cf4a21 100644
index fbd1f4f3a8c94a4842f91b7cc6c21f0cf7edd7ac..550c0cf4d84afc0cd6b2675bdc6aa2282d87e312 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -103,7 +103,7 @@ public class Explosion {
@@ -104,7 +104,7 @@ public class Explosion {
this.z = z;
this.fire = createFire;
this.blockInteraction = destructionType;
@ -173,26 +190,15 @@ index 4c6e15535fa40aad8cf1920f392589404f9ba79c..35eb95ef6fb6a0f7ea63351e90741c48
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0a041d0e56dfe1319e5174cb0e6085dc35fa5c48..c0823c612de9dc2a64cc797f061eef25c5f31359 100644
index 444287fea080182df533198f5c659533de86c5dc..0a06b9f9691896dc9d5b67361e41d9f049422020 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1083,7 +1083,7 @@ public class CraftEventFactory {
@@ -1082,7 +1082,7 @@ public class CraftEventFactory {
private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) {
CraftDamageSource bukkitDamageSource = new CraftDamageSource(source);
- Entity damager = source.getCausingEntity();
+ final Entity damager = source.getCustomEventDamager(); // Paper - fix DamageSource API
- Entity damager = (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) ? source.getDirectEntity() : source.getCausingEntity();
+ Entity damager = (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) ? source.getDirectEntity() : source.getCustomEventDamager(); // Paper - fix DamageSource API
if (source.is(DamageTypeTags.IS_EXPLOSION)) {
if (damager == null) {
return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), entity, DamageCause.BLOCK_EXPLOSION, bukkitDamageSource, modifiers, modifierFunctions, cancelled, source.explodedBlockState); // Paper - Include BlockState for damage
@@ -1093,9 +1093,7 @@ public class CraftEventFactory {
} else if (damager != null || source.getDirectEntity() != null) {
DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK;
- if (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) {
- damager = source.getDirectEntity();
- }
+ // Paper - fix DamageSource API
if (damager instanceof net.minecraft.world.entity.projectile.Projectile) {
if (damager.getBukkitEntity() instanceof ThrownPotion) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix creation of invalid block entity during world generation
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index 5ece375eaf6bcc61864997a389bb5e24625e4505..9c3f8f79c2b3389a118dce9a1558edda52446833 100644
index 713509e08c6325816fef7c09477d36aacb0008ef..8f8cbb9cc7febe3eb1c7de2be3953f67b0b58116 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -352,6 +352,7 @@ public class WorldGenRegion implements WorldGenLevel {
@@ -339,6 +339,7 @@ public class WorldGenRegion implements WorldGenLevel {
ichunkaccess.removeBlockEntity(pos);
}
} else {
@ -17,10 +17,10 @@ index 5ece375eaf6bcc61864997a389bb5e24625e4505..9c3f8f79c2b3389a118dce9a1558edda
nbttagcompound.putInt("x", pos.getX());
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 6ec3fc801453fd54c25b642e6fa71c19b463311d..465458e8a7dbaf9afb32709a71c7b2620d1e1fd2 100644
index 744db9eec4f7bdeb32f83300960a7fce63b393d8..8de6ad8b131061b2dae440dff71e2e6e7af2de39 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1169,9 +1169,14 @@ public class LevelChunk extends ChunkAccess {
@@ -1071,9 +1071,14 @@ public class LevelChunk extends ChunkAccess {
if (this.blockEntity.getType().isValid(iblockdata)) {
this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
this.loggedInvalidBlockState = false;

Datei anzeigen

@ -14,10 +14,10 @@ Additionally equippable mob heads, wither skulls, and carved pumpkins
are subject to the same possible error.
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab771a5792 100644
index 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896d8ea1f91 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -348,7 +348,7 @@ public interface DispenseItemBehavior {
@@ -238,7 +238,7 @@ public interface DispenseItemBehavior {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@ -26,7 +26,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab
idispensebehavior.dispense(pointer, eventStack);
return stack;
}
@@ -404,7 +404,7 @@ public interface DispenseItemBehavior {
@@ -294,7 +294,7 @@ public interface DispenseItemBehavior {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@ -35,7 +35,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab
idispensebehavior.dispense(pointer, eventStack);
return stack;
}
@@ -478,7 +478,7 @@ public interface DispenseItemBehavior {
@@ -368,7 +368,7 @@ public interface DispenseItemBehavior {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@ -44,7 +44,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab
idispensebehavior.dispense(pointer, eventStack);
return stack;
}
@@ -924,7 +924,7 @@ public interface DispenseItemBehavior {
@@ -710,7 +710,7 @@ public interface DispenseItemBehavior {
OptionalDispenseItemBehavior dispensebehaviormaybe1 = new OptionalDispenseItemBehavior() {
@Override
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
@ -53,7 +53,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab
return stack;
}
};
@@ -978,7 +978,7 @@ public interface DispenseItemBehavior {
@@ -764,7 +764,7 @@ public interface DispenseItemBehavior {
stack.shrink(1);
this.setSuccess(true);
} else {
@ -62,7 +62,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab
}
return stack;
@@ -1024,7 +1024,7 @@ public interface DispenseItemBehavior {
@@ -810,7 +810,7 @@ public interface DispenseItemBehavior {
stack.shrink(1);
this.setSuccess(true);
} else {
@ -72,10 +72,10 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab
return stack;
diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java
index 42d87800a328f71c5127ce5599ca4c71cc9bb1cd..6b81be03f87967124b046708557e05d519aa79e4 100644
index e766397aae3f73548b290b0809b9d1ca0967ea39..786e4a8700cb84b16dd9b8892a0d1d5803924d81 100644
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
@@ -43,7 +43,7 @@ public class ArmorItem extends Item implements Equipable {
@@ -48,14 +48,20 @@ public class ArmorItem extends Item implements Equipable {
public static final DispenseItemBehavior DISPENSE_ITEM_BEHAVIOR = new DefaultDispenseItemBehavior() {
@Override
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
@ -84,9 +84,8 @@ index 42d87800a328f71c5127ce5599ca4c71cc9bb1cd..6b81be03f87967124b046708557e05d5
}
};
protected final ArmorItem.Type type;
@@ -53,7 +53,13 @@ public class ArmorItem extends Item implements Equipable {
protected final ArmorMaterial material;
private final Multimap<Attribute, AttributeModifier> defaultModifiers;
protected final Holder<ArmorMaterial> material;
private final Supplier<ItemAttributeModifiers> defaultModifiers;
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
public static boolean dispenseArmor(BlockSource pointer, ItemStack armor) {
@ -98,7 +97,7 @@ index 42d87800a328f71c5127ce5599ca4c71cc9bb1cd..6b81be03f87967124b046708557e05d5
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
List<LivingEntity> list = pointer.level().getEntitiesOfClass(LivingEntity.class, new AABB(blockposition), EntitySelector.NO_SPECTATORS.and(new EntitySelector.MobCanWearArmorEntitySelector(armor)));
@@ -84,7 +90,7 @@ public class ArmorItem extends Item implements Equipable {
@@ -86,7 +92,7 @@ public class ArmorItem extends Item implements Equipable {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());

Datei anzeigen

@ -54,18 +54,18 @@ index 0000000000000000000000000000000000000000..a375ad4ba9db990b24a2b9ff366fcba6
+ }
+}
diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java
index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fea90aee42 100644
index da101bca71f4710812621b98f0a0d8cab180346a..3cd112584accb8e8f050ac99738eed11c902e60e 100644
--- a/src/main/java/net/minecraft/nbt/TagParser.java
+++ b/src/main/java/net/minecraft/nbt/TagParser.java
@@ -48,6 +48,7 @@ public class TagParser {
}
@@ -49,6 +49,7 @@ public class TagParser {
}, CompoundTag::toString);
public static final Codec<CompoundTag> LENIENT_CODEC = Codec.withAlternative(AS_CODEC, CompoundTag.CODEC);
private final StringReader reader;
+ private int depth; // Paper
public static CompoundTag parseTag(String string) throws CommandSyntaxException {
return new TagParser(new StringReader(string)).readSingleStruct();
@@ -158,6 +159,7 @@ public class TagParser {
@@ -159,6 +160,7 @@ public class TagParser {
public CompoundTag readStruct() throws CommandSyntaxException {
this.expect('{');
@ -73,7 +73,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe
CompoundTag compoundTag = new CompoundTag();
this.reader.skipWhitespace();
@@ -181,6 +183,7 @@ public class TagParser {
@@ -182,6 +184,7 @@ public class TagParser {
}
this.expect('}');
@ -81,7 +81,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe
return compoundTag;
}
@@ -190,6 +193,7 @@ public class TagParser {
@@ -191,6 +194,7 @@ public class TagParser {
if (!this.reader.canRead()) {
throw ERROR_EXPECTED_VALUE.createWithContext(this.reader);
} else {
@ -89,7 +89,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe
ListTag listTag = new ListTag();
TagType<?> tagType = null;
@@ -215,6 +219,7 @@ public class TagParser {
@@ -216,6 +220,7 @@ public class TagParser {
}
this.expect(']');
@ -97,7 +97,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe
return listTag;
}
}
@@ -287,4 +292,11 @@ public class TagParser {
@@ -288,4 +293,11 @@ public class TagParser {
this.reader.skipWhitespace();
this.reader.expect(c);
}
@ -110,7 +110,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe
+ }
}
diff --git a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java
index 65debad7aa7ffb1b0b19f89713ff394e8c9d245e..18e53db59082bae94922edc4baa812aa6f089576 100644
index 56e641bc5f6edc657647993ea2efbb7bb9c2f732..4aa6232bf0f72fcde32d257100bd15b1c5192aaa 100644
--- a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java
+++ b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java
@@ -181,6 +181,15 @@ public class TranslatableContents implements ComponentContents {
@ -156,23 +156,23 @@ index 65debad7aa7ffb1b0b19f89713ff394e8c9d245e..18e53db59082bae94922edc4baa812aa
@Override
public MutableComponent resolve(@Nullable CommandSourceStack source, @Nullable Entity sender, int depth) throws CommandSyntaxException {
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java
index a5e438a834826161c52ca9db57d234d9ff80a591..4766994cce060564370b0d24836a7da8b5e4a8a1 100644
index 898b19887ed34c87003fc63cb5905df2ba6234a5..b47eeb23055b135d5567552ba983bfbc3e1fab67 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java
@@ -14,7 +14,7 @@ public class ServerboundCommandSuggestionPacket implements Packet<ServerGamePack
@@ -19,7 +19,7 @@ public class ServerboundCommandSuggestionPacket implements Packet<ServerGamePack
public ServerboundCommandSuggestionPacket(FriendlyByteBuf buf) {
private ServerboundCommandSuggestionPacket(FriendlyByteBuf buf) {
this.id = buf.readVarInt();
- this.command = buf.readUtf(32500);
+ this.command = buf.readUtf(2048); // Paper
}
@Override
private void write(FriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b8db3c3a5870e9d7dbba38caf7c9e1c1f3849bde..2ad17823bf442ce0455227b64e5d3bb10d0ee2c1 100644
index d6c767c8fee799e895058c8ef3dad96cc580675d..6061f7104dd2094e316739a1b0e541475aed40b0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -777,6 +777,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -769,6 +769,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
// Paper end - Don't suggest if tab-complete is disabled
@ -186,7 +186,7 @@ index b8db3c3a5870e9d7dbba38caf7c9e1c1f3849bde..2ad17823bf442ce0455227b64e5d3bb1
// Paper start - AsyncTabCompleteEvent
TAB_COMPLETE_EXECUTOR.execute(() -> this.handleCustomCommandSuggestions0(packet));
}
@@ -824,6 +831,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -821,6 +828,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void sendServerSuggestions(final ServerboundCommandSuggestionPacket packet, final StringReader stringreader) {
// Paper end - AsyncTabCompleteEvent
ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());

Datei anzeigen

@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Wed, 20 Mar 2024 20:41:35 -0400
Subject: [PATCH] Item Mutation Fixes
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
index 46beb8e45788950b8ca863aaf07c6d0587d8f693..5b3e33807e0e13480e3359c0cf067719e5749237 100644
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
@@ -227,7 +227,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
return false;
} else if (this.costs[id] > 0 && !itemstack.isEmpty() && (player.experienceLevel >= j && player.experienceLevel >= this.costs[id] || player.getAbilities().instabuild)) {
this.access.execute((world, blockposition) -> {
- ItemStack itemstack2 = itemstack;
+ ItemStack itemstack2 = itemstack; // Paper - diff on change
List<EnchantmentInstance> list = this.getEnchantmentList(world.enabledFeatures(), itemstack, id, this.costs[id]);
// CraftBukkit start
@@ -249,10 +249,16 @@ public class EnchantmentMenu extends AbstractContainerMenu {
return;
}
// CraftBukkit end
- if (itemstack.is(Items.BOOK)) {
- itemstack2 = itemstack.transmuteCopy(Items.ENCHANTED_BOOK, 1);
+ // Paper start
+ itemstack2 = org.bukkit.craftbukkit.inventory.CraftItemStack.getOrCloneOnMutation(item, event.getItem());
+ if (itemstack2 != itemstack) {
this.enchantSlots.setItem(0, itemstack2);
}
+ if (itemstack2.is(Items.BOOK)) {
+ itemstack2 = itemstack2.transmuteCopy(Items.ENCHANTED_BOOK, 1);
+ this.enchantSlots.setItem(0, itemstack2);
+ }
+ // Paper end
// CraftBukkit start
for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {

Datei anzeigen

@ -5,10 +5,10 @@ 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 a09017e74d972a12d0b88b4ade9a3532ce0ecd08..ca89d1593bf1b46c79a882db528cbca1359dc9d4 100644
index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..b1f6d6a12865f3b30e9136fb548fa0a48a5ecb6e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -204,6 +204,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -185,6 +185,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.getChunkIfLoaded(chunkX, chunkZ) != null;
}
// Paper end - Use getChunkIfLoadedImmediately
@ -24,7 +24,7 @@ index a09017e74d972a12d0b88b4ade9a3532ce0ecd08..ca89d1593bf1b46c79a882db528cbca1
public abstract ResourceKey<LevelStem> getTypeKey();
@@ -216,7 +225,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -197,7 +206,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit Ticks things
for (SpawnCategory spawnCategory : SpawnCategory.values()) {
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {

Datei anzeigen

@ -4,32 +4,11 @@ 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/AbstractProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java
index 155bd3d6d9c7d3cac7fd04de8210301251d1e17a..bc2e763a848b4bf7e9598ffe1ca2aa35a9af4677 100644
--- a/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java
@@ -23,7 +23,7 @@ public abstract class AbstractProjectileDispenseBehavior extends DefaultDispense
ServerLevel worldserver = pointer.level();
Position iposition = DispenserBlock.getDispensePosition(pointer);
Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING);
- Projectile iprojectile = this.getProjectile(worldserver, iposition, stack);
+ // Paper - move down
// CraftBukkit start
// iprojectile.shoot((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ(), this.getPower(), this.getUncertainty());
@@ -52,6 +52,7 @@ public abstract class AbstractProjectileDispenseBehavior extends DefaultDispense
return stack;
}
}
+ Projectile iprojectile = this.getProjectile(worldserver, iposition, CraftItemStack.asNMSCopy(event.getItem())); // Paper - move from above and track changed items in the dispense event
iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.getPower(), this.getUncertainty());
((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity());
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5ac220599 100644
index 32084df594649d8da04052bbfa111896d8ea1f91..d194c08a50493da39f2457dc55fed953f78c6199 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -241,10 +241,14 @@ public interface DispenseItemBehavior {
@@ -133,10 +133,14 @@ public interface DispenseItemBehavior {
idispensebehavior.dispense(pointer, eventStack);
return stack;
}
@ -45,7 +24,7 @@ index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5
} catch (Exception exception) {
DispenseItemBehavior.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", pointer.pos(), exception); // CraftBukkit - decompile error
return ItemStack.EMPTY;
@@ -299,10 +303,11 @@ public interface DispenseItemBehavior {
@@ -191,9 +195,10 @@ public interface DispenseItemBehavior {
}
// CraftBukkit end
@ -53,22 +32,11 @@ index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5
Consumer<ArmorStand> consumer = EntityType.appendDefaultStackConfig((entityarmorstand) -> {
entityarmorstand.setYRot(enumdirection.toYRot());
- }, worldserver, stack, (Player) null);
- ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, stack.getTag(), consumer, blockposition, MobSpawnType.DISPENSER, false, false);
+ }, worldserver, newStack, (Player) null); // Paper - track changed items in the dispense event
+ ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, newStack.getTag(), consumer, blockposition, MobSpawnType.DISPENSER, false, false); // 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) {
if (shrink) stack.shrink(1); // Paper - actually handle here
@@ -582,7 +587,7 @@ public interface DispenseItemBehavior {
}
SmallFireball entitysmallfireball = new SmallFireball(worldserver, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
- entitysmallfireball.setItem(itemstack1);
+ entitysmallfireball.setItem(CraftItemStack.unwrap(event.getItem())); // Paper - track changed items in the dispense event (unwrap is save cause setItem already copies)
entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity());
worldserver.addFreshEntity(entitysmallfireball);
@@ -628,6 +633,7 @@ public interface DispenseItemBehavior {
@@ -413,6 +418,7 @@ public interface DispenseItemBehavior {
int y = blockposition.getY();
int z = blockposition.getZ();
BlockState iblockdata = worldserver.getBlockState(blockposition);
@ -76,7 +44,7 @@ index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5
// 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();
@@ -657,12 +663,15 @@ public interface DispenseItemBehavior {
@@ -442,12 +448,15 @@ public interface DispenseItemBehavior {
}
}
@ -94,6 +62,27 @@ index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5
// 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..03503357b50c53e3f3f69db887a002df7285cd38 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.asNMSCopy(event.getItem()), enumdirection); // Paper - move from above and track changed items in the dispense event
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

Datei anzeigen

@ -14,10 +14,10 @@ in which it replaces PotionEffect.
Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
index b453a47cadbda2e22262bcdc5454c4c6cf5b2583..983e0cdbd1bd950807967a36cba49859fb956f31 100644
index 9cc81bcccbf1141f66fedada1359b7c0dfa8e22a..7491c7cf38d888b31a509613d237b55f9732400a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
@@ -32,20 +32,32 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
@@ -34,11 +34,19 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
return ImmutableList.of();
}
@ -34,52 +34,12 @@ index b453a47cadbda2e22262bcdc5454c4c6cf5b2583..983e0cdbd1bd950807967a36cba49859
+ public boolean addEffectToNextStew(io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, boolean overwrite) {
+ Preconditions.checkArgument(suspiciousEffectEntry != null, "SuspiciousEffectEntry cannot be null");
+ MobEffect minecraftPotionEffect = CraftPotionEffectType.bukkitToMinecraft(suspiciousEffectEntry.effect());
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
+ if (!overwrite && this.hasEffectForNextStew(suspiciousEffectEntry.effect())) {
return false;
}
+ SuspiciousEffectHolder.EffectEntry recordSuspiciousEffect = new SuspiciousEffectHolder.EffectEntry(minecraftPotionEffect, suspiciousEffectEntry.duration());
+ this.removeEffectFromNextStew(suspiciousEffectEntry.effect()); // Avoid duplicates of effects
+ // Paper start - fix modification of immutable stew effects list
if (this.getHandle().stewEffects == null) {
- this.getHandle().stewEffects = new ArrayList<>();
+ this.getHandle().stewEffects = List.of(recordSuspiciousEffect);
+ } else {
+ this.getHandle().stewEffects = io.papermc.paper.util.MCUtil.copyListAndAdd(this.getHandle().stewEffects, recordSuspiciousEffect);
}
- SuspiciousEffectHolder.EffectEntry recordSuspiciousEffect = new SuspiciousEffectHolder.EffectEntry(minecraftPotionEffect.getEffect(), minecraftPotionEffect.getDuration());
- this.removeEffectFromNextStew(potionEffect.getType()); // Avoid duplicates of effects
- return this.getHandle().stewEffects.add(recordSuspiciousEffect);
+ // Paper end - fix modification of immutable stew effects list
+ return true;
}
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
@Override
public boolean removeEffectFromNextStew(PotionEffectType potionEffectType) {
@@ -54,7 +66,21 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
return false;
}
MobEffect minecraftPotionEffectType = CraftPotionEffectType.bukkitToMinecraft(potionEffectType);
- return this.getHandle().stewEffects.removeIf(recordSuspiciousEffect -> recordSuspiciousEffect.effect().equals(minecraftPotionEffectType));
+ // Paper start - fix modification of immutable stew effects list
+ if (this.getHandle().stewEffects == null) return false;
+
+ final int oldSize = this.getHandle().stewEffects.size();
+ this.getHandle().stewEffects = io.papermc.paper.util.MCUtil.copyListAndRemoveIf(
+ this.getHandle().stewEffects, s -> java.util.Objects.equals(s.effect(), minecraftPotionEffectType)
+ );
+
+ final int newSize = this.getHandle().stewEffects.size();
+ if (newSize == 0) {
+ this.getHandle().stewEffects = null; // Null the empty list, mojang expect this
+ }
+
+ return oldSize != newSize; // Yield back if the size changed, implying an object was removed.
+ // Paper end - fix modification of immutable stew effects list
}
@Override
@@ -89,6 +115,43 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
SuspiciousStewEffects stewEffects = this.getHandle().stewEffects;
@@ -101,6 +109,43 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
this.getHandle().setVariant(net.minecraft.world.entity.animal.MushroomCow.MushroomType.values()[variant.ordinal()]);
}
@ -124,46 +84,30 @@ index b453a47cadbda2e22262bcdc5454c4c6cf5b2583..983e0cdbd1bd950807967a36cba49859
public String toString() {
return "CraftMushroomCow";
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc1549b618d85 100644
index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..6b229ec0d4110fd0e758610bfacd9e8ec71ad2c5 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
@@ -24,7 +24,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
static final ItemMetaKey EFFECTS = new ItemMetaKey("effects", "effects");
static final ItemMetaKey ID = new ItemMetaKey("id", "id");
@@ -22,7 +22,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
static final ItemMetaKeyType<SuspiciousStewEffects> EFFECTS = new ItemMetaKeyType<>(DataComponents.SUSPICIOUS_STEW_EFFECTS, "effects");
- private List<PotionEffect> customEffects;
+ private List<io.papermc.paper.potion.SuspiciousEffectEntry> customEffects; // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
CraftMetaSuspiciousStew(CraftMetaItem meta) {
super(meta);
@@ -57,7 +57,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
duration = net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION;
}
// Paper end start - default duration is 160
- this.customEffects.add(new PotionEffect(type, duration, 0));
+ this.customEffects.add(io.papermc.paper.potion.SuspiciousEffectEntry.create(type, duration)); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
}
}
}
@@ -84,12 +84,14 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
ListTag effectList = new ListTag();
tag.put(CraftMetaSuspiciousStew.EFFECTS.NBT, effectList);
@@ -74,8 +74,8 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
if (this.customEffects != null) {
List<SuspiciousStewEffects.Entry> effectList = new ArrayList<>();
- for (PotionEffect effect : this.customEffects) {
+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
- effectList.add(new net.minecraft.world.item.component.SuspiciousStewEffects.Entry(CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()), effect.getDuration()));
+ for (io.papermc.paper.potion.SuspiciousEffectEntry effect : this.customEffects) {
CompoundTag effectData = new CompoundTag();
- effectData.putString(CraftMetaSuspiciousStew.ID.NBT, effect.getType().getKey().toString());
- if (effect.getDuration() != net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION) effectData.putInt(CraftMetaSuspiciousStew.DURATION.NBT, effect.getDuration()); // Paper - don't save duration if it's the default value
+ effectData.putString(CraftMetaSuspiciousStew.ID.NBT, effect.effect().getKey().toString());
+ if (effect.duration() != net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION) effectData.putInt(CraftMetaSuspiciousStew.DURATION.NBT, effect.duration()); // Paper - don't save duration if it's the default value
effectList.add(effectData);
+ effectList.add(new net.minecraft.world.item.component.SuspiciousStewEffects.Entry(CraftPotionEffectType.bukkitToMinecraftHolder(effect.effect()), effect.duration())); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
}
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
tag.put(CraftMetaSuspiciousStew.EFFECTS, new SuspiciousStewEffects(effectList));
}
}
@@ -124,7 +126,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -112,7 +112,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@Override
public List<PotionEffect> getCustomEffects() {
if (this.hasCustomEffects()) {
@ -172,7 +116,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154
}
return ImmutableList.of();
}
@@ -132,15 +134,21 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -120,15 +120,21 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@Override
public boolean addCustomEffect(PotionEffect effect, boolean overwrite) {
Preconditions.checkArgument(effect != null, "Potion effect cannot be null");
@ -198,7 +142,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154
return true;
} else {
return false;
@@ -149,10 +157,11 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -137,10 +143,11 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
if (this.customEffects == null) {
this.customEffects = new ArrayList<>();
}
@ -211,7 +155,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154
@Override
public boolean removeCustomEffect(PotionEffectType type) {
@@ -163,10 +172,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -151,10 +158,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
}
boolean changed = false;
@ -227,7 +171,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154
iterator.remove();
changed = true;
}
@@ -189,7 +200,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -177,7 +186,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
}
for (int i = 0; i < this.customEffects.size(); i++) {
@ -236,7 +180,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154
return i;
}
}
@@ -234,7 +245,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
@@ -222,7 +231,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
super.serialize(builder);
if (this.hasCustomEffects()) {

Datei anzeigen

@ -5,15 +5,15 @@ Subject: [PATCH] check if itemstack is stackable first
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
index 309acf7bd07e38043aa81e0e686edba1136bd04c..96c898086f35fd83f9b1ce7e3fe53d31b2fa4c31 100644
index 1e77482a98869e464c1f0a873cff8febf7924c8c..ca7fbe4f8c1e1d2fb90095aa35be4dda3029c23e 100644
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
@@ -114,7 +114,7 @@ public class Inventory implements Container, Nameable {
@@ -111,7 +111,7 @@ public class Inventory implements Container, Nameable {
}
private boolean hasRemainingSpaceForItem(ItemStack existingStack, ItemStack stack) {
- return !existingStack.isEmpty() && ItemStack.isSameItemSameTags(existingStack, stack) && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize();
+ return !existingStack.isEmpty() && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize() && ItemStack.isSameItemSameTags(existingStack, stack); // Paper - check if itemstack is stackable first
- return !existingStack.isEmpty() && ItemStack.isSameItemSameComponents(existingStack, stack) && existingStack.isStackable() && existingStack.getCount() < this.getMaxStackSize(existingStack);
+ return !existingStack.isEmpty() && existingStack.isStackable() && existingStack.getCount() < this.getMaxStackSize(existingStack) && ItemStack.isSameItemSameComponents(existingStack, stack); // Paper - check if itemstack is stackable first
}
// CraftBukkit start - Watch method above! :D

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] disable forced empty world ticks
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4bca3d20d1a01270a10c1e643a312fe462305b5d..bf5e47e8c3706590fdc0731bd9a5858b56d06136 100644
index b6a4feb182975b36c397a7b6e8ee37e4dbaddb64..f2ccc126bb75bd3b88f17af885a507fd5ab0d7e5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -876,7 +876,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -527,7 +527,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.handlingTick = false;
gameprofilerfiller.pop();

Datei anzeigen

@ -4858,7 +4858,7 @@ index 0d536d72ac918fbd403397ff369d10143ee9c204..6051e5f272838ef23276a90e21c2fc82
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
return new TicketType<>(name, argumentComparator, 0L);
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index 713509e08c6325816fef7c09477d36aacb0008ef..b17eb5c228264715bdf58895e4e7a3910a13c6e9 100644
index 8f8cbb9cc7febe3eb1c7de2be3953f67b0b58116..9297ae20ce5ea5f5a7e8e6d080ef7b2ddff7058c 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -109,6 +109,27 @@ public class WorldGenRegion implements WorldGenLevel {
@ -5120,7 +5120,7 @@ index 2953e93965aa688be8fc1620580701ba0c9d907e..aa5dee839d4c0dbc3c2abee9b501ec25
@Override
public BlockEntity getBlockEntity(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 744db9eec4f7bdeb32f83300960a7fce63b393d8..fca31bc427847141e7317b85a10da9e34e9e2bf6 100644
index 8de6ad8b131061b2dae440dff71e2e6e7af2de39..bac191f92ea3735df19c68d5568c2c7962c8680f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -222,6 +222,12 @@ public class LevelChunk extends ChunkAccess {

Datei anzeigen

@ -14602,10 +14602,10 @@ index 0000000000000000000000000000000000000000..962d3cae6340fc11607b59355e291629
+
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 0b283171294eca65a898ddd9ab1b7295ad183b0d..31f34ac1c70df3ef6eb6f6dfd0f870b1b275adfa 100644
index 481cfe3a291196c0391c2ec8560e566e0e1e2fb8..30fe1c0645a07d663b08c0f988a1ab3a750bf7c4 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -28,6 +28,45 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -29,6 +29,45 @@ public class GlobalConfiguration extends ConfigurationPart {
public static GlobalConfiguration get() {
return instance;
}
@ -14651,7 +14651,7 @@ index 0b283171294eca65a898ddd9ab1b7295ad183b0d..31f34ac1c70df3ef6eb6f6dfd0f870b1
static void set(GlobalConfiguration instance) {
GlobalConfiguration.instance = instance;
}
@@ -129,21 +168,6 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -130,21 +169,6 @@ public class GlobalConfiguration extends ConfigurationPart {
public int incomingPacketThreshold = 300;
}
@ -14673,7 +14673,7 @@ index 0b283171294eca65a898ddd9ab1b7295ad183b0d..31f34ac1c70df3ef6eb6f6dfd0f870b1
public UnsupportedSettings unsupportedSettings;
public class UnsupportedSettings extends ConfigurationPart {
@@ -202,7 +226,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -203,7 +227,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {
@ -15681,7 +15681,7 @@ index c33f85b570f159ab465b5a10a8044a81f2797f43..244a19ecd0234fa1d7a6ecfea2075159
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::createFromGameruleRadius);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..d7699ac1c627f265c403b9e00121f5f55e982341 100644
index 325ba58a1c79fd928ac22d8f1ef93605357300d2..498fc4ab46eac994f2a65c79eebddca2813f0b65 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -318,7 +318,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -15794,9 +15794,9 @@ index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..d7699ac1c627f265c403b9e00121f5f5
protected void runServer() {
try {
if (!this.initServer()) {
@@ -1133,6 +1117,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long currentTime;
// Paper end - further improve server tick loop
@@ -1143,6 +1127,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - Add onboarding message for initial server start
while (this.running) {
+ // Paper start - rewrite chunk system
+ // guarantee that nothing can stop the server from halting if it can at least still tick
@ -15807,7 +15807,7 @@ index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..d7699ac1c627f265c403b9e00121f5f5
long i;
if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
@@ -1295,6 +1285,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1305,6 +1295,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
private boolean haveTime() {
@ -15819,7 +15819,7 @@ index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..d7699ac1c627f265c403b9e00121f5f5
// CraftBukkit start
if (isOversleep) return canOversleep(); // Paper - because of our changes, this logic is broken
return this.forceTicks || this.runningTask() || Util.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
@@ -1557,7 +1552,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1567,7 +1562,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
getAllLevels().forEach(level -> {
@ -15828,7 +15828,7 @@ index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..d7699ac1c627f265c403b9e00121f5f5
if (entity.isRemoved()) {
continue;
}
@@ -2615,6 +2610,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2625,6 +2620,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
@ -18390,7 +18390,7 @@ index 2d9d4d06b75873f888ef4d8f5779a52706f821a8..f74efe41cd0da2f9749fc96fb9e0f7cf
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 06c185eae0063ff1b1714be0a5c7b0cdd538816b..e517037047013d0d55771fc08af9e03c4d334823 100644
index f2ccc126bb75bd3b88f17af885a507fd5ab0d7e5..d2fff98640a44f48d85044cd037cb3e9f8061125 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -199,7 +199,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -19266,10 +19266,10 @@ index 6051e5f272838ef23276a90e21c2fc821ca155d1..658e63ebde81dc14c8ab5850fb246dc0
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
return new TicketType<>(name, argumentComparator, 0L);
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index b17eb5c228264715bdf58895e4e7a3910a13c6e9..9c066b1dda5912d7aaf50df381cc4809bedf0604 100644
index 9297ae20ce5ea5f5a7e8e6d080ef7b2ddff7058c..d05c40c77c7d37eb8eabfd3a9df8860bed5a17e4 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -543,4 +543,21 @@ public class WorldGenRegion implements WorldGenLevel {
@@ -544,4 +544,21 @@ public class WorldGenRegion implements WorldGenLevel {
public long nextSubTickCount() {
return this.subTickCount.getAndIncrement();
}
@ -19474,7 +19474,7 @@ index ea72dcb064a35bc6245bc5c94d592efedd8faf41..0793dfe47e68a2b48b010aad5b12dcfa
public boolean remove(Object object) {
int i = this.findIndex((T)object);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4e96b6c05bf8b8235e91bdd26e5615c5299fd9aa..64ba2b3f8e0d5176dc24432ceb4a51eea1f24098 100644
index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c71b5f299 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -482,6 +482,58 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@ -19886,10 +19886,10 @@ index bd20bea7f76a7307f1698fb2dfef37125032d166..9a28912f52824acdc80a62243b136e6f
<T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e82cddd9a6 100644
index b1f6d6a12865f3b30e9136fb548fa0a48a5ecb6e..1f8e12f5bdd00c683bb55ffbb157d6c78500c683 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -539,6 +539,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -548,6 +548,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement
this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
@ -19901,7 +19901,7 @@ index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e8
}
if ((i & 1) != 0) {
@@ -933,7 +938,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -942,7 +947,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
// Paper end - Perf: Optimize capturedTileEntities lookup
// CraftBukkit end
@ -19910,7 +19910,7 @@ index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e8
}
public void setBlockEntity(BlockEntity blockEntity) {
@@ -1024,26 +1029,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1033,26 +1038,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
this.getProfiler().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList();
@ -19938,7 +19938,7 @@ index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e8
return list;
}
@@ -1061,33 +1047,23 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1070,33 +1056,23 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public <T extends Entity> void getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate, List<? super T> result, int limit) {
this.getProfiler().incrementCounter("getEntities");
@ -19988,7 +19988,7 @@ index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e8
}
@Nullable
@@ -1377,4 +1353,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1386,4 +1362,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
}
// Paper end - notify observers even if grow failed
@ -20077,7 +20077,7 @@ index c9cd18ce79a6ee7297a8fd14f4dbe712570b3ced..927bdebdb8ae01613f0cea074b3367bd
structurestart = structureAccessor.getStartForStructure(SectionPos.bottomOf(ichunkaccess), (Structure) holder.value(), ichunkaccess);
} while (structurestart == null);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index fca31bc427847141e7317b85a10da9e34e9e2bf6..50e86fd70aeb798daf3685e7f7dc780516dd76b4 100644
index bac191f92ea3735df19c68d5568c2c7962c8680f..5d94aee1303d9eca5f1fa9a2e033ad0d12909635 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -86,6 +86,7 @@ public class LevelChunk extends ChunkAccess {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] incremental chunk and player saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d7699ac1c627f265c403b9e00121f5f55e982341..0f3601f2f1a7ac53425129df6498ed0df302dec8 100644
index 498fc4ab46eac994f2a65c79eebddca2813f0b65..4bb0cf4d4eb0b648062c40a8347298002256d39e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -916,7 +916,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -17,7 +17,7 @@ index d7699ac1c627f265c403b9e00121f5f55e982341..0f3601f2f1a7ac53425129df6498ed0d
flag3 = this.saveAllChunks(suppressLogs, flush, force);
} finally {
this.isSaving = false;
@@ -1438,16 +1438,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1448,16 +1448,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
--this.ticksUntilAutosave;
@ -76,7 +76,7 @@ index f74efe41cd0da2f9749fc96fb9e0f7cf237ad1c6..d1728e13a7b649f308bde90ab633c79d
public void close() throws IOException {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e517037047013d0d55771fc08af9e03c4d334823..a0cf3652b4101c559532e9b04ef551c448aab1bc 100644
index d2fff98640a44f48d85044cd037cb3e9f8061125..b06cb60d937523e0143da9d93c3932ab64ead147 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1296,6 +1296,37 @@ public class ServerLevel extends Level implements WorldGenLevel {

Datei anzeigen

@ -29,10 +29,10 @@ index 02367ef1371dde94ff6c4cd40bd32e800d6ccaaf..7b0fc7135bc107103dcaed6dc0707b18
this.x = x;
this.y = y;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 143ab00a079c0bb2af8717567f7069e82cddd9a6..5f547c45b8fb943059b982697b28de47d44cff54 100644
index 1f8e12f5bdd00c683bb55ffbb157d6c78500c683..93763e0e8a632b1662556bcaff4f0e266ac1fbe4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -331,7 +331,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -340,7 +340,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end
public boolean isInWorldBounds(BlockPos pos) {

Datei anzeigen

@ -13,7 +13,7 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a0cf3652b4101c559532e9b04ef551c448aab1bc..63777efec582b8db9804914d554e8aedafcf08c8 100644
index b06cb60d937523e0143da9d93c3932ab64ead147..1d23269ef14bb625c202236f819a7f43cdd9d960 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2582,6 +2582,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

Datei anzeigen

@ -62,10 +62,10 @@ index bb8e962e63c7a2d931f9bd7f7c002aa35cfa5fd3..0fa131a6c98adb498fc8d534e0e39647
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {
// Paper start - Add predicate for blocks when raytracing
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 5f547c45b8fb943059b982697b28de47d44cff54..acfb87cd9ea3ca52f1ded99f0f7065fe5abd9af4 100644
index 93763e0e8a632b1662556bcaff4f0e266ac1fbe4..a5e5f393afcf641dda9e9d847280bebf2301157d 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -323,10 +323,87 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -332,10 +332,87 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return null;
}

Datei anzeigen

@ -17,7 +17,7 @@ Adds villagers as separate config
public net.minecraft.world.entity.Entity isInsidePortal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 63777efec582b8db9804914d554e8aedafcf08c8..d0adc0fab52c0b394d348fbf658eb77a7dfc7049 100644
index 1d23269ef14bb625c202236f819a7f43cdd9d960..aca9a9d8d004567f6189eff04c77063c561a8df0 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -111,7 +111,7 @@ index 63777efec582b8db9804914d554e8aedafcf08c8..d0adc0fab52c0b394d348fbf658eb77a
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 64ba2b3f8e0d5176dc24432ceb4a51eea1f24098..ab529d8c2c10fffd58fe4754882b558eed239fbd 100644
index 03840f520624662d4ce3ac9f3065a01c71b5f299..a13edd1165a5ba4dd3f5c323e454926e7fe75c07 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -414,6 +414,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@ -340,7 +340,7 @@ index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d
+
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index acfb87cd9ea3ca52f1ded99f0f7065fe5abd9af4..09608b495a460af86dabf34ccd8803cf1c0e3769 100644
index a5e5f393afcf641dda9e9d847280bebf2301157d..6d0437fa1dc43f69ed3e7cc61e0e6955c7d1f7ca 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -154,6 +154,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -1104,7 +1104,7 @@ index 183b2191fa1c1b27adedf39593e1b5a223fb1279..8ead66c134688b11dca15f6509147e72
private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d0adc0fab52c0b394d348fbf658eb77a7dfc7049..e16e7386bf7400415f5c210da4d29f497e581f56 100644
index aca9a9d8d004567f6189eff04c77063c561a8df0..ed8e875fff01c6b464fbaefbb0a3f417f9d67a72 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -575,7 +575,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -1168,7 +1168,7 @@ index 11f13eb06516aefca926e150b9b66bafdebf4226..5b031c7c13fb2c2e593eec4c8f6a973a
}
// Paper end - Send empty chunk
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 09608b495a460af86dabf34ccd8803cf1c0e3769..a137b4a3be01a0333e5fdc1585098fafeeb4f725 100644
index 6d0437fa1dc43f69ed3e7cc61e0e6955c7d1f7ca..a0d0c7d55158a00e0ca4bfaab67bb5c7f80f2a74 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -169,6 +169,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -1179,7 +1179,7 @@ index 09608b495a460af86dabf34ccd8803cf1c0e3769..a137b4a3be01a0333e5fdc1585098faf
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter;
@@ -194,7 +195,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -203,7 +204,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract ResourceKey<LevelStem> getTypeKey();
@ -1188,7 +1188,7 @@ index 09608b495a460af86dabf34ccd8803cf1c0e3769..a137b4a3be01a0333e5fdc1585098faf
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
this.generator = gen;
@@ -277,6 +278,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -286,6 +287,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper - Option to keep spawn chunks loaded
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
@ -1196,7 +1196,7 @@ index 09608b495a460af86dabf34ccd8803cf1c0e3769..a137b4a3be01a0333e5fdc1585098faf
}
// Paper start - Cancel hit for vanished players
@@ -552,6 +554,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -561,6 +563,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit end
BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag
@ -1230,7 +1230,7 @@ index 383dc47c81b3f34e8166bce180a51a2ccbfaf6ca..1aac95b03a9e2e37c24f2a30bcb259c1
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 50e86fd70aeb798daf3685e7f7dc780516dd76b4..a0b5cf2c7b743717c3001db17ed468de9a22a5fb 100644
index 5d94aee1303d9eca5f1fa9a2e033ad0d12909635..424c4613e202c6ba50fa0de65d2526d400a8e299 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -93,7 +93,7 @@ public class LevelChunk extends ChunkAccess {

Datei anzeigen

@ -26,7 +26,7 @@ index 5b031c7c13fb2c2e593eec4c8f6a973a3758a60b..65803c0927103e3ae63d8d8616f42090
// CraftBukkit end
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ab529d8c2c10fffd58fe4754882b558eed239fbd..1a8a52a77fa0b7891220bf0f04688f5b7eaa9bd7 100644
index a13edd1165a5ba4dd3f5c323e454926e7fe75c07..b57644317b5085d74d11ac6ba858c3747d703a47 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -245,6 +245,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

Datei anzeigen

@ -1,49 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Wed, 20 Mar 2024 20:41:35 -0400
Subject: [PATCH] Item Mutation Fixes
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
index 343f44db579839eb61376f876b5eff2e615dc2e5..e6935b6632c7a7e07f4da459c95f564356242f98 100644
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
@@ -229,7 +229,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
return false;
} else if (this.costs[id] > 0 && !itemstack.isEmpty() && (player.experienceLevel >= j && player.experienceLevel >= this.costs[id] || player.getAbilities().instabuild)) {
this.access.execute((world, blockposition) -> {
- ItemStack itemstack2 = itemstack;
+ ItemStack itemstack2 = itemstack; // Paper - diff on change
List<EnchantmentInstance> list = this.getEnchantmentList(itemstack, id, this.costs[id]);
// CraftBukkit start
@@ -251,11 +251,18 @@ public class EnchantmentMenu extends AbstractContainerMenu {
return;
}
// CraftBukkit end
- boolean flag = itemstack.is(Items.BOOK);
+ // Paper start
+ itemstack2 = org.bukkit.craftbukkit.inventory.CraftItemStack.getOrCloneOnMutation(item, event.getItem());
+ if (itemstack2 != itemstack) {
+ this.enchantSlots.setItem(0, itemstack2);
+ }
+ boolean flag = itemstack2.is(Items.BOOK);
+ // Paper end
if (flag) {
+ CompoundTag nbttagcompound = itemstack2.getTag(); // Paper - move up
itemstack2 = new ItemStack(Items.ENCHANTED_BOOK);
- CompoundTag nbttagcompound = itemstack.getTag();
+ // Paper - move up
if (nbttagcompound != null) {
itemstack2.setTag(nbttagcompound.copy());
@@ -277,7 +284,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
EnchantmentInstance weightedrandomenchant = new EnchantmentInstance(nms, entry.getValue());
EnchantedBookItem.addEnchantment(itemstack2, weightedrandomenchant);
} else {
- item.addUnsafeEnchantment(entry.getKey(), entry.getValue());
+ CraftItemStack.asCraftMirror(itemstack2).addUnsafeEnchantment(entry.getKey(), entry.getValue()); // Paper
}
} catch (IllegalArgumentException e) {
/* Just swallow invalid enchantments */