This commit is contained in:
Jake Potrebic
2024-06-13 10:12:48 -07:00
parent 0ef31547a1
commit 79da0788dd
66 changed files with 214 additions and 284 deletions

View File

@@ -67,7 +67,7 @@ repositories {
} }
dependencies { dependencies {
paramMappings("net.fabricmc:yarn:1.20.6+build.1:mergedv2") paramMappings("net.fabricmc:yarn:1.21+build.1:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.10.2:fat") remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
decompiler("org.vineflower:vineflower:1.10.1") decompiler("org.vineflower:vineflower:1.10.1")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13") spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13")

View File

@@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import com.destroystokyo.paper.event.block.BeaconEffectEvent; +import com.destroystokyo.paper.event.block.BeaconEffectEvent;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.util.Arrays; import java.util.Collection;
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.BlockState; @@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;

View File

@@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (entityhuman != null) { if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this); double d0 = entityhuman.distanceToSqr((Entity) this);

View File

@@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:46:17 -0600
Subject: [PATCH] Add configurable portal search radius
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -0,0 +0,0 @@ public class NetherPortalBlock extends Block implements Portal {
WorldBorder worldborder = worldserver1.getWorldBorder();
double d0 = DimensionType.getTeleportationScale(world.dimensionType(), worldserver1.dimensionType());
BlockPos blockposition1 = worldborder.clampToBounds(entity.getX() * d0, entity.getY(), entity.getZ() * d0);
+ // Paper start - Configurable portal search radius
+ int portalSearchRadius = worldserver1.paperConfig().environment.portalSearchRadius;
+ if (entity.level().paperConfig().environment.portalSearchVanillaDimensionScaling && flag) { // flag = is going to nether
+ portalSearchRadius = (int) (portalSearchRadius / worldserver1.dimensionType().coordinateScale());
+ }
+ // Paper end - Configurable portal search radius
// CraftBukkit start
- CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag ? 16 : 128, 16);
+ CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, 16); // Paper - use custom portal search radius
if (event == null) {
return null;
}
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -0,0 +0,0 @@ public class PortalForcer {
this.level = world;
}
+ @io.papermc.paper.annotation.DoNotUse // Paper
public Optional<BlockPos> findClosestPortalPosition(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) {
// CraftBukkit start
return this.findClosestPortalPosition(pos, worldBorder, destIsNether ? 16 : 128); // Search Radius

View File

@@ -2600,7 +2600,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, CommandSource, AutoCloseable { public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource, AutoCloseable {
public static final Logger LOGGER = LogUtils.getLogger(); public static final Logger LOGGER = LogUtils.getLogger();
+ public static final net.kyori.adventure.text.logger.slf4j.ComponentLogger COMPONENT_LOGGER = net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(LOGGER.getName()); // Paper + public static final net.kyori.adventure.text.logger.slf4j.ComponentLogger COMPONENT_LOGGER = net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(LOGGER.getName()); // Paper
@@ -2692,7 +2692,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ import net.minecraft.world.damagesource.CombatTracker; @@ -0,0 +0,0 @@ import net.minecraft.world.item.trading.MerchantOffers;
import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.Scoreboard;
import net.minecraft.world.scores.Team; import net.minecraft.world.scores.Team;
import net.minecraft.world.scores.criteria.ObjectiveCriteria; import net.minecraft.world.scores.criteria.ObjectiveCriteria;
@@ -2700,7 +2700,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.WeatherType; import org.bukkit.WeatherType;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
private boolean disconnected; private boolean disconnected;
private int requestedViewDistance; private int requestedViewDistance;
public String language = "en_us"; // CraftBukkit - default public String language = "en_us"; // CraftBukkit - default
@@ -2708,7 +2708,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable @Nullable
private Vec3 startingToFallPosition; private Vec3 startingToFallPosition;
@Nullable @Nullable
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
// CraftBukkit start // CraftBukkit start
public CraftPlayer.TransferCookieConnection transferCookieConnection; public CraftPlayer.TransferCookieConnection transferCookieConnection;
public String displayName; public String displayName;
@@ -2716,7 +2716,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Component listName; public Component listName;
public org.bukkit.Location compassTarget; public org.bukkit.Location compassTarget;
public int newExp = 0; public int newExp = 0;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
// CraftBukkit start // CraftBukkit start
this.displayName = this.getScoreboardName(); this.displayName = this.getScoreboardName();
@@ -2724,7 +2724,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.bukkitPickUpLoot = true; this.bukkitPickUpLoot = true;
this.maxHealthCache = this.getMaxHealth(); this.maxHealthCache = this.getMaxHealth();
} }
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
String deathmessage = defaultMessage.getString(); String deathmessage = defaultMessage.getString();
this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel
@@ -2751,7 +2751,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> { this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
boolean flag1 = true; boolean flag1 = true;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
} }
public void sendChatMessage(OutgoingChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) { public void sendChatMessage(OutgoingChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) {
@@ -2766,7 +2766,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
} }
// CraftBukkit end // CraftBukkit end
this.language = clientOptions.language(); this.language = clientOptions.language();
@@ -2797,7 +2797,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.server = minecraftserver; this.server = minecraftserver;
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id()); ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id());
this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect")); this.disconnect((Component) Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
} }
+ // Paper start - adventure pack callbacks + // Paper start - adventure pack callbacks
+ // call the callbacks before the previously-existing event so the event has final say + // call the callbacks before the previously-existing event so the event has final say
@@ -2815,36 +2815,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
// CraftBukkit start
@Deprecated
- public void disconnect(Component reason) {
- this.disconnect(CraftChatMessage.fromComponent(reason));
+ public void disconnect(String s) { // Paper
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); // Paper
} }
// CraftBukkit end }
- public void disconnect(String s) { + // Paper start - adventure
+ // Paper start + public void disconnect(@Nullable final net.kyori.adventure.text.Component reason) {
+ public void disconnect(final Component reason) { + this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(reason));
+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason));
+ } + }
+ // Paper end - adventure
+ +
+ public void disconnect(net.kyori.adventure.text.Component reason) { public void disconnect(Component reason) {
+ // Paper end this.disconnect(new DisconnectionDetails(reason));
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
return;
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
- ServerCommonPacketListenerImpl.this.disconnect(s);
+ ServerCommonPacketListenerImpl.this.disconnect(reason); // Paper - adventure
return null;
} }
};
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
return; return;
} }
@@ -2852,8 +2834,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- String leaveMessage = ChatFormatting.YELLOW + this.player.getScoreboardName() + " left the game."; - String leaveMessage = ChatFormatting.YELLOW + this.player.getScoreboardName() + " left the game.";
+ net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure + net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), s, leaveMessage); - PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), CraftChatMessage.fromComponent(disconnectionInfo.reason()), leaveMessage);
+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - adventure + PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(disconnectionInfo.reason()), leaveMessage); // Paper - adventure
if (this.cserver.getServer().isRunning()) { if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
@@ -2861,11 +2843,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent
// Send the possibly modified leave message // Send the possibly modified leave message
- final Component ichatbasecomponent = CraftChatMessage.fromString(event.getReason(), true)[0]; - this.disconnect0(new DisconnectionDetails(CraftChatMessage.fromString(event.getReason(), true)[0], disconnectionInfo.report(), disconnectionInfo.bugReportLink()));
+ final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure + this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionInfo.report(), disconnectionInfo.bugReportLink())); // Paper - Adventure
// CraftBukkit end }
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> { private void disconnect0(DisconnectionDetails disconnectiondetails) {
diff --git a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
@@ -2882,9 +2864,9 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ import net.minecraft.core.registries.Registries; @@ -0,0 +0,0 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.Connection; import net.minecraft.network.Connection;
import net.minecraft.network.DisconnectionDetails;
import net.minecraft.network.TickablePacketListener; import net.minecraft.network.TickablePacketListener;
+import net.minecraft.network.chat.ChatDecorator; +import net.minecraft.network.chat.ChatDecorator;
import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.ChatType;
@@ -3099,7 +3081,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void removeAll() { public void removeAll() {
// CraftBukkit start - disconnect safely // CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) { for (ServerPlayer player : this.players) {
- player.connection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message - player.connection.disconnect(CraftChatMessage.fromStringOrEmpty(this.server.server.getShutdownMessage())); // CraftBukkit - add custom shutdown message
+ player.connection.disconnect(this.server.server.shutdownMessage()); // CraftBukkit - add custom shutdown message // Paper - Adventure + player.connection.disconnect(this.server.server.shutdownMessage()); // CraftBukkit - add custom shutdown message // Paper - Adventure
} }
// CraftBukkit end // CraftBukkit end
@@ -3978,7 +3960,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
@@ -0,0 +0,0 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine @@ -0,0 +0,0 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine
CraftEnchantment ench = (CraftEnchantment) other; CraftEnchantment ench = (CraftEnchantment) other;
return !this.handle.isCompatibleWith(ench.getHandle()); return !net.minecraft.world.item.enchantment.Enchantment.areCompatible(this.handle, ench.handle);
} }
+ // Paper start + // Paper start
+ @Override + @Override
@@ -4210,7 +4192,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.disconnect(message == null ? "" : message); this.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message));
} }
+ // Paper start + // Paper start
@@ -4645,7 +4627,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static PlayerDeathEvent callPlayerDeathEvent(ServerPlayer victim, DamageSource damageSource, List<org.bukkit.inventory.ItemStack> drops, net.kyori.adventure.text.Component deathMessage, boolean keepInventory) { // Paper - Adventure + public static PlayerDeathEvent callPlayerDeathEvent(ServerPlayer victim, DamageSource damageSource, List<org.bukkit.inventory.ItemStack> drops, net.kyori.adventure.text.Component deathMessage, boolean keepInventory) { // Paper - Adventure
CraftPlayer entity = victim.getBukkitEntity(); CraftPlayer entity = victim.getBukkitEntity();
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(), 0, deathMessage); PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage);
@@ -0,0 +0,0 @@ public class CraftEventFactory { @@ -0,0 +0,0 @@ public class CraftEventFactory {
* Server methods * Server methods
*/ */
@@ -4782,8 +4764,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory { @@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory {
CraftItemStack craft = (CraftItemStack) itemStack; Optional<HolderSet.Named<Enchantment>> optional = (allowTreasures) ? Optional.empty() : registry.registryOrThrow(Registries.ENCHANTMENT).getTag(EnchantmentTags.IN_ENCHANTING_TABLE);
return CraftItemStack.asCraftMirror(EnchantmentHelper.enchantItem(MinecraftServer.getServer().getWorldData().enabledFeatures(), source, craft.handle, level, allowTreasures)); return CraftItemStack.asCraftMirror(EnchantmentHelper.enchantItem(source, craft.handle, level, registry, optional));
} }
+ +
+ // Paper start - Adventure + // Paper start - Adventure

View File

@@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
private final BodyRotationControl bodyRotationControl; private final BodyRotationControl bodyRotationControl;
protected PathNavigation navigation; protected PathNavigation navigation;
public GoalSelector goalSelector; public GoalSelector goalSelector;
@@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public GoalSelector targetSelector; public GoalSelector targetSelector;
@Nullable @Nullable
private LivingEntity target; private LivingEntity target;
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override @Override
protected final void serverAiStep() { protected final void serverAiStep() {
++this.noActionTime; ++this.noActionTime;

View File

@@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion + implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
implementation("org.ow2.asm:asm-commons:9.7") implementation("org.ow2.asm:asm-commons:9.7")
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0") runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
@@ -0,0 +0,0 @@ tasks.jar { @@ -0,0 +0,0 @@ tasks.jar {
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim() val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\"" val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
@@ -69,7 +69,7 @@ diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java --- a/src/main/java/net/minecraft/resources/ResourceLocation.java
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java +++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
@@ -0,0 +0,0 @@ public class ResourceLocation implements Comparable<ResourceLocation> { @@ -0,0 +0,0 @@ public final class ResourceLocation implements Comparable<ResourceLocation> {
public static final char NAMESPACE_SEPARATOR = ':'; public static final char NAMESPACE_SEPARATOR = ':';
public static final String DEFAULT_NAMESPACE = "minecraft"; public static final String DEFAULT_NAMESPACE = "minecraft";
public static final String REALMS_NAMESPACE = "realms"; public static final String REALMS_NAMESPACE = "realms";
@@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper + Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -21); deadline.add(Calendar.DAY_OF_YEAR, -3);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

View File

@@ -8,19 +8,20 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -0,0 +0,0 @@ public class Zombie extends Monster { @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTransformEvent;
public class Zombie extends Monster {
private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); private static final ResourceLocation SPEED_MODIFIER_BABY_ID = ResourceLocation.withDefaultNamespace("baby");
private static final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_UUID, "Baby speed boost", 0.5D, AttributeModifier.Operation.ADD_MULTIPLIED_BASE); - private static final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_ID, 0.5D, AttributeModifier.Operation.ADD_MULTIPLIED_BASE);
+ private final AttributeModifier babyModifier = new net.minecraft.world.entity.ai.attributes.AttributeModifier(SPEED_MODIFIER_BABY.id(), SPEED_MODIFIER_BABY.name(), this.level().paperConfig().entities.behavior.babyZombieMovementModifier, SPEED_MODIFIER_BABY.operation()); // Paper - Make baby speed configurable + private final AttributeModifier babyModifier = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_ID, this.level().paperConfig().entities.behavior.babyZombieMovementModifier, AttributeModifier.Operation.ADD_MULTIPLIED_BASE); // Paper - Make baby speed configurable
private static final EntityDataAccessor<Boolean> DATA_BABY_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); private static final ResourceLocation REINFORCEMENT_CALLER_CHARGE_ID = ResourceLocation.withDefaultNamespace("reinforcement_caller_charge");
private static final EntityDataAccessor<Integer> DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT); private static final AttributeModifier ZOMBIE_REINFORCEMENT_CALLEE_CHARGE = new AttributeModifier(ResourceLocation.withDefaultNamespace("reinforcement_callee_charge"), -0.05000000074505806D, AttributeModifier.Operation.ADD_VALUE);
public static final EntityDataAccessor<Boolean> DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); private static final ResourceLocation LEADER_ZOMBIE_BONUS_ID = ResourceLocation.withDefaultNamespace("leader_zombie_bonus");
@@ -0,0 +0,0 @@ public class Zombie extends Monster { @@ -0,0 +0,0 @@ public class Zombie extends Monster {
if (this.level() != null && !this.level().isClientSide) { if (this.level() != null && !this.level().isClientSide) {
AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
- attributemodifiable.removeModifier(Zombie.SPEED_MODIFIER_BABY.id()); - attributemodifiable.removeModifier(Zombie.SPEED_MODIFIER_BABY_ID);
+ attributemodifiable.removeModifier(this.babyModifier.id()); // Paper - Make baby speed configurable + attributemodifiable.removeModifier(this.babyModifier.id()); // Paper - Make baby speed configurable
if (baby) { if (baby) {
- attributemodifiable.addTransientModifier(Zombie.SPEED_MODIFIER_BABY); - attributemodifiable.addTransientModifier(Zombie.SPEED_MODIFIER_BABY);

View File

@@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
public final Object object; public final Object object;
private int containerCounter; private int containerCounter;
public boolean wonGame; public boolean wonGame;
@@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start // CraftBukkit start
public CraftPlayer.TransferCookieConnection transferCookieConnection; public CraftPlayer.TransferCookieConnection transferCookieConnection;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
--this.invulnerableTime; --this.invulnerableTime;
} }

View File

@@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctorDark <doctordark11@gmail.com>
Date: Wed, 16 Mar 2016 02:21:39 -0500
Subject: [PATCH] Configurable end credits
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.unRide();
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
if (!this.wonGame) {
+ if (this.level().paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Option to disable end credits
this.wonGame = true;
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 0.0F));
this.seenCredits = true;

View File

@@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
@@ -0,0 +0,0 @@ public class FishingHook extends Projectile { @@ -0,0 +0,0 @@ public class FishingHook extends Projectile {
this.noCulling = true; this.noCulling = true;
this.luck = Math.max(0, luckOfTheSeaLevel); this.luck = Math.max(0, luckBonus);
this.lureSpeed = Math.max(0, lureLevel); this.lureSpeed = Math.max(0, waitTimeReductionTicks);
+ // Paper start - Configurable fishing time ranges + // Paper start - Configurable fishing time ranges
+ minWaitTime = world.paperConfig().fishingTimeRange.minimum; + minWaitTime = world.paperConfig().fishingTimeRange.minimum;
+ maxWaitTime = world.paperConfig().fishingTimeRange.maximum; + maxWaitTime = world.paperConfig().fishingTimeRange.maximum;
@@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else { } else {
// CraftBukkit start - logic to modify fishing wait time // CraftBukkit start - logic to modify fishing wait time
this.timeUntilLured = Mth.nextInt(this.random, this.minWaitTime, this.maxWaitTime); this.timeUntilLured = Mth.nextInt(this.random, this.minWaitTime, this.maxWaitTime);
- this.timeUntilLured -= (this.applyLure) ? this.lureSpeed * 20 * 5 : 0; - this.timeUntilLured -= (this.applyLure) ? this.lureSpeed : 0;
+ this.timeUntilLured -= (this.applyLure) ? (this.lureSpeed * 20 * 5 >= this.maxWaitTime ? this.timeUntilLured - 1 : this.lureSpeed * 20 * 5) : 0; // Paper - Fix Lure infinite loop + this.timeUntilLured -= (this.applyLure) ? (this.lureSpeed >= this.maxWaitTime ? this.timeUntilLured - 1 : this.lureSpeed ) : 0; // Paper - Fix Lure infinite loop
// CraftBukkit end // CraftBukkit end
} }
} }

View File

@@ -27,14 +27,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -0,0 +0,0 @@ public class PortalForcer { @@ -0,0 +0,0 @@ public class PortalForcer {
Optional<PoiRecord> optional = villageplace.getInSquare((holder) -> { }, blockposition, i, PoiManager.Occupancy.ANY).map(PoiRecord::getPos);
return holder.is(PoiTypes.NETHER_PORTAL);
}, blockposition, i, PoiManager.Occupancy.ANY).filter((villageplacerecord) -> { Objects.requireNonNull(worldborder);
- return worldborder.isWithinBounds(villageplacerecord.getPos()); - return stream.filter(worldborder::isWithinBounds).filter((blockposition1) -> {
+ return worldborder.isWithinBounds(villageplacerecord.getPos()) && !(this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> villageplacerecord.getPos().getY() >= v)); // Paper - Configurable nether ceiling damage + return stream.filter(worldborder::isWithinBounds).filter(pos -> !(this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> pos.getY() >= v))).filter((blockposition1) -> { // Paper - Configurable nether ceiling damage
}).sorted(Comparator.comparingDouble((PoiRecord villageplacerecord) -> { // CraftBukkit - decompile error return this.level.getBlockState(blockposition1).hasProperty(BlockStateProperties.HORIZONTAL_AXIS);
return villageplacerecord.getPos().distSqr(blockposition); }).min(Comparator.comparingDouble((BlockPos blockposition1) -> { // CraftBukkit - decompile error
}).thenComparingInt((villageplacerecord) -> { return blockposition1.distSqr(blockposition);
@@ -0,0 +0,0 @@ public class PortalForcer { @@ -0,0 +0,0 @@ public class PortalForcer {
BlockPos blockposition2 = null; BlockPos blockposition2 = null;
WorldBorder worldborder = this.level.getWorldBorder(); WorldBorder worldborder = this.level.getWorldBorder();
@@ -44,6 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ i = Math.min(i, this.level.paperConfig().environment.netherCeilingVoidDamageHeight.intValue() - 1); + i = Math.min(i, this.level.paperConfig().environment.netherCeilingVoidDamageHeight.intValue() - 1);
+ } + }
+ // Paper end - Configurable nether ceiling damage + // Paper end - Configurable nether ceiling damage
boolean flag = true;
BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable(); BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable();
Iterator iterator = BlockPos.spiralAround(blockposition, createRadius, Direction.EAST, Direction.SOUTH).iterator(); // CraftBukkit Iterator iterator = BlockPos.spiralAround(blockposition, createRadius, Direction.EAST, Direction.SOUTH).iterator(); // CraftBukkit

View File

@@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
LivingEntity entityliving = (LivingEntity) entity; LivingEntity entityliving = (LivingEntity) entity;
- d13 = ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d12); - d13 = d12 * (1.0D - entityliving.getAttributeValue(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE));
+ d13 = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d12); // Paper - Option to disable explosion knockback + d13 = entity instanceof Player && this.level.paperConfig().environment.disableExplosionKnockback ? 0 : d12 * (1.0D - entityliving.getAttributeValue(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE));
} else { } else {
d13 = d12; d13 = d12;
} }

View File

@@ -23,15 +23,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return; + return;
+ } + }
+ // Paper end - Configurable falling blocks height nerf + // Paper end - Configurable falling blocks height nerf
if (!this.level().isClientSide) { this.handlePortal();
if (!this.level().isClientSide && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) {
BlockPos blockposition = this.blockPosition(); BlockPos blockposition = this.blockPosition();
boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -0,0 +0,0 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -0,0 +0,0 @@ public class PrimedTnt extends Entity implements TraceableEntity {
if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot this.handlePortal();
this.applyGravity(); this.applyGravity();
this.move(MoverType.SELF, this.getDeltaMovement()); this.move(MoverType.SELF, this.getDeltaMovement());
+ // Paper start - Configurable TNT height nerf + // Paper start - Configurable TNT height nerf

View File

@@ -610,7 +610,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static boolean useConsole = true; public static boolean useConsole = true;
@@ -0,0 +0,0 @@ public class Main { @@ -0,0 +0,0 @@ public class Main {
deadline.add(Calendar.DAY_OF_YEAR, -21); deadline.add(Calendar.DAY_OF_YEAR, -3);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***"); System.err.println("*** Error, this build is outdated ***");
- System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");

View File

@@ -28,8 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import joptsimple.OptionSet; import joptsimple.OptionSet;
import joptsimple.OptionSpec; import joptsimple.OptionSpec;
@@ -0,0 +0,0 @@ public class Commodore { @@ -0,0 +0,0 @@ public class Commodore {
private static final Map<String, RerouteMethodData> FIELD_RENAME_METHOD_REROUTE = Commodore.createReroutes(FieldRename.class);
private static final Map<String, RerouteMethodData> MATERIAL_METHOD_REROUTE = Commodore.createReroutes(MaterialRerouting.class); private static final Map<String, RerouteMethodData> MATERIAL_METHOD_REROUTE = Commodore.createReroutes(MaterialRerouting.class);
private static final Map<String, RerouteMethodData> METHOD_REROUTE = Commodore.createReroutes(MethodRerouting.class);
+ // Paper start - Plugin rewrites + // Paper start - Plugin rewrites
+ private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap(); + private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();

View File

@@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
private int levitationStartTime; private int levitationStartTime;
private boolean disconnected; private boolean disconnected;
private int requestedViewDistance; private int requestedViewDistance;
@@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
@Nullable @Nullable
private Vec3 startingToFallPosition; private Vec3 startingToFallPosition;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.lastActionTime = Util.getMillis(); this.lastActionTime = Util.getMillis();
this.recipeBook = new ServerRecipeBook(); this.recipeBook = new ServerRecipeBook();
this.requestedViewDistance = 2; this.requestedViewDistance = 2;
@@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.lastSectionPos = SectionPos.of(0, 0, 0); this.lastSectionPos = SectionPos.of(0, 0, 0);
this.chunkTrackingView = ChunkTrackingView.EMPTY; this.chunkTrackingView = ChunkTrackingView.EMPTY;
this.respawnDimension = Level.OVERWORLD; this.respawnDimension = Level.OVERWORLD;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
this.server.server.getPluginManager().callEvent(event); this.server.server.getPluginManager().callEvent(event);
} }

View File

@@ -6128,9 +6128,9 @@ diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
private static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.getStatusList(); public static final ChunkResult<LevelChunk> UNLOADED_LEVEL_CHUNK = ChunkResult.error("Unloaded level chunk");
private final AtomicReferenceArray<CompletableFuture<ChunkResult<ChunkAccess>>> futures; private static final CompletableFuture<ChunkResult<LevelChunk>> UNLOADED_LEVEL_CHUNK_FUTURE = CompletableFuture.completedFuture(ChunkHolder.UNLOADED_LEVEL_CHUNK);
private final LevelHeightAccessor levelHeightAccessor; private final LevelHeightAccessor levelHeightAccessor;
- private volatile CompletableFuture<ChunkResult<LevelChunk>> fullChunkFuture; - private volatile CompletableFuture<ChunkResult<LevelChunk>> fullChunkFuture;
- private volatile CompletableFuture<ChunkResult<LevelChunk>> tickingChunkFuture; - private volatile CompletableFuture<ChunkResult<LevelChunk>> tickingChunkFuture;
@@ -6138,12 +6138,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private volatile CompletableFuture<ChunkResult<LevelChunk>> fullChunkFuture; private int fullChunkCreateCount; private volatile boolean isFullChunkReady; // Paper - cache chunk ticking stage + private volatile CompletableFuture<ChunkResult<LevelChunk>> fullChunkFuture; private int fullChunkCreateCount; private volatile boolean isFullChunkReady; // Paper - cache chunk ticking stage
+ private volatile CompletableFuture<ChunkResult<LevelChunk>> tickingChunkFuture; private volatile boolean isTickingReady; // Paper - cache chunk ticking stage + private volatile CompletableFuture<ChunkResult<LevelChunk>> tickingChunkFuture; private volatile boolean isTickingReady; // Paper - cache chunk ticking stage
+ private volatile CompletableFuture<ChunkResult<LevelChunk>> entityTickingChunkFuture; private volatile boolean isEntityTickingReady; // Paper - cache chunk ticking stage + private volatile CompletableFuture<ChunkResult<LevelChunk>> entityTickingChunkFuture; private volatile boolean isEntityTickingReady; // Paper - cache chunk ticking stage
private CompletableFuture<ChunkAccess> chunkToSave; public int oldTicketLevel;
@Nullable private int ticketLevel;
private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory; private int queueLevel;
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
private CompletableFuture<Void> pendingFullStateConfirmation;
private CompletableFuture<?> sendSync; private CompletableFuture<?> sendSync;
private CompletableFuture<?> saveSync;
+ private final ChunkMap chunkMap; // Paper + private final ChunkMap chunkMap; // Paper
+ +
@@ -6158,9 +6158,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
+ +
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); super(pos);
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
this.queueLevel = this.oldTicketLevel; this.queueLevel = this.oldTicketLevel;
this.setTicketLevel(level); this.setTicketLevel(level);
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()]; this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
@@ -6183,10 +6183,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
// CraftBukkit start // CraftBukkit start
public LevelChunk getFullChunkNow() { public LevelChunk getFullChunkNow() {
// Note: We use the oldTicketLevel for isLoaded checks. return (LevelChunk) this.getChunkIfPresent(ChunkStatus.FULL);
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
return ChunkLevel.generationStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE;
} }
// CraftBukkit end
- public CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() { - public CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() {
+ public final CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() { // Paper - final for inline + public final CompletableFuture<ChunkResult<LevelChunk>> getTickingChunkFuture() { // Paper - final for inline
@@ -6209,8 +6209,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return (LevelChunk) ((ChunkResult) this.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).orElse(null); // CraftBukkit - decompile error return (LevelChunk) ((ChunkResult) this.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).orElse(null); // CraftBukkit - decompile error
} }
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
return null;
} }
+ // Paper start + // Paper start
@@ -6228,39 +6228,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
+ +
@Nullable public CompletableFuture<?> getSaveSyncFuture() {
public ChunkAccess getLastAvailable() { return this.saveSync;
for (int i = ChunkHolder.CHUNK_STATUSES.size() - 1; i >= 0; --i) { }
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
return null;
}
- public CompletableFuture<ChunkAccess> getChunkToSave() {
+ public final CompletableFuture<ChunkAccess> getChunkToSave() { // Paper - final for inline
return this.chunkToSave;
}
@@ -0,0 +0,0 @@ public class ChunkHolder {
return ChunkLevel.fullStatus(this.ticketLevel);
}
- public ChunkPos getPos() {
+ public final ChunkPos getPos() { // Paper - final for inline
return this.pos;
} }
@Override
- public int getTicketLevel() { - public int getTicketLevel() {
+ public final int getTicketLevel() { // Paper - final for inline + public final int getTicketLevel() { // Paper - final for inline
return this.ticketLevel; return this.ticketLevel;
} }
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
this.wasAccessibleSinceLastSave |= flag3; this.wasAccessibleSinceLastSave |= flag1;
if (!flag2 && flag3) { if (!flag && flag1) {
+ int expectCreateCount = ++this.fullChunkCreateCount; // Paper + int expectCreateCount = ++this.fullChunkCreateCount; // Paper
this.fullChunkFuture = chunkStorage.prepareAccessibleChunk(this); this.fullChunkFuture = chunkLoadingManager.prepareAccessibleChunk(this);
this.scheduleFullChunkPromotion(chunkStorage, this.fullChunkFuture, executor, FullChunkStatus.FULL); this.scheduleFullChunkPromotion(chunkLoadingManager, this.fullChunkFuture, executor, FullChunkStatus.FULL);
+ // Paper start - cache ticking ready status + // Paper start - cache ticking ready status
+ this.fullChunkFuture.thenAccept(chunkResult -> { + this.fullChunkFuture.thenAccept(chunkResult -> {
+ chunkResult.ifSuccess(chunk -> { + chunkResult.ifSuccess(chunk -> {
@@ -6270,10 +6256,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ }); + });
+ }); + });
this.updateChunkToSave(this.fullChunkFuture, "full"); + // Paper end - cache ticking ready status
this.addSaveDependency(this.fullChunkFuture);
} }
if (flag2 && !flag3) { if (flag && !flag1) {
+ // Paper start + // Paper start
+ if (this.isFullChunkReady) { + if (this.isFullChunkReady) {
+ io.papermc.paper.chunk.system.ChunkSystem.onChunkNotBorder(this.fullChunkFuture.join().orElseThrow(IllegalStateException::new), this); // Paper + io.papermc.paper.chunk.system.ChunkSystem.onChunkNotBorder(this.fullChunkFuture.join().orElseThrow(IllegalStateException::new), this); // Paper
@@ -6281,15 +6268,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
this.fullChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK); this.fullChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK);
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
+ ++this.fullChunkCreateCount; // Paper - cache ticking ready status
+ this.isFullChunkReady = false; // Paper - cache ticking ready status
} }
@@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
boolean flag4 = fullchunkstatus.isOrAfter(FullChunkStatus.BLOCK_TICKING); if (!flag2 && flag3) {
@@ -0,0 +0,0 @@ public class ChunkHolder { this.tickingChunkFuture = chunkLoadingManager.prepareTickingChunk(this);
if (!flag4 && flag5) { this.scheduleFullChunkPromotion(chunkLoadingManager, this.tickingChunkFuture, executor, FullChunkStatus.BLOCK_TICKING);
this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this);
this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, FullChunkStatus.BLOCK_TICKING);
+ // Paper start - cache ticking ready status + // Paper start - cache ticking ready status
+ this.tickingChunkFuture.thenAccept(chunkResult -> { + this.tickingChunkFuture.thenAccept(chunkResult -> {
+ chunkResult.ifSuccess(chunk -> { + chunkResult.ifSuccess(chunk -> {
@@ -6299,10 +6282,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }); + });
+ }); + });
+ // Paper end + // Paper end
this.updateChunkToSave(this.tickingChunkFuture, "ticking"); this.addSaveDependency(this.tickingChunkFuture);
} }
if (flag4 && !flag5) { if (flag2 && !flag3) {
- this.tickingChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK); - this.tickingChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK);
+ // Paper start + // Paper start
+ if (this.isTickingReady) { + if (this.isTickingReady) {
@@ -6313,10 +6296,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.tickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; this.tickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
} }
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this); this.entityTickingChunkFuture = chunkLoadingManager.prepareEntityTickingChunk(this);
this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, FullChunkStatus.ENTITY_TICKING); this.scheduleFullChunkPromotion(chunkLoadingManager, this.entityTickingChunkFuture, executor, FullChunkStatus.ENTITY_TICKING);
+ // Paper start - cache ticking ready status + // Paper start - cache ticking ready status
+ this.entityTickingChunkFuture.thenAccept(chunkResult -> { + this.entityTickingChunkFuture.thenAccept(chunkResult -> {
+ chunkResult.ifSuccess(chunk -> { + chunkResult.ifSuccess(chunk -> {
@@ -6325,10 +6308,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }); + });
+ }); + });
+ // Paper end + // Paper end
this.updateChunkToSave(this.entityTickingChunkFuture, "entity ticking"); this.addSaveDependency(this.entityTickingChunkFuture);
} }
if (flag6 && !flag7) { if (flag4 && !flag5) {
- this.entityTickingChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK); - this.entityTickingChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK);
+ // Paper start + // Paper start
+ if (this.isEntityTickingReady) { + if (this.isEntityTickingReady) {
@@ -6339,9 +6322,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.entityTickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; this.entityTickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
} }
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder extends GenerationChunkHolder {
private static record ChunkSaveDebug(Thread thread, CompletableFuture<?> future, String source) {
List<ServerPlayer> getPlayers(ChunkPos chunkPos, boolean onlyOnWatchDistanceEdge);
} }
+ +
+ // Paper start + // Paper start
@@ -6426,9 +6409,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super(new RegionStorageInfo(session.getLevelId(), world.dimension(), "chunk"), session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); super(new RegionStorageInfo(session.getLevelId(), world.dimension(), "chunk"), session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone(); this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.poiManager = new PoiManager(new RegionStorageInfo(session.getLevelId(), world.dimension(), "poi"), path.resolve("poi"), dataFixer, dsync, iregistrycustom, world); this.poiManager = new PoiManager(new RegionStorageInfo(session.getLevelId(), world.dimension(), "poi"), path.resolve("poi"), dataFixer, dsync, iregistrycustom, world.getServer(), world);
this.setServerViewDistance(viewDistance); this.setServerViewDistance(viewDistance);
this.worldGenContext = new WorldGenContext(world, chunkGenerator, structureTemplateManager, this.lightEngine); this.worldGenContext = new WorldGenContext(world, chunkGenerator, structureTemplateManager, this.lightEngine, this.mainThreadMailbox);
+ // Paper start + // Paper start
+ this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new); + this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
+ this.regionManagers.add(this.dataRegionManager); + this.regionManagers.add(this.dataRegionManager);
@@ -6441,21 +6424,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final io.papermc.paper.util.player.NearbyPlayers getNearbyPlayers() { + public final io.papermc.paper.util.player.NearbyPlayers getNearbyPlayers() {
+ return this.nearbyPlayers; + return this.nearbyPlayers;
} }
+ // Paper end
protected ChunkGenerator generator() {
return this.generator;
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
+ public int getMobCountNear(final ServerPlayer player, final net.minecraft.world.entity.MobCategory mobCategory) { + public int getMobCountNear(final ServerPlayer player, final net.minecraft.world.entity.MobCategory mobCategory) {
+ return -1; + return -1;
+ } + }
+ // Paper end
+ +
private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { protected ChunkGenerator generator() {
double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); return this.worldGenContext.generator();
double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8); }
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}; };
@@ -6511,9 +6488,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private void processUnloads(BooleanSupplier shouldKeepTicking) { private void processUnloads(BooleanSupplier shouldKeepTicking) {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j); }
if (playerchunk != null) { this.updatingChunkMap.remove(j);
+ playerchunk.onChunkRemove(); // Paper + playerchunk.onChunkRemove(); // Paper
this.pendingUnloads.put(j, playerchunk); this.pendingUnloads.put(j, playerchunk);
this.modified = true; this.modified = true;
@@ -6528,18 +6505,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) { while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) {
if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) { if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (completablefuture1 != completablefuture) {
this.scheduleUnload(pos, holder);
} else { } else {
ChunkAccess ichunkaccess = holder.getLatestChunk();
- if (this.pendingUnloads.remove(pos, holder) && ichunkaccess != null) { - if (this.pendingUnloads.remove(pos, holder) && ichunkaccess != null) {
+ // Paper start + // Paper start
+ boolean removed; + boolean removed;
+ if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) { + if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) {
+ io.papermc.paper.chunk.system.ChunkSystem.onChunkHolderDelete(this.level, holder); + io.papermc.paper.chunk.system.ChunkSystem.onChunkHolderDelete(this.level, holder);
+ // Paper end + // Paper end
LevelChunk chunk;
if (ichunkaccess instanceof LevelChunk) { if (ichunkaccess instanceof LevelChunk) {
((LevelChunk) ichunkaccess).setLoaded(false);
}
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine.tryScheduleUpdate(); this.lightEngine.tryScheduleUpdate();
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null); this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
@@ -6599,8 +6576,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ long i = playerchunk.pos.toLong(); // Paper + long i = playerchunk.pos.toLong(); // Paper
ChunkPos chunkcoordintpair = new ChunkPos(i); ChunkPos chunkcoordintpair = new ChunkPos(i);
- ChunkHolder playerchunk = (ChunkHolder) entry.getValue(); - ChunkHolder playerchunk = (ChunkHolder) entry.getValue();
+ // Paper + // Paper - move up
Optional<ChunkAccess> optional = Optional.ofNullable(playerchunk.getLastAvailable()); Optional<ChunkAccess> optional = Optional.ofNullable(playerchunk.getLatestChunk());
Optional<LevelChunk> optional1 = optional.flatMap((ichunkaccess) -> { Optional<LevelChunk> optional1 = optional.flatMap((ichunkaccess) -> {
return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty(); return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -6667,8 +6644,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public void removeTicketsOnClosing() { public void removeTicketsOnClosing() {
- ImmutableSet<TicketType<?>> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.LIGHT); - ImmutableSet<TicketType<?>> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT);
+ ImmutableSet<TicketType<?>> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.LIGHT, TicketType.FUTURE_AWAIT); // Paper - add additional tickets to preserve + ImmutableSet<TicketType<?>> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.FUTURE_AWAIT); // Paper - add additional tickets to preserve
ObjectIterator<Entry<SortedArraySet<Ticket<?>>>> objectiterator = this.tickets.long2ObjectEntrySet().fastIterator(); ObjectIterator<Entry<SortedArraySet<Ticket<?>>>> objectiterator = this.tickets.long2ObjectEntrySet().fastIterator();
while (objectiterator.hasNext()) { while (objectiterator.hasNext()) {
@@ -6953,7 +6930,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
public boolean sentListPacket = false; public boolean sentListPacket = false;
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end // CraftBukkit end
@@ -6962,7 +6939,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) { public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.updateOptions(clientOptions); this.updateOptions(clientOptions);
this.object = null; this.object = null;
@@ -6988,7 +6965,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -0,0 +0,0 @@ public class WorldGenRegion implements WorldGenLevel { @@ -0,0 +0,0 @@ public class WorldGenRegion implements WorldGenLevel {
return chunkX >= this.firstPos.x && chunkX <= this.lastPos.x && chunkZ >= this.firstPos.z && chunkZ <= this.lastPos.z; return k < this.generatingStep.directDependencies().size();
} }
+ // Paper start - if loaded util + // Paper start - if loaded util
@@ -7076,7 +7053,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
return this.target; return this.target;
} }

View File

@@ -24,8 +24,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
implementation("org.ow2.asm:asm-commons:9.7") implementation("org.ow2.asm:asm-commons:9.7")
+ implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files + implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0") runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.3.0") runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000

View File

@@ -24,7 +24,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
@@ -77,9 +77,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
@Nullable
public Entity currentExplosionCause; public Entity currentExplosionCause;
public boolean ignoreFallDamageFromCurrentImpulse; private boolean ignoreFallDamageFromCurrentImpulse;
private int currentImpulseContextResetGraceTime;
+ public boolean affectsSpawning = true; // Paper - Affects Spawning API + public boolean affectsSpawning = true; // Paper - Affects Spawning API
// CraftBukkit start // CraftBukkit start

View File

@@ -89,9 +89,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@EnumSource(DyeColor.class) @EnumSource(DyeColor.class)
public void checkColor(DyeColor dye) { public void checkColor(DyeColor dye) {
Color color = dye.getColor(); Color color = dye.getColor();
- float[] nmsColorArray = DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors(); - int nmsColorArray = DyeColor.byId(dye.getWoolData()).getTextureDiffuseColor();
+ float[] nmsColorArray = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors(); // Paper - remap fix + int nmsColorArray = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors(); // Paper - remap fix
Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255)); Color nmsColor = Color.fromARGB(nmsColorArray);
assertThat(color, is(nmsColor)); assertThat(color, is(nmsColor));
} }
@@ -0,0 +0,0 @@ public class DyeColorsTest extends AbstractTestingBase { @@ -0,0 +0,0 @@ public class DyeColorsTest extends AbstractTestingBase {

View File

@@ -649,7 +649,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -0,0 +0,0 @@ public class Commodore { @@ -0,0 +0,0 @@ public class Commodore {
private static final Map<String, RerouteMethodData> MATERIAL_METHOD_REROUTE = Commodore.createReroutes(MaterialRerouting.class); private static final Map<String, RerouteMethodData> METHOD_REROUTE = Commodore.createReroutes(MethodRerouting.class);
// Paper start - Plugin rewrites // Paper start - Plugin rewrites
- private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap(); - private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();

View File

@@ -47,8 +47,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ implementation("org.ow2.asm:asm-commons:9.7") + implementation("org.ow2.asm:asm-commons:9.7")
+ implementation("commons-lang:commons-lang:2.6") + implementation("commons-lang:commons-lang:2.6")
+ runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0") + runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
+ runtimeOnly("com.mysql:mysql-connector-j:8.3.0") + runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
+ +
+ runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6") + runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") + runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
@@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+} +}
+ +
+paperweight { +paperweight {
+ craftBukkitPackageVersion.set("v1_20_R4") // also needs to be updated in MappingEnvironment + craftBukkitPackageVersion.set("v1_21_R1") // also needs to be updated in MappingEnvironment
+} +}
+ +
+tasks.jar { +tasks.jar {
@@ -170,7 +170,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <groupId>org.spigotmc</groupId> - <groupId>org.spigotmc</groupId>
- <artifactId>spigot</artifactId> - <artifactId>spigot</artifactId>
- <packaging>jar</packaging> - <packaging>jar</packaging>
- <version>1.20.6-R0.1-SNAPSHOT</version> - <version>1.21-R0.1-SNAPSHOT</version>
- <name>Spigot</name> - <name>Spigot</name>
- <url>https://www.spigotmc.org/</url> - <url>https://www.spigotmc.org/</url>
- -
@@ -186,7 +186,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <api.version>unknown</api.version> - <api.version>unknown</api.version>
- <bt.name>git</bt.name> - <bt.name>git</bt.name>
- <minecraft_version>1_20_R4</minecraft_version> - <minecraft_version>1_21_R1</minecraft_version>
- <maven.compiler.release>21</maven.compiler.release> - <maven.compiler.release>21</maven.compiler.release>
- </properties> - </properties>
- -
@@ -251,7 +251,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <dependency> - <dependency>
- <groupId>com.mojang</groupId> - <groupId>com.mojang</groupId>
- <artifactId>datafixerupper</artifactId> - <artifactId>datafixerupper</artifactId>
- <version>7.0.14</version> - <version>8.0.16</version>
- <scope>compile</scope> - <scope>compile</scope>
- </dependency> - </dependency>
- <dependency> - <dependency>
@@ -405,13 +405,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <dependency> - <dependency>
- <groupId>org.xerial</groupId> - <groupId>org.xerial</groupId>
- <artifactId>sqlite-jdbc</artifactId> - <artifactId>sqlite-jdbc</artifactId>
- <version>3.45.3.0</version> - <version>3.46.0.0</version>
- <scope>runtime</scope> - <scope>runtime</scope>
- </dependency> - </dependency>
- <dependency> - <dependency>
- <groupId>com.mysql</groupId> - <groupId>com.mysql</groupId>
- <artifactId>mysql-connector-j</artifactId> - <artifactId>mysql-connector-j</artifactId>
- <version>8.3.0</version> - <version>8.4.0</version>
- <scope>runtime</scope> - <scope>runtime</scope>
- </dependency> - </dependency>
- <!-- add these back in as they are not exposed by the API --> - <!-- add these back in as they are not exposed by the API -->

View File

@@ -724,7 +724,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot -import org.bukkit.craftbukkit.SpigotTimings; // Spigot
+import co.aikar.timings.MinecraftTimings; // Paper +import co.aikar.timings.MinecraftTimings; // Paper
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, CommandSource, AutoCloseable { public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource, AutoCloseable {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
@@ -1243,7 +1243,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.ackBlockChangesUpTo = -1; this.ackBlockChangesUpTo = -1;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(Component.translatable("multiplayer.disconnect.idling")); this.disconnect((Component) Component.translatable("multiplayer.disconnect.idling"));
} }
- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.stopTiming(); // Spigot - org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.stopTiming(); // Spigot
@@ -1304,7 +1304,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; @@ -0,0 +0,0 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Hanging; import org.bukkit.entity.Hanging;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;

View File

@@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -0,0 +0,0 @@ dependencies { @@ -0,0 +0,0 @@ dependencies {
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0") runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.3.0") runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
+ runtimeOnly("com.lmax:disruptor:3.4.4") // Paper + runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6") runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")

View File

@@ -263,9 +263,9 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import org.slf4j.Logger; @@ -0,0 +0,0 @@ import com.mojang.serialization.Dynamic;
import com.mojang.serialization.Dynamic;
import com.mojang.serialization.Lifecycle; import com.mojang.serialization.Lifecycle;
import java.io.File;
import java.util.Random; import java.util.Random;
-import jline.console.ConsoleReader; -import jline.console.ConsoleReader;
+// import jline.console.ConsoleReader; // Paper +// import jline.console.ConsoleReader; // Paper

View File

@@ -1,38 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:46:17 -0600
Subject: [PATCH] Add configurable portal search radius
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
double d0 = DimensionType.getTeleportationScale(this.level().dimensionType(), destination.dimensionType());
BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
// CraftBukkit start
- CraftPortalEvent event = this.callPortalEvent(this, destination, new Vec3(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
+ // Paper start - Configurable portal search radius
+ int portalSearchRadius = destination.paperConfig().environment.portalSearchRadius;
+ if (level.paperConfig().environment.portalSearchVanillaDimensionScaling && flag2) { // == THE_NETHER
+ portalSearchRadius = (int) (portalSearchRadius / destination.dimensionType().coordinateScale());
+ }
+ // Paper end - Configurable portal search radius
+ CraftPortalEvent event = this.callPortalEvent(this, destination, new Vec3(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, destination.paperConfig().environment.portalCreateRadius); // Paper start - configurable portal radius
if (event == null) {
return null;
}
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -0,0 +0,0 @@ public class PortalForcer {
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) {
// CraftBukkit start
- return this.findPortalAround(pos, worldBorder, destIsNether ? 16 : 128); // Search Radius
+ return this.findPortalAround(pos, worldBorder, destIsNether ? level.paperConfig().environment.portalCreateRadius : level.paperConfig().environment.portalSearchRadius); // Search Radius // Paper - Configurable portal search radius
}
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos blockposition, WorldBorder worldborder, int i) {

View File

@@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctorDark <doctordark11@gmail.com>
Date: Wed, 16 Mar 2016 02:21:39 -0500
Subject: [PATCH] Configurable end credits
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
this.unRide();
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
if (!this.wonGame) {
+ if (this.level().paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Option to disable end credits
this.wonGame = true;
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, this.seenCredits ? 0.0F : 1.0F));
this.seenCredits = true;

View File

@@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Thu, 3 Mar 2016 02:50:31 -0600
Subject: [PATCH] Configurable inter-world teleportation safety
People are able to abuse the way Bukkit handles teleportation across worlds since it provides a built in teleportation
safety check.
To abuse the safety check, players are required to get into a location deemed unsafe by Bukkit e.g. be within a chest
or door block. While they are in this block, they accept a teleport request from a player within a different world. Once
the player teleports, Minecraft will recursively search upwards for a safe location, this could eventually land within a
player's skybase.
Example setup to perform the glitch: http://puu.sh/ng3PC/cf072dcbdb.png
The wanted destination was on top of the emerald block however the player ended on top of the diamond block.
This only is the case if the player is teleporting between worlds.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
entity.connection.teleport(to);
} else {
// The respawn reason should never be used if the passed location is non null.
- this.server.getHandle().respawn(entity, toWorld, true, to, true, null);
+ this.server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck, null); // Paper
}
return true;
}