Increase diff stability

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-09-22 02:57:13 +10:00
parent 8a3c8cfcd4
commit e903417936
27 changed files with 162 additions and 170 deletions

View File

@@ -77,8 +77,8 @@
+ this.displayName = this.getScoreboardName();
+ this.bukkitPickUpLoot = true;
+ this.maxHealthCache = this.getMaxHealth();
+ }
+
}
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now.
+ // If this is an issue, PRs are welcome
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) {
@@ -115,9 +115,9 @@
+ }
+
+ return blockposition;
}
+ }
+ // CraftBukkit end
+
private void fudgeSpawnLocation(WorldServer worldserver) {
BlockPosition blockposition = worldserver.getSharedSpawnPos();
@@ -302,7 +302,9 @@
+ }
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(this.getInventory().getContainerSize());
+ boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
+
- if (flag) {
- IChatBaseComponent ichatbasecomponent = this.getCombatTracker().getDeathMessage();
+ if (!keepInventory) {
+ for (ItemStack item : this.getInventory().getContents()) {
+ if (!item.isEmpty() && !EnchantmentManager.hasVanishingCurse(item)) {
@@ -316,9 +318,7 @@
+ loot.add(item);
+ }
+ this.drops.clear(); // SPIGOT-5188: make sure to clear
- if (flag) {
- IChatBaseComponent ichatbasecomponent = this.getCombatTracker().getDeathMessage();
+
+ IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage();
+
+ String deathmessage = defaultMessage.getString();
@@ -480,7 +480,9 @@
+ exit = tpEvent.getTo();
+ worldserver = ((CraftWorld) exit.getWorld()).getHandle();
+ // CraftBukkit end
+
- worldserver1.getProfiler().pop();
- worldserver1.getProfiler().push("placing");
+ worldserver1.getProfiler().pop();
+ worldserver1.getProfiler().push("placing");
+ if (true) { // CraftBukkit
@@ -493,9 +495,7 @@
+ playerlist.sendPlayerPermissionLevel(this);
+ worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
+ this.unsetRemoved();
- worldserver1.getProfiler().pop();
- worldserver1.getProfiler().push("placing");
+
+ // CraftBukkit end
this.setServerLevel(worldserver);
- this.connection.teleport(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
@@ -583,14 +583,14 @@
+ // CraftBukkit start
+ ResourceKey<World> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(worldserver);
+ ResourceKey<World> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level());
+
- CriterionTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1);
- if (resourcekey == World.NETHER && resourcekey1 == World.OVERWORLD && this.enteredNetherPosition != null) {
+ CriterionTriggers.CHANGED_DIMENSION.trigger(this, maindimensionkey, maindimensionkey1);
+ if (maindimensionkey != resourcekey || maindimensionkey1 != resourcekey1) {
+ CriterionTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1);
+ }
- CriterionTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1);
- if (resourcekey == World.NETHER && resourcekey1 == World.OVERWORLD && this.enteredNetherPosition != null) {
+
+ if (maindimensionkey == World.NETHER && maindimensionkey1 == World.OVERWORLD && this.enteredNetherPosition != null) {
+ // CraftBukkit end
CriterionTriggers.NETHER_TRAVEL.trigger(this, this.enteredNetherPosition);