mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-03 21:37:28 +01:00
117
This commit is contained in:
parent
79da0788dd
commit
6a05c85176
55 changed files with 36 additions and 51 deletions
patches/server
Add-EntityZapEvent.patchAdd-PlayerUseUnknownEntityEvent.patchAdd-ProjectileCollideEvent.patchAdd-World-Util-Methods.patchAdd-ability-to-configure-frosted_ice-properties.patchAdd-exception-reporting-event.patchAdd-handshake-event-to-allow-plugins-to-handle-clien.patchAdd-methods-for-working-with-arrows-stuck-in-living-.patchAdd-server-name-parameter.patchAdd-setting-for-proxy-online-mode-status.patchAdd-source-to-PlayerExpChangeEvent.patchAllow-Reloading-of-Command-Aliases.patchAllow-Reloading-of-Custom-Permissions.patchAsync-GameProfileCache-saving.patchAvoid-blocking-on-Network-Manager-creation.patchBound-Treasure-Maps-to-World-Border.patchCache-user-authenticator-threads.patchChunk-Save-Reattempt.patchComplete-resource-pack-API.patchConfigurable-Chunk-Inhabited-Time.patchConfigurable-Non-Player-Arrow-Despawn-Rate.patchConfigurable-Player-Collision.patchConfigurable-RCON-IP-address.patchConfigurable-flying-kick-messages.patchConfigurable-packet-in-spam-threshold.patchConfigurable-random-tick-rates-for-blocks.patchConfigurable-spawn-chances-for-skeleton-horses.patchCustom-replacement-for-eaten-items.patchDefault-loading-permissions.yml-before-plugins.patchDisable-Scoreboards-for-non-players-by-default.patchDo-not-load-chunks-for-Pathfinding.patchDon-t-lookup-game-profiles-that-have-no-UUID-and-no-.patchDon-t-save-empty-scoreboard-teams-to-scoreboard.dat.patchEntity-AddTo-RemoveFrom-World-Events.patchEntityPathfindEvent.patchEntityRegainHealthEvent-isFastRegen-API.patchFaster-redstone-torch-rapid-clock-removal.patchFilter-bad-block-entity-nbt-data-from-falling-blocks.patchFix-Cancelling-BlockPlaceEvent-triggering-physics.patchFix-global-sound-handling.patchHandle-Item-Meta-Inconsistencies.patchLootTable-API-and-replenishable-lootables.patchOnly-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patchOptimise-BlockState-s-hashCode-equals.patchOptimize-DataBits.patchOptimize-Level.hasChunkAt-BlockPosition-Z.patchOption-to-use-vanilla-per-world-scoreboard-coloring-.patchOptional-TNT-doesn-t-move-in-water.patchPrevent-Pathfinding-out-of-World-Border.patchRemove-Metadata-on-reload.patchSanitise-RegionFileCache-and-make-configurable.patchSystem-property-for-disabling-watchdoge.patchUse-a-Shared-Random-for-Entities.patchhandle-NaN-health-absorb-values-and-repair-bad-data.patchremove-null-possibility-for-getServer-singleton.patch
|
@ -126,35 +126,22 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package net.minecraft.world.level.chunk;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
+import com.destroystokyo.paper.exception.ServerInternalException;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.UnmodifiableIterator;
|
||||
import com.mojang.logging.LogUtils;
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
|
||||
BlockState iblockdata = this.getBlockState(blockposition);
|
||||
|
||||
// CraftBukkit start
|
||||
} else {
|
||||
- System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
|
||||
- + " (" + this.getBlockState(blockposition) + ") where there was no entity tile!");
|
||||
- System.out.println("Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
|
||||
- new Exception().printStackTrace();
|
||||
if (!iblockdata.hasBlockEntity()) {
|
||||
- LevelChunk.LOGGER.warn("Trying to set block entity {} at position {}, but state {} does not allow it", new Object[]{blockEntity, blockposition, iblockdata});
|
||||
- new Exception().printStackTrace(); // CraftBukkit
|
||||
+ // Paper start - ServerExceptionEvent
|
||||
+ ServerInternalException e = new ServerInternalException(
|
||||
+ "Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + ","
|
||||
+ + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
|
||||
+ + " (" + getBlockState(blockposition) + ") where there was no entity tile!\n" +
|
||||
+ "Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16) +
|
||||
+ "\nWorld: " + level.getLevel().dimension().location());
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException e = new com.destroystokyo.paper.exception.ServerInternalException(
|
||||
+ "Trying to set block entity %s at position %s, but state %s does not allow it".formatted(blockEntity, blockposition, iblockdata)
|
||||
+ );
|
||||
+ e.printStackTrace();
|
||||
+ ServerInternalException.reportInternalException(e);
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(e);
|
||||
+ // Paper end - ServerExceptionEvent
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BlockState iblockdata1 = blockEntity.getBlockState();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
|
||||
// Paper start - Prevent block entity and entity crashes
|
||||
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
this.connection.disconnect(ichatmutablecomponent);
|
||||
this.connection.disconnect((Component) ichatmutablecomponent);
|
||||
} else {
|
||||
this.connection.setupInboundProtocol(LoginProtocols.SERVERBOUND, new ServerLoginPacketListenerImpl(this.server, this.connection, transfer));
|
||||
+ // Paper start - PlayerHandshakeEvent
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
@@ -0,0 +0,0 @@ public class ExperienceOrb extends Entity {
|
||||
int i = this.repairPlayerItems(player, this.value);
|
||||
int i = this.repairPlayerItems(entityplayer, this.value);
|
||||
|
||||
if (i > 0) {
|
||||
- player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, i).getAmount()); // CraftBukkit - this.value -> event.getAmount()
|
|
@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
@@ -0,0 +0,0 @@ public class WorldBorder {
|
||||
return (double) (pos.getX() + 1) > this.getMinX() && (double) pos.getX() < this.getMaxX() && (double) (pos.getZ() + 1) > this.getMinZ() && (double) pos.getZ() < this.getMaxZ();
|
||||
return this.isWithinBounds((double) chunkPos.getMinBlockX(), (double) chunkPos.getMinBlockZ()) && this.isWithinBounds((double) chunkPos.getMaxBlockX(), (double) chunkPos.getMaxBlockZ());
|
||||
}
|
||||
|
||||
+ // Paper start - Bound treasure maps to world border
|
||||
|
@ -30,8 +30,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ // Paper end - Bound treasure maps to world border
|
||||
+
|
||||
public boolean isWithinBounds(ChunkPos pos) {
|
||||
return (double) pos.getMaxBlockX() > this.getMinX() && (double) pos.getMinBlockX() < this.getMaxX() && (double) pos.getMaxBlockZ() > this.getMinZ() && (double) pos.getMinBlockZ() < this.getMaxZ();
|
||||
public boolean isWithinBounds(AABB box) {
|
||||
return this.isWithinBounds(box.minX, box.minZ, box.maxX - 9.999999747378752E-6D, box.maxZ - 9.999999747378752E-6D);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
|
||||
if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
|
||||
- this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
|
||||
- this.disconnect((Component) Component.translatable("multiplayer.disconnect.flying"));
|
||||
+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message
|
||||
return;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) {
|
||||
if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
|
||||
- this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
|
||||
- this.disconnect((Component) Component.translatable("multiplayer.disconnect.flying"));
|
||||
+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message
|
||||
return;
|
||||
}
|
|
@ -85,8 +85,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
private ExplosionInteraction() {}
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
+ // Paper start - respect global sound events gamerule
|
||||
+ public List<net.minecraft.server.level.ServerPlayer> getPlayersForGlobalSoundGamerule() {
|
|
@ -35,20 +35,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private static final java.util.Comparator<Holder<Enchantment>> ENCHANTMENT_ORDER = java.util.Comparator.comparing(Holder::getRegisteredName);
|
||||
+ public static final ItemEnchantments EMPTY = new ItemEnchantments(new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER), true);
|
||||
+ // Paper end
|
||||
public static final int MAX_LEVEL = 255;
|
||||
private static final Codec<Integer> LEVEL_CODEC = Codec.intRange(0, 255);
|
||||
- private static final Codec<Object2IntOpenHashMap<Holder<Enchantment>>> LEVELS_CODEC = Codec.unboundedMap(
|
||||
+ private static final Codec<Object2IntAVLTreeMap<Holder<Enchantment>>> LEVELS_CODEC = Codec.unboundedMap( // Paper
|
||||
BuiltInRegistries.ENCHANTMENT.holderByNameCodec(), LEVEL_CODEC
|
||||
)
|
||||
- private static final Codec<Object2IntOpenHashMap<Holder<Enchantment>>> LEVELS_CODEC = Codec.unboundedMap(Enchantment.CODEC, LEVEL_CODEC)
|
||||
- .xmap(Object2IntOpenHashMap::new, Function.identity());
|
||||
+ // Paper start - sort enchantments
|
||||
+ private static final Codec<Object2IntAVLTreeMap<Holder<Enchantment>>> LEVELS_CODEC = Codec.unboundedMap(
|
||||
+ Enchantment.CODEC, LEVEL_CODEC
|
||||
+ )// Paper start - sort enchantments
|
||||
+ .xmap(m -> {
|
||||
+ final Object2IntAVLTreeMap<Holder<Enchantment>> map = new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER);
|
||||
+ map.putAll(m);
|
||||
+ return map;
|
||||
+ }, Function.identity());
|
||||
+ // Paper end - sort enchantments
|
||||
+ // Paper end - sort enchantments
|
||||
private static final Codec<ItemEnchantments> FULL_CODEC = RecordCodecBuilder.create(
|
||||
instance -> instance.group(
|
||||
LEVELS_CODEC.fieldOf("levels").forGetter(component -> component.enchantments),
|
||||
|
@ -56,8 +54,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
);
|
||||
public static final Codec<ItemEnchantments> CODEC = Codec.withAlternative(FULL_CODEC, LEVELS_CODEC, map -> new ItemEnchantments(map, true));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, ItemEnchantments> STREAM_CODEC = StreamCodec.composite(
|
||||
- ByteBufCodecs.map(Object2IntOpenHashMap::new, ByteBufCodecs.holderRegistry(Registries.ENCHANTMENT), ByteBufCodecs.VAR_INT),
|
||||
+ ByteBufCodecs.map((v) -> new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER), ByteBufCodecs.holderRegistry(Registries.ENCHANTMENT), ByteBufCodecs.VAR_INT), // Paper
|
||||
- ByteBufCodecs.map(Object2IntOpenHashMap::new, Enchantment.STREAM_CODEC, ByteBufCodecs.VAR_INT),
|
||||
+ ByteBufCodecs.map((v) -> new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER), Enchantment.STREAM_CODEC, ByteBufCodecs.VAR_INT),
|
||||
component -> component.enchantments,
|
||||
ByteBufCodecs.BOOL,
|
||||
component -> component.showInTooltip,
|
||||
|
@ -102,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ this.setItemMeta(itemMeta);
|
||||
}
|
||||
- ItemEnchantments.Mutable listCopy = new ItemEnchantments.Mutable(list);
|
||||
- listCopy.set(CraftEnchantment.bukkitToMinecraft(ench), level);
|
||||
- listCopy.set(CraftEnchantment.bukkitToMinecraftHolder(ench), level);
|
||||
- this.handle.set(DataComponents.ENCHANTMENTS, listCopy.toImmutable());
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -135,7 +133,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
-
|
||||
- ItemEnchantments.Mutable listCopy = new ItemEnchantments.Mutable(list);
|
||||
- listCopy.set(CraftEnchantment.bukkitToMinecraft(ench), -1); // Negative to remove
|
||||
- listCopy.set(CraftEnchantment.bukkitToMinecraftHolder(ench), -1); // Negative to remove
|
||||
- this.handle.set(DataComponents.ENCHANTMENTS, listCopy.toImmutable());
|
||||
+ // Paper end
|
||||
|
|
@ -530,7 +530,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public interface RandomizableContainer extends Container {
|
||||
default boolean tryLoadLootTable(CompoundTag nbt) {
|
||||
if (nbt.contains("LootTable", 8)) {
|
||||
this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable"))));
|
||||
this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable"))));
|
||||
+ if (this.lootableData() != null && this.getLootTable() != null) this.lootableData().loadNbt(nbt); // Paper - LootTable API
|
||||
if (nbt.contains("LootTableSeed", 4)) {
|
||||
this.setLootTableSeed(nbt.getLong("LootTableSeed"));
|
||||
|
@ -663,7 +663,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
default void readChestVehicleSaveData(CompoundTag nbt, HolderLookup.Provider registriesLookup) {
|
||||
this.clearItemStacks();
|
||||
if (nbt.contains("LootTable", 8)) {
|
||||
this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable"))));
|
||||
this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable"))));
|
||||
+ // Paper start - LootTable API
|
||||
+ if (this.getLootTable() != null) {
|
||||
+ this.lootableData().loadNbt(nbt);
|
|
@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
private void explode() {
|
||||
@@ -0,0 +0,0 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
public BlockState getBlockState() {
|
||||
return (BlockState) this.entityData.get(PrimedTnt.DATA_BLOCK_STATE_ID);
|
||||
|
||||
return entity;
|
||||
}
|
||||
+
|
||||
+ // Paper start - Option to prevent TNT from moving in water
|
|
@ -20,8 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ this.internalSetAbsorptionAmount(absorptionAmount);
|
||||
+ // Paper end - Check for NaN
|
||||
if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) {
|
||||
this.getAttributes().load(nbt.getList("Attributes", 10));
|
||||
if (nbt.contains("attributes", 9) && this.level() != null && !this.level().isClientSide) {
|
||||
this.getAttributes().load(nbt.getList("attributes", 10));
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
|
||||
+ private static MinecraftServer SERVER; // Paper
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
Loading…
Add table
Reference in a new issue