Apply and move up non-optimization patches
This commit is contained in:
parent
f6ea3736a7
commit
ec4ada852e
34 changed files with 217 additions and 299 deletions
|
@ -0,0 +1,103 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: leguan <longboard.noah@gmail.com>
|
||||
Date: Sun, 10 Mar 2024 20:10:41 +0100
|
||||
Subject: [PATCH] Add onboarding message for initial server start
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
index c01b4393439838976965823298f12e4762e72eff..218bf89fd7583d6db9f64754c4db8fcce5415bdb 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
@@ -126,6 +126,7 @@ public abstract class Configurations<G, W> {
|
||||
if (Files.notExists(configFile)) {
|
||||
node = CommentedConfigurationNode.root(loader.defaultOptions());
|
||||
node.node(Configuration.VERSION_FIELD).raw(this.globalConfigVersion());
|
||||
+ GlobalConfiguration.isFirstStart = true;
|
||||
} else {
|
||||
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 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 {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
static final int CURRENT_VERSION = 29; // (when you change the version, change the comment, so it conflicts on rebases): <insert changes here>
|
||||
private static GlobalConfiguration instance;
|
||||
+ public static boolean isFirstStart = false;
|
||||
public static GlobalConfiguration get() {
|
||||
return instance;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..325ba58a1c79fd928ac22d8f1ef93605357300d2 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1132,6 +1132,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
long tickSection = Util.getNanos();
|
||||
long currentTime;
|
||||
// Paper end - further improve server tick loop
|
||||
+ // Paper start - Add onboarding message for initial server start
|
||||
+ if (io.papermc.paper.configuration.GlobalConfiguration.isFirstStart) {
|
||||
+ LOGGER.info("*************************************************************************************");
|
||||
+ LOGGER.info("This is the first time you're starting this server.");
|
||||
+ LOGGER.info("It's recommended you read our 'Getting Started' documentation for guidance.");
|
||||
+ LOGGER.info("View this and more helpful information here: https://docs.papermc.io/paper/next-steps");
|
||||
+ LOGGER.info("*************************************************************************************");
|
||||
+ }
|
||||
+ // Paper end - Add onboarding message for initial server start
|
||||
+
|
||||
while (this.running) {
|
||||
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 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 {
|
||||
this.setLayout(new BorderLayout());
|
||||
|
||||
try {
|
||||
+ this.add(this.buildOnboardingPanel(), "North"); // Paper - Add onboarding message for initial server start
|
||||
this.add(this.buildChatPanel(), "Center");
|
||||
this.add(this.buildInfoPanel(), "West");
|
||||
} catch (Exception exception) {
|
||||
@@ -115,6 +116,39 @@ public class MinecraftServerGui extends JComponent {
|
||||
return jpanel;
|
||||
}
|
||||
|
||||
+ // Paper start - Add onboarding message for initial server start
|
||||
+ private JComponent buildOnboardingPanel() {
|
||||
+ String onboardingLink = "https://docs.papermc.io/paper/next-steps";
|
||||
+ JPanel jPanel = new JPanel();
|
||||
+
|
||||
+ javax.swing.JLabel jLabel = new javax.swing.JLabel("If you need help setting up your server you can visit:");
|
||||
+ jLabel.setFont(MinecraftServerGui.MONOSPACED);
|
||||
+
|
||||
+ javax.swing.JLabel link = new javax.swing.JLabel("<html><u> " + onboardingLink + "</u></html>");
|
||||
+ link.setFont(MinecraftServerGui.MONOSPACED);
|
||||
+ link.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
|
||||
+ link.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
+ @Override
|
||||
+ public void mouseClicked(final java.awt.event.MouseEvent e) {
|
||||
+ try {
|
||||
+ java.awt.Desktop.getDesktop().browse(java.net.URI.create(onboardingLink));
|
||||
+ } catch (java.io.IOException exception) {
|
||||
+ LOGGER.error("Unable to find a default browser. Please manually visit the website: " + onboardingLink, exception);
|
||||
+ } catch (UnsupportedOperationException exception) {
|
||||
+ LOGGER.error("This platform does not support the BROWSE action. Please manually visit the website: " + onboardingLink, exception);
|
||||
+ } catch (SecurityException exception) {
|
||||
+ LOGGER.error("This action has been denied by the security manager. Please manually visit the website: " + onboardingLink, exception);
|
||||
+ }
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ jPanel.add(jLabel);
|
||||
+ jPanel.add(link);
|
||||
+
|
||||
+ return jPanel;
|
||||
+ }
|
||||
+ // Paper end - Add onboarding message for initial server start
|
||||
+
|
||||
private JComponent buildPlayerPanel() {
|
||||
JList<?> jlist = new PlayerListComponent(this.server);
|
||||
JScrollPane jscrollpane = new JScrollPane(jlist, 22, 30);
|
22
patches/server/0971-Configurable-max-block-fluid-ticks.patch
Normal file
22
patches/server/0971-Configurable-max-block-fluid-ticks.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Gero <gecam59@gmail.com>
|
||||
Date: Mon, 19 Feb 2024 17:39:59 +0100
|
||||
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 06c185eae0063ff1b1714be0a5c7b0cdd538816b..b6a4feb182975b36c397a7b6e8ee37e4dbaddb64 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -500,9 +500,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (!this.isDebug() && flag) {
|
||||
j = this.getGameTime();
|
||||
gameprofilerfiller.push("blockTicks");
|
||||
- this.blockTicks.tick(j, 65536, this::tickBlock);
|
||||
+ this.blockTicks.tick(j, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks
|
||||
gameprofilerfiller.popPush("fluidTicks");
|
||||
- this.fluidTicks.tick(j, 65536, this::tickFluid);
|
||||
+ this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks
|
||||
gameprofilerfiller.pop();
|
||||
}
|
||||
this.timings.scheduledBlocks.stopTiming(); // Paper
|
19
patches/server/0972-Disable-memory-reserve-allocating.patch
Normal file
19
patches/server/0972-Disable-memory-reserve-allocating.patch
Normal file
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Warrior <50800980+Warriorrrr@users.noreply.github.com>
|
||||
Date: Thu, 18 Jan 2024 23:25:09 +0100
|
||||
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 06c514b2d0674cd7df6692981f020437ea0f2f91..bcb6a3b3cd17ce5db9aaf6bd3ec7a0ec1b44b979 100644
|
||||
--- a/src/main/java/net/minecraft/CrashReport.java
|
||||
+++ b/src/main/java/net/minecraft/CrashReport.java
|
||||
@@ -250,7 +250,7 @@ public class CrashReport {
|
||||
}
|
||||
|
||||
public static void preload() {
|
||||
- MemoryReserve.allocate();
|
||||
+ // MemoryReserve.allocate(); // Paper - Disable memory reserve allocating
|
||||
(new CrashReport("Don't panic!", new Throwable())).getFriendlyReport();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: RodneyMKay <36546810+RodneyMKay@users.noreply.github.com>
|
||||
Date: Sun, 11 Feb 2024 20:05:11 +0100
|
||||
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 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 {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
- flag = entity.hurt(this.damageSources().magic(), 5.0F);
|
||||
+ flag = entity.hurt(this.damageSources().magic().customCausingEntity(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls
|
||||
}
|
||||
|
||||
if (flag && entity instanceof LivingEntity) {
|
204
patches/server/0974-Fix-DamageSource-API.patch
Normal file
204
patches/server/0974-Fix-DamageSource-API.patch
Normal file
|
@ -0,0 +1,204 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 9 Mar 2024 14:13:04 -0800
|
||||
Subject: [PATCH] Fix DamageSource API
|
||||
|
||||
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 a78fd4f9ce97ebece45979908382de8f5fc14c1b..160dc3216e8f5db5f9b3cce5e2d655f2b35b208a 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -28,7 +28,8 @@ public class DamageSource {
|
||||
private boolean withSweep = false;
|
||||
private boolean melting = false;
|
||||
private boolean poison = false;
|
||||
- private Entity customCausingEntity = null; // This field is a helper for when causing entity damage is not set by vanilla
|
||||
+ @Nullable
|
||||
+ private Entity customEventDamager = null; // This field is a helper for when causing entity damage is not set by vanilla // Paper - fix DamageSource API
|
||||
|
||||
public DamageSource sweep() {
|
||||
this.withSweep = true;
|
||||
@@ -57,18 +58,18 @@ public class DamageSource {
|
||||
return this.poison;
|
||||
}
|
||||
|
||||
- public Entity getCausingEntity() {
|
||||
- return (this.customCausingEntity != null) ? this.customCausingEntity : this.causingEntity;
|
||||
+ // Paper start - fix DamageSource API
|
||||
+ public @Nullable Entity getCustomEventDamager() {
|
||||
+ return (this.customEventDamager != null) ? this.customEventDamager : this.directEntity;
|
||||
}
|
||||
|
||||
- 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 custom event damager when direct entity is already set (report a bug to Paper)");
|
||||
}
|
||||
DamageSource damageSource = this.cloneInstance();
|
||||
- damageSource.customCausingEntity = entity;
|
||||
+ damageSource.customEventDamager = entity;
|
||||
+ // Paper end - fix DamageSource API
|
||||
return damageSource;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 4e96b6c05bf8b8235e91bdd26e5615c5299fd9aa..3c1bcf8d1a07b35a8688160c9f05f792451338a3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3195,7 +3195,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return;
|
||||
}
|
||||
|
||||
- if (!this.hurt(this.damageSources().lightningBolt().customCausingEntity(lightning), 5.0F)) {
|
||||
+ if (!this.hurt(this.damageSources().lightningBolt().customEventDamager(lightning), 5.0F)) { // Paper - fix DamageSource API
|
||||
return;
|
||||
}
|
||||
// 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 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
|
||||
@@ -334,7 +334,7 @@ public class Turtle extends Animal {
|
||||
|
||||
@Override
|
||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||
- this.hurt(this.damageSources().lightningBolt().customCausingEntity(lightning), Float.MAX_VALUE); // CraftBukkit
|
||||
+ this.hurt(this.damageSources().lightningBolt().customEventDamager(lightning), Float.MAX_VALUE); // CraftBukkit // Paper - fix DamageSource API
|
||||
}
|
||||
|
||||
@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 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
|
||||
@@ -203,7 +203,7 @@ public abstract class HangingEntity extends Entity {
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level().isClientSide) {
|
||||
// CraftBukkit start - fire break events
|
||||
- Entity damager = (source.isIndirect()) ? source.getEntity() : source.getDirectEntity();
|
||||
+ Entity damager = (source.isIndirect() && source.getEntity() != null) ? source.getEntity() : source.getDirectEntity(); // Paper - fix DamageSource API
|
||||
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 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
|
||||
@@ -133,7 +133,7 @@ public class EvokerFangs extends Entity implements TraceableEntity {
|
||||
|
||||
if (target.isAlive() && !target.isInvulnerable() && target != entityliving1) {
|
||||
if (entityliving1 == null) {
|
||||
- target.hurt(this.damageSources().magic().customCausingEntity(this), 6.0F); // CraftBukkit
|
||||
+ target.hurt(this.damageSources().magic().customEventDamager(this), 6.0F); // CraftBukkit // Paper - fix DamageSource API
|
||||
} else {
|
||||
if (entityliving1.isAlliedTo((Entity) target)) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
index 28690877c443ceb2bdf20e6d251c9d32f667814c..1fb1e729d6879568d8b4943071fa940325b2e5b0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
||||
@@ -86,7 +86,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
|
||||
|
||||
entityplayer.connection.teleport(teleEvent.getTo());
|
||||
entity.resetFallDistance();
|
||||
- entity.hurt(this.damageSources().fall().customCausingEntity(this), 5.0F); // CraftBukkit
|
||||
+ entity.hurt(this.damageSources().fall().customEventDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API
|
||||
}
|
||||
// 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 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 {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
- flag = entity.hurt(this.damageSources().magic().customCausingEntity(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls
|
||||
+ flag = entity.hurt(this.damageSources().magic().customEventDamager(this), 5.0F); // Paper - Fire EntityDamageByEntityEvent for unowned wither skulls // Paper - fix DamageSource API
|
||||
}
|
||||
|
||||
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 fbd1f4f3a8c94a4842f91b7cc6c21f0cf7edd7ac..550c0cf4d84afc0cd6b2675bdc6aa2282d87e312 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -104,7 +104,7 @@ public class Explosion {
|
||||
this.z = z;
|
||||
this.fire = createFire;
|
||||
this.blockInteraction = destructionType;
|
||||
- this.damageSource = damageSource == null ? world.damageSources().explosion(this).customCausingEntity(entity) : damageSource.customCausingEntity(entity); // CraftBukkit - handle source entity
|
||||
+ this.damageSource = damageSource == null ? world.damageSources().explosion(this) : damageSource; // CraftBukkit - handle source entity // Paper - revert to fix DamageSource API
|
||||
this.damageCalculator = behavior == null ? this.makeDamageCalculator(entity) : behavior;
|
||||
this.smallExplosionParticles = particle;
|
||||
this.largeExplosionParticles = emitterParticle;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java b/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
|
||||
index 6ae1ad21807c039726021f8f26f92042acce2fda..b7e2327c50195e8d3ca3ca3b47c7c0f9ea8e289c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
|
||||
@@ -41,7 +41,7 @@ public class CraftDamageSource implements DamageSource {
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getCausingEntity() {
|
||||
- net.minecraft.world.entity.Entity entity = this.getHandle().getCausingEntity();
|
||||
+ net.minecraft.world.entity.Entity entity = this.getHandle().getEntity(); // Paper - fix DamageSource API
|
||||
return (entity != null) ? entity.getBukkitEntity() : null;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class CraftDamageSource implements DamageSource {
|
||||
|
||||
@Override
|
||||
public boolean isIndirect() {
|
||||
- return this.getHandle().getCausingEntity() != this.getHandle().getDirectEntity();
|
||||
+ return this.getHandle().isIndirect(); // Paper - fix DamageSource API
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSourceBuilder.java b/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSourceBuilder.java
|
||||
index 4c6e15535fa40aad8cf1920f392589404f9ba79c..35eb95ef6fb6a0f7ea63351e90741c489fdd15f9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSourceBuilder.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSourceBuilder.java
|
||||
@@ -41,6 +41,11 @@ public class CraftDamageSourceBuilder implements DamageSource.Builder {
|
||||
|
||||
@Override
|
||||
public DamageSource build() {
|
||||
+ // Paper start - fix DamageCause API
|
||||
+ if (this.causingEntity != null && this.directEntity == null) {
|
||||
+ throw new IllegalArgumentException("Direct entity must be set if causing entity is set");
|
||||
+ }
|
||||
+ // Paper end - fix DamageCause API
|
||||
return CraftDamageSource.buildFromBukkit(this.damageType, this.causingEntity, this.directEntity, this.damageLocation);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 444287fea080182df533198f5c659533de86c5dc..0a06b9f9691896dc9d5b67361e41d9f049422020 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -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 = (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
|
|
@ -0,0 +1,40 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Pierpaolo Coletta <p.coletta@glyart.com>
|
||||
Date: Sat, 30 Mar 2024 21:06:10 +0100
|
||||
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 713509e08c6325816fef7c09477d36aacb0008ef..8f8cbb9cc7febe3eb1c7de2be3953f67b0b58116 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -339,6 +339,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
ichunkaccess.removeBlockEntity(pos);
|
||||
}
|
||||
} else {
|
||||
+ ichunkaccess.removeBlockEntity(pos); // Paper - Clear the block entity before setting up a DUMMY block entity
|
||||
CompoundTag nbttagcompound = new CompoundTag();
|
||||
|
||||
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 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
|
||||
@@ -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;
|
||||
- } else if (!this.loggedInvalidBlockState) {
|
||||
- this.loggedInvalidBlockState = true;
|
||||
- LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
|
||||
+ // Paper start - Remove the Block Entity if it's invalid
|
||||
+ } else {
|
||||
+ LevelChunk.this.removeBlockEntity(this.getPos());
|
||||
+ if (!this.loggedInvalidBlockState) {
|
||||
+ this.loggedInvalidBlockState = true;
|
||||
+ LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
|
||||
+ }
|
||||
+ // Paper end - Remove the Block Entity if it's invalid
|
||||
}
|
||||
|
||||
gameprofilerfiller.pop();
|
|
@ -0,0 +1,108 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 29 Oct 2022 17:02:42 -0700
|
||||
Subject: [PATCH] Fix possible StackOverflowError for some dispenses
|
||||
|
||||
For saddles, carpets, horse armor, and chests for horse-likes
|
||||
a BlockDispenseEvent handler that always mutated the item without
|
||||
changing the type would result in a SO error because when it went
|
||||
to find the replacement dispense behavior (since the item "changed")
|
||||
it didn't properly handle if the replacement was the same instance
|
||||
of dispense behavior.
|
||||
|
||||
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 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896d8ea1f91 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -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());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
@@ -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());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
@@ -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());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return stack;
|
||||
}
|
||||
@@ -710,7 +710,7 @@ public interface DispenseItemBehavior {
|
||||
OptionalDispenseItemBehavior dispensebehaviormaybe1 = new OptionalDispenseItemBehavior() {
|
||||
@Override
|
||||
protected ItemStack execute(BlockSource pointer, ItemStack stack) {
|
||||
- this.setSuccess(ArmorItem.dispenseArmor(pointer, stack));
|
||||
+ this.setSuccess(ArmorItem.dispenseArmor(pointer, stack, this)); // Paper - fix possible StackOverflowError
|
||||
return stack;
|
||||
}
|
||||
};
|
||||
@@ -764,7 +764,7 @@ public interface DispenseItemBehavior {
|
||||
stack.shrink(1);
|
||||
this.setSuccess(true);
|
||||
} else {
|
||||
- this.setSuccess(ArmorItem.dispenseArmor(pointer, stack));
|
||||
+ this.setSuccess(ArmorItem.dispenseArmor(pointer, stack, this)); // Paper - fix possible StackOverflowError
|
||||
}
|
||||
|
||||
return stack;
|
||||
@@ -810,7 +810,7 @@ public interface DispenseItemBehavior {
|
||||
stack.shrink(1);
|
||||
this.setSuccess(true);
|
||||
} else {
|
||||
- this.setSuccess(ArmorItem.dispenseArmor(pointer, stack));
|
||||
+ this.setSuccess(ArmorItem.dispenseArmor(pointer, stack, this)); // Paper - fix possible StackOverflowError
|
||||
}
|
||||
|
||||
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 e766397aae3f73548b290b0809b9d1ca0967ea39..786e4a8700cb84b16dd9b8892a0d1d5803924d81 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
@@ -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) {
|
||||
- return ArmorItem.dispenseArmor(pointer, stack) ? stack : super.execute(pointer, stack);
|
||||
+ return ArmorItem.dispenseArmor(pointer, stack, this) ? stack : super.execute(pointer, stack); // Paper - fix possible StackOverflowError
|
||||
}
|
||||
};
|
||||
protected final ArmorItem.Type type;
|
||||
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) {
|
||||
+ // Paper start
|
||||
+ return dispenseArmor(pointer, armor, null);
|
||||
+ }
|
||||
+ public static boolean dispenseArmor(BlockSource pointer, ItemStack armor, @javax.annotation.Nullable DispenseItemBehavior currentBehavior) {
|
||||
+ // Paper end
|
||||
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)));
|
||||
|
||||
@@ -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());
|
||||
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ if (idispensebehavior != DispenseItemBehavior.NOOP && (currentBehavior == null || idispensebehavior != currentBehavior)) { // Paper - fix possible StackOverflowError
|
||||
idispensebehavior.dispense(pointer, eventStack);
|
||||
return true;
|
||||
}
|
202
patches/server/0977-Improve-tag-parser-handling.patch
Normal file
202
patches/server/0977-Improve-tag-parser-handling.patch
Normal file
|
@ -0,0 +1,202 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Date: Mon, 5 Feb 2024 11:54:04 +0100
|
||||
Subject: [PATCH] Improve tag parser handling
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/mojang/brigadier/CommandDispatcher.java b/src/main/java/com/mojang/brigadier/CommandDispatcher.java
|
||||
index 92848b64a78fce7a92e1657c2da6fc5ee53eea44..4b4f812eb13d5f03bcf3f8724d8aa8dbbc724e8b 100644
|
||||
--- a/src/main/java/com/mojang/brigadier/CommandDispatcher.java
|
||||
+++ b/src/main/java/com/mojang/brigadier/CommandDispatcher.java
|
||||
@@ -304,9 +304,15 @@ public class CommandDispatcher<S> {
|
||||
}
|
||||
final CommandContextBuilder<S> context = contextSoFar.copy();
|
||||
final StringReader reader = new StringReader(originalReader);
|
||||
+ boolean stop = false; // Paper - Handle non-recoverable exceptions
|
||||
try {
|
||||
try {
|
||||
child.parse(reader, context);
|
||||
+ // Paper start - Handle non-recoverable exceptions
|
||||
+ } catch (final io.papermc.paper.brigadier.TagParseCommandSyntaxException e) {
|
||||
+ stop = true;
|
||||
+ throw e;
|
||||
+ // Paper end - Handle non-recoverable exceptions
|
||||
} catch (final RuntimeException ex) {
|
||||
throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherParseException().createWithContext(reader, ex.getMessage());
|
||||
}
|
||||
@@ -321,6 +327,7 @@ public class CommandDispatcher<S> {
|
||||
}
|
||||
errors.put(child, ex);
|
||||
reader.setCursor(cursor);
|
||||
+ if (stop) return new ParseResults<>(contextSoFar, originalReader, errors); // Paper - Handle non-recoverable exceptions
|
||||
continue;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/brigadier/TagParseCommandSyntaxException.java b/src/main/java/io/papermc/paper/brigadier/TagParseCommandSyntaxException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a375ad4ba9db990b24a2b9ff366fcba66b753815
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/brigadier/TagParseCommandSyntaxException.java
|
||||
@@ -0,0 +1,15 @@
|
||||
+package io.papermc.paper.brigadier;
|
||||
+
|
||||
+import com.mojang.brigadier.LiteralMessage;
|
||||
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
+import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
+import net.minecraft.network.chat.Component;
|
||||
+
|
||||
+public final class TagParseCommandSyntaxException extends CommandSyntaxException {
|
||||
+
|
||||
+ private static final SimpleCommandExceptionType EXCEPTION_TYPE = new SimpleCommandExceptionType(new LiteralMessage("Error parsing NBT"));
|
||||
+
|
||||
+ public TagParseCommandSyntaxException(final String message) {
|
||||
+ super(EXCEPTION_TYPE, Component.literal(message));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java
|
||||
index da101bca71f4710812621b98f0a0d8cab180346a..3cd112584accb8e8f050ac99738eed11c902e60e 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/TagParser.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/TagParser.java
|
||||
@@ -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();
|
||||
@@ -159,6 +160,7 @@ public class TagParser {
|
||||
|
||||
public CompoundTag readStruct() throws CommandSyntaxException {
|
||||
this.expect('{');
|
||||
+ this.increaseDepth(); // Paper
|
||||
CompoundTag compoundTag = new CompoundTag();
|
||||
this.reader.skipWhitespace();
|
||||
|
||||
@@ -182,6 +184,7 @@ public class TagParser {
|
||||
}
|
||||
|
||||
this.expect('}');
|
||||
+ this.depth--; // Paper
|
||||
return compoundTag;
|
||||
}
|
||||
|
||||
@@ -191,6 +194,7 @@ public class TagParser {
|
||||
if (!this.reader.canRead()) {
|
||||
throw ERROR_EXPECTED_VALUE.createWithContext(this.reader);
|
||||
} else {
|
||||
+ this.increaseDepth(); // Paper
|
||||
ListTag listTag = new ListTag();
|
||||
TagType<?> tagType = null;
|
||||
|
||||
@@ -216,6 +220,7 @@ public class TagParser {
|
||||
}
|
||||
|
||||
this.expect(']');
|
||||
+ this.depth--; // Paper
|
||||
return listTag;
|
||||
}
|
||||
}
|
||||
@@ -288,4 +293,11 @@ public class TagParser {
|
||||
this.reader.skipWhitespace();
|
||||
this.reader.expect(c);
|
||||
}
|
||||
+
|
||||
+ private void increaseDepth() throws CommandSyntaxException {
|
||||
+ this.depth++;
|
||||
+ if (this.depth > 512) {
|
||||
+ throw new io.papermc.paper.brigadier.TagParseCommandSyntaxException("NBT tag is too complex, depth > 512");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
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 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 {
|
||||
|
||||
@Override
|
||||
public <T> Optional<T> visit(FormattedText.ContentConsumer<T> visitor) {
|
||||
+ // Paper start - Count visited parts
|
||||
+ try {
|
||||
+ return this.visit(new TranslatableContentConsumer<>(visitor));
|
||||
+ } catch (IllegalArgumentException ignored) {
|
||||
+ return visitor.accept("...");
|
||||
+ }
|
||||
+ }
|
||||
+ private <T> Optional<T> visit(TranslatableContentConsumer<T> visitor) {
|
||||
+ // Paper end - Count visited parts
|
||||
this.decompose();
|
||||
|
||||
for (FormattedText formattedText : this.decomposedParts) {
|
||||
@@ -192,6 +201,25 @@ public class TranslatableContents implements ComponentContents {
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
+ // Paper start - Count visited parts
|
||||
+ private static final class TranslatableContentConsumer<T> implements FormattedText.ContentConsumer<T> {
|
||||
+ private static final IllegalArgumentException EX = new IllegalArgumentException("Too long");
|
||||
+ private final FormattedText.ContentConsumer<T> visitor;
|
||||
+ private int visited;
|
||||
+
|
||||
+ private TranslatableContentConsumer(FormattedText.ContentConsumer<T> visitor) {
|
||||
+ this.visitor = visitor;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Optional<T> accept(final String asString) {
|
||||
+ if (visited++ > 32) {
|
||||
+ throw EX;
|
||||
+ }
|
||||
+ return this.visitor.accept(asString);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - Count visited parts
|
||||
|
||||
@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 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
|
||||
@@ -19,7 +19,7 @@ public class ServerboundCommandSuggestionPacket implements Packet<ServerGamePack
|
||||
|
||||
private ServerboundCommandSuggestionPacket(FriendlyByteBuf buf) {
|
||||
this.id = buf.readVarInt();
|
||||
- this.command = buf.readUtf(32500);
|
||||
+ this.command = buf.readUtf(2048); // Paper
|
||||
}
|
||||
|
||||
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 d6c767c8fee799e895058c8ef3dad96cc580675d..6061f7104dd2094e316739a1b0e541475aed40b0 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -769,6 +769,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
return;
|
||||
}
|
||||
// Paper end - Don't suggest if tab-complete is disabled
|
||||
+ // Paper start
|
||||
+ final int index;
|
||||
+ if (packet.getCommand().length() > 64 && ((index = packet.getCommand().indexOf(' ')) == -1 || index >= 64)) {
|
||||
+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
// Paper start - AsyncTabCompleteEvent
|
||||
TAB_COMPLETE_EXECUTOR.execute(() -> this.handleCustomCommandSuggestions0(packet));
|
||||
}
|
||||
@@ -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());
|
||||
+ // Paper start - Handle non-recoverable exceptions
|
||||
+ if (!parseresults.getExceptions().isEmpty()
|
||||
+ && parseresults.getExceptions().values().stream().anyMatch(e -> e instanceof io.papermc.paper.brigadier.TagParseCommandSyntaxException)) {
|
||||
+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - Handle non-recoverable exceptions
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
// Paper start - Don't tab-complete namespaced commands if send-namespaced is false
|
38
patches/server/0978-Item-Mutation-Fixes.patch
Normal file
38
patches/server/0978-Item-Mutation-Fixes.patch
Normal file
|
@ -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()) {
|
35
patches/server/0979-Per-world-ticks-per-spawn-settings.patch
Normal file
35
patches/server/0979-Per-world-ticks-per-spawn-settings.patch
Normal file
|
@ -0,0 +1,35 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
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 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..b1f6d6a12865f3b30e9136fb548fa0a48a5ecb6e 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
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
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..d194c08a50493da39f2457dc55fed953f78c6199 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.getTag());
|
||||
+ // 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..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
|
||||
+++ 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);
|
||||
}
|
191
patches/server/0982-Suspicious-Effect-Entry-API.patch
Normal file
191
patches/server/0982-Suspicious-Effect-Entry-API.patch
Normal file
|
@ -0,0 +1,191 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Sun, 3 Mar 2024 19:43:40 +0100
|
||||
Subject: [PATCH] Suspicious Effect Entry API
|
||||
|
||||
Exposes a new suspicious effect entry type that properly represents
|
||||
storable effects in the context of suspicious effects as they only
|
||||
define the potion effect type and duration.
|
||||
|
||||
This differentiates them from the existing PotionEffect API found in
|
||||
bukkit and hence clarifies that storable values in the parts of the API
|
||||
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 9cc81bcccbf1141f66fedada1359b7c0dfa8e22a..7491c7cf38d888b31a509613d237b55f9732400a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
|
||||
@@ -34,11 +34,19 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
@Override
|
||||
public boolean addEffectToNextStew(PotionEffect potionEffect, boolean overwrite) {
|
||||
Preconditions.checkArgument(potionEffect != null, "PotionEffect cannot be null");
|
||||
- MobEffectInstance minecraftPotionEffect = CraftPotionUtil.fromBukkit(potionEffect);
|
||||
- if (!overwrite && this.hasEffectForNextStew(potionEffect.getType())) {
|
||||
+ return addEffectToNextStew(io.papermc.paper.potion.SuspiciousEffectEntry.create(potionEffect.getType(), potionEffect.getDuration()), overwrite);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ 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;
|
||||
}
|
||||
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()]);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public java.util.List<io.papermc.paper.potion.SuspiciousEffectEntry> getStewEffects() {
|
||||
+ if (this.getHandle().stewEffects == null) {
|
||||
+ return java.util.List.of();
|
||||
+ }
|
||||
+
|
||||
+ java.util.List<io.papermc.paper.potion.SuspiciousEffectEntry> nmsPairs = new java.util.ArrayList<>(this.getHandle().stewEffects.size());
|
||||
+ for (final net.minecraft.world.level.block.SuspiciousEffectHolder.EffectEntry effect : this.getHandle().stewEffects) {
|
||||
+ nmsPairs.add(io.papermc.paper.potion.SuspiciousEffectEntry.create(
|
||||
+ org.bukkit.craftbukkit.potion.CraftPotionEffectType.minecraftToBukkit(effect.effect()),
|
||||
+ effect.duration()
|
||||
+ ));
|
||||
+ }
|
||||
+
|
||||
+ return java.util.Collections.unmodifiableList(nmsPairs);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setStewEffects(final java.util.List<io.papermc.paper.potion.SuspiciousEffectEntry> effects) {
|
||||
+ if (effects.isEmpty()) {
|
||||
+ this.getHandle().stewEffects = null;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ java.util.List<net.minecraft.world.level.block.SuspiciousEffectHolder.EffectEntry> nmsPairs = new java.util.ArrayList<>(effects.size());
|
||||
+ for (final io.papermc.paper.potion.SuspiciousEffectEntry effect : effects) {
|
||||
+ nmsPairs.add(new net.minecraft.world.level.block.SuspiciousEffectHolder.EffectEntry(
|
||||
+ org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(effect.effect()),
|
||||
+ effect.duration()
|
||||
+ ));
|
||||
+ }
|
||||
+
|
||||
+ this.getHandle().stewEffects = nmsPairs;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
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 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..6b229ec0d4110fd0e758610bfacd9e8ec71ad2c5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
@@ -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);
|
||||
@@ -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) {
|
||||
- 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) {
|
||||
+ 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
|
||||
}
|
||||
tag.put(CraftMetaSuspiciousStew.EFFECTS, new SuspiciousStewEffects(effectList));
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
@Override
|
||||
public List<PotionEffect> getCustomEffects() {
|
||||
if (this.hasCustomEffects()) {
|
||||
- return ImmutableList.copyOf(this.customEffects);
|
||||
+ return this.customEffects.stream().map(suspiciousEffectEntry -> suspiciousEffectEntry.effect().createEffect(suspiciousEffectEntry.duration(), 0)).toList(); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
@@ -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");
|
||||
+ return addCustomEffect(io.papermc.paper.potion.SuspiciousEffectEntry.create(effect.getType(), effect.getDuration()), overwrite); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
+ }
|
||||
|
||||
- int index = this.indexOfEffect(effect.getType());
|
||||
+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
+ @Override
|
||||
+ public boolean addCustomEffect(final io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, final boolean overwrite) {
|
||||
+ Preconditions.checkArgument(suspiciousEffectEntry != null, "Suspicious effect entry cannot be null");
|
||||
+ int index = this.indexOfEffect(suspiciousEffectEntry.effect());
|
||||
if (index != -1) {
|
||||
if (overwrite) {
|
||||
- PotionEffect old = this.customEffects.get(index);
|
||||
- if (old.getDuration() == effect.getDuration()) {
|
||||
+ io.papermc.paper.potion.SuspiciousEffectEntry old = this.customEffects.get(index);
|
||||
+ if (old.duration() == suspiciousEffectEntry.duration()) {
|
||||
return false;
|
||||
}
|
||||
- this.customEffects.set(index, effect);
|
||||
+ this.customEffects.set(index, suspiciousEffectEntry);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -137,10 +143,11 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
if (this.customEffects == null) {
|
||||
this.customEffects = new ArrayList<>();
|
||||
}
|
||||
- this.customEffects.add(effect);
|
||||
+ this.customEffects.add(suspiciousEffectEntry);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
|
||||
@Override
|
||||
public boolean removeCustomEffect(PotionEffectType type) {
|
||||
@@ -151,10 +158,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
}
|
||||
|
||||
boolean changed = false;
|
||||
- Iterator<PotionEffect> iterator = this.customEffects.iterator();
|
||||
+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
+ Iterator<io.papermc.paper.potion.SuspiciousEffectEntry> iterator = this.customEffects.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
- PotionEffect effect = iterator.next();
|
||||
- if (type.equals(effect.getType())) {
|
||||
+ io.papermc.paper.potion.SuspiciousEffectEntry effect = iterator.next();
|
||||
+ if (type.equals(effect.effect())) {
|
||||
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
iterator.remove();
|
||||
changed = true;
|
||||
}
|
||||
@@ -177,7 +186,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.customEffects.size(); i++) {
|
||||
- if (this.customEffects.get(i).getType().equals(type)) {
|
||||
+ if (this.customEffects.get(i).effect().equals(type)) { // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -222,7 +231,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
super.serialize(builder);
|
||||
|
||||
if (this.hasCustomEffects()) {
|
||||
- builder.put(CraftMetaSuspiciousStew.EFFECTS.BUKKIT, ImmutableList.copyOf(this.customEffects));
|
||||
+ builder.put(CraftMetaSuspiciousStew.EFFECTS.BUKKIT, ImmutableList.copyOf(com.google.common.collect.Lists.transform(this.customEffects, s -> new PotionEffect(s.effect(), s.duration(), 0)))); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta - convert back to potion effect for bukkit legacy item serialisation to maintain backwards compatibility for the written format.
|
||||
}
|
||||
|
||||
return builder;
|
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: granny <contact@granny.dev>
|
||||
Date: Sat, 24 Feb 2024 19:33:01 -0800
|
||||
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 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
|
||||
@@ -111,7 +111,7 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
private boolean hasRemainingSpaceForItem(ItemStack existingStack, ItemStack stack) {
|
||||
- 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
|
19
patches/server/0984-disable-forced-empty-world-ticks.patch
Normal file
19
patches/server/0984-disable-forced-empty-world-ticks.patch
Normal file
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Tue, 21 Mar 2023 23:51:46 +0000
|
||||
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 b6a4feb182975b36c397a7b6e8ee37e4dbaddb64..f2ccc126bb75bd3b88f17af885a507fd5ab0d7e5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -527,7 +527,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
- boolean flag1 = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
||||
+ boolean flag1 = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this
|
||||
|
||||
if (flag1) {
|
||||
this.resetEmptyTime();
|
|
@ -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 {
|
|
@ -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 {
|
|
@ -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 {
|
|
@ -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) {
|
|
@ -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 {
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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 {
|
|
@ -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 {
|
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue