mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 12:05:53 +01:00
compile fixes
This commit is contained in:
parent
7aa90a8535
commit
0b291cccce
@ -3203,7 +3203,7 @@ index 0000000000000000000000000000000000000000..d21335930652ffced22f6fd19ab1a4f9
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/FeatureSeedsGeneration.java b/src/main/java/io/papermc/paper/configuration/transformation/world/FeatureSeedsGeneration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..75f612b04f872d0d014fdc40b07c15116857587b
|
||||
index 0000000000000000000000000000000000000000..372dda1738da9ab94c963bb73cecdf52e031c903
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/transformation/world/FeatureSeedsGeneration.java
|
||||
@@ -0,0 +1,71 @@
|
||||
@ -3215,7 +3215,7 @@ index 0000000000000000000000000000000000000000..75f612b04f872d0d014fdc40b07c1511
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2LongMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2LongOpenHashMap;
|
||||
+import net.minecraft.core.Holder;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
@ -3254,7 +3254,7 @@ index 0000000000000000000000000000000000000000..75f612b04f872d0d014fdc40b07c1511
|
||||
+ final Reference2LongMap<Holder<ConfiguredFeature<?, ?>>> features = Objects.requireNonNullElseGet(featureNode.get(new TypeToken<Reference2LongMap<Holder<ConfiguredFeature<?, ?>>>>() {}), Reference2LongOpenHashMap::new);
|
||||
+ final Random random = new SecureRandom();
|
||||
+ AtomicInteger counter = new AtomicInteger(0);
|
||||
+ MinecraftServer.getServer().registryAccess().registryOrThrow(Registry.CONFIGURED_FEATURE_REGISTRY).holders().forEach(holder -> {
|
||||
+ MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).holders().forEach(holder -> {
|
||||
+ if (features.containsKey(holder)) {
|
||||
+ return;
|
||||
+ }
|
||||
@ -3280,16 +3280,17 @@ index 0000000000000000000000000000000000000000..75f612b04f872d0d014fdc40b07c1511
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6af307481a6752529d87869760945cb140d05bed
|
||||
index 0000000000000000000000000000000000000000..edaa6ef28c1f9a2239439698708897008fea2f7e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java
|
||||
@@ -0,0 +1,321 @@
|
||||
@@ -0,0 +1,322 @@
|
||||
+package io.papermc.paper.configuration.transformation.world;
|
||||
+
|
||||
+import io.papermc.paper.configuration.Configuration;
|
||||
+import io.papermc.paper.configuration.WorldConfiguration;
|
||||
+import net.minecraft.core.Holder;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.world.entity.MobCategory;
|
||||
@ -3390,7 +3391,7 @@ index 0000000000000000000000000000000000000000..6af307481a6752529d87869760945cb1
|
||||
+ )
|
||||
+ .addVersion(26, ConfigurationTransformation.builder().addAction(path("alt-item-despawn-rate", "items", ConfigurationTransformation.WILDCARD_OBJECT), (path, value) -> {
|
||||
+ String itemName = path.get(path.size() - 1).toString();
|
||||
+ final Optional<Holder<Item>> item = Registry.ITEM.getHolder(ResourceKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(itemName.toLowerCase(Locale.ENGLISH))));
|
||||
+ final Optional<Holder.Reference<Item>> item = BuiltInRegistries.ITEM.getHolder(ResourceKey.create(Registries.ITEM, new ResourceLocation(itemName.toLowerCase(Locale.ENGLISH))));
|
||||
+ if (item.isEmpty()) {
|
||||
+ itemName = Material.valueOf(itemName).getKey().getKey();
|
||||
+ }
|
||||
@ -3422,7 +3423,7 @@ index 0000000000000000000000000000000000000000..6af307481a6752529d87869760945cb1
|
||||
+ Map<String, Integer> rebuild = new HashMap<>();
|
||||
+ value.childrenMap().forEach((key, node) -> {
|
||||
+ String itemName = key.toString();
|
||||
+ final Optional<Holder<Item>> itemHolder = Registry.ITEM.getHolder(ResourceKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(itemName.toLowerCase(Locale.ENGLISH))));
|
||||
+ final Optional<Holder.Reference<Item>> itemHolder = BuiltInRegistries.ITEM.getHolder(ResourceKey.create(Registries.ITEM, new ResourceLocation(itemName.toLowerCase(Locale.ENGLISH))));
|
||||
+ final @Nullable String item;
|
||||
+ if (itemHolder.isEmpty()) {
|
||||
+ final @Nullable Material bukkitMat = Material.matchMaterial(itemName);
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 05b32ac76dbc3c0a16380cab82415dac6aff25de..acd84748204bad0dbfc59fbd516f873e0aa16a40 100644
|
||||
index 05b32ac76dbc3c0a16380cab82415dac6aff25de..3cdc77d9dbc39a99a7f47aad03e8ab0d05270d61 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1228,7 +1228,7 @@ public abstract class Player extends LivingEntity {
|
||||
@ -63,7 +63,7 @@ index 05b32ac76dbc3c0a16380cab82415dac6aff25de..acd84748204bad0dbfc59fbd516f873e
|
||||
+ private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
|
||||
+ fromEntity.level.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
|
||||
+ if (fromEntity instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
|
||||
+ ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
@ -8,10 +8,10 @@ Use larger initial sizes to increase bucket capacity on the BiMap
|
||||
BiMap.get was seen to be using a good bit of CPU time.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
index 300e009abbc41961d59d55d965e9a99d44c21e32..38a4c1d355e74dbe0cf7f5040d00423209aca0d1 100644
|
||||
index 300e009abbc41961d59d55d965e9a99d44c21e32..1e33434f9f361542e03da3e4812bc6d76768a202 100644
|
||||
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
@@ -36,14 +36,12 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
@@ -36,13 +36,11 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
final ResourceKey<? extends Registry<T>> key;
|
||||
private final ObjectList<Holder.Reference<T>> byId = new ObjectArrayList<>(256);
|
||||
@ -22,16 +22,14 @@ index 300e009abbc41961d59d55d965e9a99d44c21e32..38a4c1d355e74dbe0cf7f5040d004232
|
||||
- private final Map<ResourceKey<T>, Holder.Reference<T>> byKey = new HashMap<>();
|
||||
- private final Map<T, Holder.Reference<T>> byValue = new IdentityHashMap<>();
|
||||
- private final Map<T, Lifecycle> lifecycles = new IdentityHashMap<>();
|
||||
- private Lifecycle registryLifecycle;
|
||||
+ private final it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap<T> toId = new it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap<T>(2048);// Paper - use bigger expected size to reduce collisions and direct intent for FastUtil to be identity map
|
||||
+ private final Map<ResourceLocation, Holder.Reference<T>> byLocation = new HashMap<>(2048); // Paper - use bigger expected size to reduce collisions
|
||||
+ private final Map<ResourceKey<T>, Holder.Reference<T>> byKey = new HashMap<>(2048); // Paper - use bigger expected size to reduce collisions
|
||||
+ private final Map<T, Holder.Reference<T>> byValue = new IdentityHashMap<>(2048); // Paper - use bigger expected size to reduce collisions
|
||||
+ private final Map<T, Lifecycle> lifecycles = new IdentityHashMap<>(2048); // Paper - use bigger expected size to reduce collisions
|
||||
+ private Lifecycle elementsLifecycle;
|
||||
private Lifecycle registryLifecycle;
|
||||
private volatile Map<TagKey<T>, HolderSet.Named<T>> tags = new IdentityHashMap<>();
|
||||
private boolean frozen;
|
||||
@Nullable
|
||||
@@ -88,6 +86,7 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ and then catch exceptions and close if they fire.
|
||||
Part of this commit was authored by: Spottedleaf, sandtechnology
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b72278b9c29e 100644
|
||||
index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6f256d0cd 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -116,6 +116,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@ -50,7 +50,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b722
|
||||
this.channel.attr(Connection.ATTRIBUTE_PROTOCOL).set(state);
|
||||
this.channel.config().setAutoRead(true);
|
||||
Connection.LOGGER.debug("Enabled auto read");
|
||||
@@ -217,19 +222,89 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -217,19 +222,88 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
Validate.notNull(listener, "packetListener", new Object[0]);
|
||||
this.packetListener = listener;
|
||||
}
|
||||
@ -88,7 +88,6 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b722
|
||||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundKeepAlivePacket ||
|
||||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket ||
|
||||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundSystemChatPacket ||
|
||||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundChatPreviewPacket ||
|
||||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundCommandSuggestionsPacket ||
|
||||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket ||
|
||||
+ packet instanceof net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket ||
|
||||
@ -144,7 +143,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b722
|
||||
}
|
||||
|
||||
private void sendPacket(Packet<?> packet, @Nullable PacketSendListener callbacks) {
|
||||
@@ -257,6 +332,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -257,6 +331,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
this.setProtocol(packetState);
|
||||
}
|
||||
|
||||
@ -160,7 +159,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b722
|
||||
ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
|
||||
|
||||
if (callbacks != null) {
|
||||
@@ -275,28 +359,72 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -275,28 +358,72 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
});
|
||||
}
|
||||
@ -241,7 +240,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b722
|
||||
} finally { // Paper start - add pending task queue
|
||||
Runnable r;
|
||||
while ((r = this.pendingTasks.poll()) != null) {
|
||||
@@ -304,6 +432,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -304,6 +431,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
} // Paper end - add pending task queue
|
||||
}
|
||||
@ -249,7 +248,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b722
|
||||
|
||||
public void tick() {
|
||||
this.flushQueue();
|
||||
@@ -340,9 +469,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -340,9 +468,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
return this.address;
|
||||
}
|
||||
|
||||
@ -272,7 +271,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b722
|
||||
// Spigot End
|
||||
if (this.channel.isOpen()) {
|
||||
this.channel.close(); // We can't wait as this may be called from an event loop.
|
||||
@@ -460,7 +602,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -460,7 +601,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
public void handleDisconnection() {
|
||||
if (this.channel != null && !this.channel.isOpen()) {
|
||||
if (this.disconnectionHandled) {
|
||||
@ -281,7 +280,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b722
|
||||
} else {
|
||||
this.disconnectionHandled = true;
|
||||
if (this.getDisconnectedReason() != null) {
|
||||
@@ -468,7 +610,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -468,7 +609,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
} else if (this.getPacketListener() != null) {
|
||||
this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic"));
|
||||
}
|
||||
@ -290,7 +289,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..8bc8b6013ea5803e091cf3534130b722
|
||||
// Paper start - Add PlayerConnectionCloseEvent
|
||||
final PacketListener packetListener = this.getPacketListener();
|
||||
if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl) {
|
||||
@@ -508,6 +650,18 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -508,6 +649,18 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@Nullable
|
||||
final PacketSendListener listener;
|
||||
|
||||
|
@ -6,9 +6,10 @@ Subject: [PATCH] Mob Spawner API Enhancements
|
||||
== AT ==
|
||||
public net.minecraft.world.level.BaseSpawner isNearPlayer(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Z
|
||||
public net.minecraft.world.level.BaseSpawner delay(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V
|
||||
public net.minecraft.world.level.BaseSpawner setNextSpawnData(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/SpawnData;)V
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
index 2ae7b8d1129a3549c5ba6fe03455b0b0683c9c31..c58cd26ac15308d249f7d50fed530a6093091d36 100644
|
||||
index 6ba97a0b4f2cb15d5435657c8e8f5c71c6fee3db..c5a117308f051c20b81818ad91e0ca40177feb69 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -239,7 +239,13 @@ public abstract class BaseSpawner {
|
||||
@ -68,7 +69,7 @@ index 2ae7b8d1129a3549c5ba6fe03455b0b0683c9c31..c58cd26ac15308d249f7d50fed530a60
|
||||
nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
|
||||
nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
|
||||
index 590d77470e979b331917aaa8cbc30a6513e385db..348c4e10480fe261d557a113e086324236239422 100644
|
||||
index 590d77470e979b331917aaa8cbc30a6513e385db..6887b479488e8d25c6170c29ce7955df927cba68 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
|
||||
@@ -116,4 +116,28 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<SpawnerBlockEnti
|
||||
@ -94,7 +95,7 @@ index 590d77470e979b331917aaa8cbc30a6513e385db..348c4e10480fe261d557a113e0863242
|
||||
+ Preconditions.checkArgument(itemStack != null && !itemStack.getType().isAir(), "spawners cannot spawn air");
|
||||
+ net.minecraft.world.item.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(itemStack);
|
||||
+ net.minecraft.nbt.CompoundTag entity = new net.minecraft.nbt.CompoundTag();
|
||||
+ entity.putString("id", net.minecraft.core.Registry.ENTITY_TYPE.getKey(net.minecraft.world.entity.EntityType.ITEM).toString());
|
||||
+ entity.putString("id", net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getKey(net.minecraft.world.entity.EntityType.ITEM).toString());
|
||||
+ entity.put("Item", item.save(new net.minecraft.nbt.CompoundTag()));
|
||||
+ this.getSnapshot().getSpawner().setNextSpawnData(this.isPlaced() ? this.world.getHandle() : null, this.getPosition(), new net.minecraft.world.level.SpawnData(entity, java.util.Optional.empty()));
|
||||
+ }
|
||||
|
@ -156,7 +156,7 @@ index 8f729134d8f024678f3f5927059791e28ccb5b90..b294ef87fb93e7f4651dc04128124f29
|
||||
} catch (Throwable throwable) {
|
||||
if (dataoutputstream != null) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 31a4424670bbf631845ab0ec61e523d4aeea20f6..cef2d2494268c968dc8d26f9d5d0ee68a4ad465c 100644
|
||||
index 31a4424670bbf631845ab0ec61e523d4aeea20f6..6409a71898b7934c81700cd72bb4173f49436fce 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -298,9 +298,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@ -181,7 +181,7 @@ index 31a4424670bbf631845ab0ec61e523d4aeea20f6..cef2d2494268c968dc8d26f9d5d0ee68
|
||||
- } catch (InterruptedException | ExecutionException ex) {
|
||||
+ return world.getChunkSource().chunkMap.getChunkStatusOnDisk(new ChunkPos(x, z)) == ChunkStatus.FULL;
|
||||
+ // Paper end
|
||||
+ } catch (IOException ex) {
|
||||
+ } catch (java.io.IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
@ -218,7 +218,7 @@ index 31a4424670bbf631845ab0ec61e523d4aeea20f6..cef2d2494268c968dc8d26f9d5d0ee68
|
||||
+ net.minecraft.world.level.chunk.storage.RegionFile file;
|
||||
+ try {
|
||||
+ file = world.getChunkSource().chunkMap.regionFileCache.getRegionFile(chunkPos, false);
|
||||
+ } catch (IOException ex) {
|
||||
+ } catch (java.io.IOException ex) {
|
||||
+ throw new RuntimeException(ex);
|
||||
+ }
|
||||
+
|
||||
|
@ -8,10 +8,10 @@ the world per tick, this attempts to reduce the impact that join floods
|
||||
has on the server
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index dca0c978b30962d4216dc443d7d105e54a29ae1b..3ae55dd6441b2dfdb67eb2f24ecf885bab89e7a6 100644
|
||||
index d032f8d011b94f396c9d5606f42a8c331db62740..4487b4329cf09a6538e272c44207dda492ceb099 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -434,8 +434,23 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -433,8 +433,23 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] More World API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 2770412715a9fbd60317d356491f9f0b0bacf57d..ac8f0b163b6b2c7eefb8dd24a878112367b13566 100644
|
||||
index 8e6959826f4ff6363905eb221f6da9bb21a3733a..b61ecd22b287572edc3c6d2b1f05989221fe67cb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2034,6 +2034,65 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@ -62,12 +62,12 @@ index 2770412715a9fbd60317d356491f9f0b0bacf57d..ac8f0b163b6b2c7eefb8dd24a8781123
|
||||
+
|
||||
+ @Override
|
||||
+ public Collection<org.bukkit.Material> getInfiniburn() {
|
||||
+ return com.google.common.collect.Sets.newHashSet(com.google.common.collect.Iterators.transform(net.minecraft.core.Registry.BLOCK.getTagOrEmpty(this.getHandle().dimensionType().infiniburn()).iterator(), blockHolder -> CraftMagicNumbers.getMaterial(blockHolder.value())));
|
||||
+ return com.google.common.collect.Sets.newHashSet(com.google.common.collect.Iterators.transform(net.minecraft.core.registries.BuiltInRegistries.BLOCK.getTagOrEmpty(this.getHandle().dimensionType().infiniburn()).iterator(), blockHolder -> CraftMagicNumbers.getMaterial(blockHolder.value())));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
|
||||
+ getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.Registry.GAME_EVENT.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position));
|
||||
+ getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
@ -122,10 +122,10 @@ index 0000000000000000000000000000000000000000..0d7e7db9e37ef0183c32b217bd944fb4
|
||||
+ COMPRESSION_DISABLED
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index f76ee2131c35a9dbf7ad9d086b51c9644b0a2462..a7ab818440dc98087d877d7efdfafbf65e9ca92d 100644
|
||||
index 43fd36b2ed8e58a2e6213d749a8612a98be421b2..d8b0fb4854280ae1e7b95d414a725996d4fb4c77 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -605,6 +605,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -604,6 +604,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
} else {
|
||||
this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold));
|
||||
}
|
||||
@ -133,7 +133,7 @@ index f76ee2131c35a9dbf7ad9d086b51c9644b0a2462..a7ab818440dc98087d877d7efdfafbf6
|
||||
} else {
|
||||
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
|
||||
this.channel.pipeline().remove("decompress");
|
||||
@@ -613,6 +614,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -612,6 +613,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
if (this.channel.pipeline().get("compress") instanceof CompressionEncoder) {
|
||||
this.channel.pipeline().remove("compress");
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ index d5cd8d540438638268cc26e2fc9be8415950ee22..13f8b4699c5b3a99715fada2d774469f
|
||||
|
||||
if (dimensionKey == LevelStem.OVERWORLD) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 7ed5f86f66b49d33952b2cb3dd5ea438284fcbd4..e42cb082e4f3643fbae730d23b53ccc5c3440665 100644
|
||||
index 7ed5f86f66b49d33952b2cb3dd5ea438284fcbd4..982dc85ea66bf111a01a62df43696ca550e1294d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -181,6 +181,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@ -316,7 +316,7 @@ index 7ed5f86f66b49d33952b2cb3dd5ea438284fcbd4..e42cb082e4f3643fbae730d23b53ccc5
|
||||
+ // Paper start - fix and optimise world upgrading
|
||||
+ // copied from below
|
||||
+ public static ResourceKey<DimensionType> getDimensionKey(DimensionType manager) {
|
||||
+ return ((org.bukkit.craftbukkit.CraftServer)org.bukkit.Bukkit.getServer()).getHandle().getServer().registryHolder.ownedRegistryOrThrow(net.minecraft.core.Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(manager).orElseThrow(() -> {
|
||||
+ return ((org.bukkit.craftbukkit.CraftServer)org.bukkit.Bukkit.getServer()).getHandle().getServer().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.DIMENSION_TYPE).getResourceKey(manager).orElseThrow(() -> {
|
||||
+ return new IllegalStateException("Unregistered dimension type: " + manager);
|
||||
+ });
|
||||
+ }
|
||||
|
@ -11,10 +11,10 @@ Tested-by: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Reviewed-by: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index a7ab818440dc98087d877d7efdfafbf65e9ca92d..ea6c1439e92c24194cde4dcf6388363a8cc5d649 100644
|
||||
index d8b0fb4854280ae1e7b95d414a725996d4fb4c77..9515626305d8496eac2a7af65ba39fcda60c782a 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -691,6 +691,11 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -690,6 +690,11 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
// Spigot Start
|
||||
public SocketAddress getRawAddress()
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Attributes API for item defaults
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index fa2042a6bd12734ebdb99b5c04af7ac671f454ac..4195a6e8bb58b0e60354900fe021b10b1d25cf12 100644
|
||||
index fa2042a6bd12734ebdb99b5c04af7ac671f454ac..17d2acec4a2dde895019e58bdd35996d273d6ec5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -548,6 +548,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@ -20,7 +20,7 @@ index fa2042a6bd12734ebdb99b5c04af7ac671f454ac..4195a6e8bb58b0e60354900fe021b10b
|
||||
+ }
|
||||
+ ImmutableMultimap.Builder<Attribute, AttributeModifier> attributeMapBuilder = ImmutableMultimap.builder();
|
||||
+ item.getDefaultAttributeModifiers(CraftEquipmentSlot.getNMS(equipmentSlot)).forEach((attributeBase, attributeModifier) -> {
|
||||
+ attributeMapBuilder.put(CraftAttributeMap.fromMinecraft(net.minecraft.core.Registry.ATTRIBUTE.getKey(attributeBase).toString()), CraftAttributeInstance.convert(attributeModifier, equipmentSlot));
|
||||
+ attributeMapBuilder.put(CraftAttributeMap.fromMinecraft(net.minecraft.core.registries.BuiltInRegistries.ATTRIBUTE.getKey(attributeBase).toString()), CraftAttributeInstance.convert(attributeModifier, equipmentSlot));
|
||||
+ });
|
||||
+ return attributeMapBuilder.build();
|
||||
+ }
|
||||
|
@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..cf9d28ea97d93cec05c9fb768d59e283
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 4195a6e8bb58b0e60354900fe021b10b1d25cf12..84c71a28b16160c2eae53707e29bc6242ac08b26 100644
|
||||
index 17d2acec4a2dde895019e58bdd35996d273d6ec5..2dd4f67555a9207945b393e56af5672e042afaf4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -565,6 +565,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@ -91,13 +91,13 @@ index 4195a6e8bb58b0e60354900fe021b10b1d25cf12..84c71a28b16160c2eae53707e29bc624
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasDefaultEntityAttributes(NamespacedKey bukkitEntityKey) {
|
||||
+ return net.minecraft.world.entity.ai.attributes.DefaultAttributes.hasSupplier(net.minecraft.core.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ return net.minecraft.world.entity.ai.attributes.DefaultAttributes.hasSupplier(net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.attribute.Attributable getDefaultEntityAttributes(NamespacedKey bukkitEntityKey) {
|
||||
+ Preconditions.checkArgument(hasDefaultEntityAttributes(bukkitEntityKey), bukkitEntityKey + " doesn't have default attributes");
|
||||
+ var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
|
||||
+ }
|
||||
// Paper end
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add ItemFactory#getSpawnEgg API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
index b7a53edbf6c4730ae65a8e5fb414feaef9bdf1b7..2d25b7fb8e0c8984a6d3bad94b177713e3114533 100644
|
||||
index b7a53edbf6c4730ae65a8e5fb414feaef9bdf1b7..a0d146b2f32c9de63658d9c791385c349f12f853 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
@@ -465,5 +465,17 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
@ -20,7 +20,7 @@ index b7a53edbf6c4730ae65a8e5fb414feaef9bdf1b7..2d25b7fb8e0c8984a6d3bad94b177713
|
||||
+ }
|
||||
+ String typeId = type.getKey().toString();
|
||||
+ net.minecraft.resources.ResourceLocation typeKey = new net.minecraft.resources.ResourceLocation(typeId);
|
||||
+ net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.core.Registry.ENTITY_TYPE.get(typeKey);
|
||||
+ net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(typeKey);
|
||||
+ net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.byId(nmsType);
|
||||
+ return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
|
||||
+ }
|
||||
|
@ -39,11 +39,11 @@ index 7b9e943b391c061782fccd2b8d705ceec8db50fe..966ac60daebb7bb211ab8096fc0c5f33
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 84c71a28b16160c2eae53707e29bc6242ac08b26..1cf2c29e4fc7073b19f62368ce4569ce54a4b13d 100644
|
||||
index 2dd4f67555a9207945b393e56af5672e042afaf4..f4807829a7a51a5aeab8277211a4d62cf7df2aca 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -577,6 +577,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
|
||||
}
|
||||
+
|
||||
|
@ -9,7 +9,7 @@ This patch will be used to optimise out flush calls in later
|
||||
patches.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index ea6c1439e92c24194cde4dcf6388363a8cc5d649..40a0f68c42000757ba8b0e8bdbd4cd34cce89cfe 100644
|
||||
index 9515626305d8496eac2a7af65ba39fcda60c782a..b996b5c6a8dccd122fbb5d04f446927ae788bad5 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -122,6 +122,39 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@ -52,7 +52,7 @@ index ea6c1439e92c24194cde4dcf6388363a8cc5d649..40a0f68c42000757ba8b0e8bdbd4cd34
|
||||
public Connection(PacketFlow side) {
|
||||
this.receiving = side;
|
||||
}
|
||||
@@ -287,7 +320,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -286,7 +319,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
io.papermc.paper.util.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() &&
|
||||
(packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty())
|
||||
))) {
|
||||
@ -61,7 +61,7 @@ index ea6c1439e92c24194cde4dcf6388363a8cc5d649..40a0f68c42000757ba8b0e8bdbd4cd34
|
||||
return;
|
||||
}
|
||||
// write the packets to the queue, then flush - antixray hooks there already
|
||||
@@ -311,6 +344,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -310,6 +343,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
|
||||
private void sendPacket(Packet<?> packet, @Nullable PacketSendListener callbacks) {
|
||||
@ -76,7 +76,7 @@ index ea6c1439e92c24194cde4dcf6388363a8cc5d649..40a0f68c42000757ba8b0e8bdbd4cd34
|
||||
ConnectionProtocol enumprotocol = ConnectionProtocol.getProtocolForPacket(packet);
|
||||
ConnectionProtocol enumprotocol1 = this.getCurrentProtocol();
|
||||
|
||||
@@ -321,16 +362,21 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -320,16 +361,21 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
|
||||
if (this.channel.eventLoop().inEventLoop()) {
|
||||
@ -100,7 +100,7 @@ index ea6c1439e92c24194cde4dcf6388363a8cc5d649..40a0f68c42000757ba8b0e8bdbd4cd34
|
||||
if (packetState != currentState) {
|
||||
this.setProtocol(packetState);
|
||||
}
|
||||
@@ -344,7 +390,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -343,7 +389,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
try {
|
||||
// Paper end
|
||||
@ -109,7 +109,7 @@ index ea6c1439e92c24194cde4dcf6388363a8cc5d649..40a0f68c42000757ba8b0e8bdbd4cd34
|
||||
|
||||
if (callbacks != null) {
|
||||
channelfuture.addListener((future) -> {
|
||||
@@ -400,6 +446,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -399,6 +445,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
private boolean processQueue() {
|
||||
try { // Paper - add pending task queue
|
||||
if (this.queue.isEmpty()) return true;
|
||||
@ -120,7 +120,7 @@ index ea6c1439e92c24194cde4dcf6388363a8cc5d649..40a0f68c42000757ba8b0e8bdbd4cd34
|
||||
// If we are on main, we are safe here in that nothing else should be processing queue off main anymore
|
||||
// But if we are not on main due to login/status, the parent is synchronized on packetQueue
|
||||
java.util.Iterator<PacketHolder> iterator = this.queue.iterator();
|
||||
@@ -407,7 +457,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -406,7 +456,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
PacketHolder queued = iterator.next(); // poll -> peek
|
||||
|
||||
// Fix NPE (Spigot bug caused by handleDisconnection())
|
||||
@ -129,7 +129,7 @@ index ea6c1439e92c24194cde4dcf6388363a8cc5d649..40a0f68c42000757ba8b0e8bdbd4cd34
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -419,11 +469,17 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -418,11 +468,17 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
Packet<?> packet = queued.packet;
|
||||
if (!packet.isReady()) {
|
||||
|
@ -7,10 +7,10 @@ Subject: [PATCH] Detail more information in watchdog dumps
|
||||
- Dump player name, player uuid, position, and world for packet handling
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 40a0f68c42000757ba8b0e8bdbd4cd34cce89cfe..31dee6fbf50db4b1fe779a8ad67ac771ac7148b7 100644
|
||||
index b996b5c6a8dccd122fbb5d04f446927ae788bad5..8ba85f8b36b06ce5047b2587018a49dc50207866 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -513,9 +513,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -512,9 +512,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
PacketListener packetlistener = this.packetListener;
|
||||
|
||||
if (packetlistener instanceof TickablePacketListener) {
|
||||
|
@ -20,7 +20,7 @@ up on this optimisation before he came along.
|
||||
Locally this patch drops the entity tracker tick by a full 1.5x.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index c3abb615ab3be179a53fc6de8085df7b6a854a0b..2bc49ccf7eb2f1f3f956da365340e958dbb076a7 100644
|
||||
index af38c38c03c93392906f752958090b3ab2dd0964..fdfd8be686b9a7f99597ba918b20a0b688ec66cd 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -46,6 +46,8 @@ import org.slf4j.Logger;
|
||||
@ -32,7 +32,7 @@ index c3abb615ab3be179a53fc6de8085df7b6a854a0b..2bc49ccf7eb2f1f3f956da365340e958
|
||||
public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F;
|
||||
@@ -419,9 +421,19 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -418,9 +420,19 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
if (this.channel.eventLoop().inEventLoop()) {
|
||||
this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper
|
||||
} else {
|
||||
|
@ -268,10 +268,10 @@ index 792883afe53d2b7989c25a81c2f9a639d5e21d20..c04379ca8a4db0f4de46ad2b3b338431
|
||||
return this.threshold;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 2bc49ccf7eb2f1f3f956da365340e958dbb076a7..f1e1a4a48349c0e431b31327fdf217989db027b3 100644
|
||||
index fdfd8be686b9a7f99597ba918b20a0b688ec66cd..507e98438f6d13de1bcf063db673a8e483dbea47 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -690,11 +690,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -689,11 +689,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
return networkmanager;
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ index 2bc49ccf7eb2f1f3f956da365340e958dbb076a7..f1e1a4a48349c0e431b31327fdf21798
|
||||
|
||||
public boolean isEncrypted() {
|
||||
return this.encrypted;
|
||||
@@ -723,16 +740,17 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -722,16 +739,17 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
|
||||
public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) {
|
||||
if (compressionThreshold >= 0) {
|
||||
|
@ -18,7 +18,7 @@ index 0868805c78d991c602d8f1d1b5aeb5c790c13384..6986d5475b090bca60b5ae892512fd5e
|
||||
biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 9e0f99cdc544bdf1ca7ddd1fe7893592bafca2fd..1fa90e90b1989aa9ce72beea6c15cd8fb1e24d06 100644
|
||||
index 961a68252baabb0b7ccc9f7aa88dcb7516d0865f..135dd847700158332c3d770be6e13c1f9a893c03 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1236,7 +1236,7 @@ public final class CraftServer implements Server {
|
||||
@ -31,7 +31,7 @@ index 9e0f99cdc544bdf1ca7ddd1fe7893592bafca2fd..1fa90e90b1989aa9ce72beea6c15cd8f
|
||||
biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 7a3aaeb5191f03b8288dde7567bed686150e70a0..c9ec47de502adfc63f5d3ef4ec479208635f3967 100644
|
||||
index 41289cc5dc51ff18a7bf199b738d33a985761edf..d80b9dda3fd9b4b0a2c4b7545c6b22674c0449e4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -199,6 +199,30 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@ -45,7 +45,7 @@ index 7a3aaeb5191f03b8288dde7567bed686150e70a0..c9ec47de502adfc63f5d3ef4ec479208
|
||||
+
|
||||
+ final net.minecraft.world.level.biome.BiomeSource biomeSource = serverCache.getGenerator().getBiomeSource();
|
||||
+ final net.minecraft.world.level.biome.Climate.Sampler sampler = serverCache.randomState().sampler();
|
||||
+ final net.minecraft.core.Registry<net.minecraft.world.level.biome.Biome> biomeRegistry = this.getHandle().registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY);
|
||||
+ final net.minecraft.core.Registry<net.minecraft.world.level.biome.Biome> biomeRegistry = this.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME);
|
||||
+
|
||||
+ final List<Biome> possibleBiomes = biomeSource.possibleBiomes().stream()
|
||||
+ .map(biome -> CraftBlock.biomeBaseToBiome(biomeRegistry, biome))
|
||||
@ -66,7 +66,7 @@ index 7a3aaeb5191f03b8288dde7567bed686150e70a0..c9ec47de502adfc63f5d3ef4ec479208
|
||||
|
||||
private static final Random rand = new Random();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftWorldInfo.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftWorldInfo.java
|
||||
index 5d655d6cd3e23e0287069f8bdf77601487e862fd..e17366910813a6149d3cd403a54de2daf9008cf8 100644
|
||||
index 5d655d6cd3e23e0287069f8bdf77601487e862fd..5dbd1a6d314ebbb072cb61360ca5c1043f47a38d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftWorldInfo.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftWorldInfo.java
|
||||
@@ -17,8 +17,14 @@ public class CraftWorldInfo implements WorldInfo {
|
||||
@ -112,13 +112,13 @@ index 5d655d6cd3e23e0287069f8bdf77601487e862fd..e17366910813a6149d3cd403a54de2da
|
||||
+ final net.minecraft.world.level.levelgen.RandomState randomState;
|
||||
+ if (vanillaChunkGenerator instanceof net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator noiseBasedChunkGenerator) {
|
||||
+ randomState = net.minecraft.world.level.levelgen.RandomState.create(noiseBasedChunkGenerator.generatorSettings().value(),
|
||||
+ registryAccess.registryOrThrow(net.minecraft.core.Registry.NOISE_REGISTRY), getSeed());
|
||||
+ registryAccess.lookupOrThrow(net.minecraft.core.registries.Registries.NOISE), getSeed());
|
||||
+ } else {
|
||||
+ randomState = net.minecraft.world.level.levelgen.RandomState.create(net.minecraft.world.level.levelgen.NoiseGeneratorSettings.dummy(),
|
||||
+ registryAccess.registryOrThrow(net.minecraft.core.Registry.NOISE_REGISTRY), getSeed());
|
||||
+ registryAccess.lookupOrThrow(net.minecraft.core.registries.Registries.NOISE), getSeed());
|
||||
+ }
|
||||
+
|
||||
+ final net.minecraft.core.Registry<net.minecraft.world.level.biome.Biome> biomeRegistry = CraftWorldInfo.this.registryAccess.registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY);
|
||||
+ final net.minecraft.core.Registry<net.minecraft.world.level.biome.Biome> biomeRegistry = CraftWorldInfo.this.registryAccess.registryOrThrow(net.minecraft.core.registries.Registries.BIOME);
|
||||
+ final java.util.List<org.bukkit.block.Biome> possibleBiomes = CraftWorldInfo.this.vanillaChunkGenerator.getBiomeSource().possibleBiomes().stream()
|
||||
+ .map(biome -> org.bukkit.craftbukkit.block.CraftBlock.biomeBaseToBiome(biomeRegistry, biome))
|
||||
+ .toList();
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] More PotionEffectType API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
|
||||
index 5a8c29cc117ce9478cc205f6fdbe63d227268775..c9a2cf4b7476f7b5d7de38ac70e2fc69a486d2a1 100644
|
||||
index 5a8c29cc117ce9478cc205f6fdbe63d227268775..3bda325cfd5d0d8dcc878cf547c9ae9e82fde240 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
|
||||
@@ -105,4 +105,46 @@ public class CraftPotionEffectType extends PotionEffectType {
|
||||
@ -15,7 +15,7 @@ index 5a8c29cc117ce9478cc205f6fdbe63d227268775..c9a2cf4b7476f7b5d7de38ac70e2fc69
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public org.bukkit.NamespacedKey getKey() {
|
||||
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(net.minecraft.core.Registry.MOB_EFFECT.getKey(this.handle));
|
||||
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(net.minecraft.core.registries.BuiltInRegistries.MOB_EFFECT.getKey(this.handle));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -10,7 +10,7 @@ so we do not need that. The client only needs the chunk it is currently in to
|
||||
be loaded to close the loading screen, so we just send an empty one.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index a12c3c5c9f7733f3e84a676cd4e58b95e9ad49bf..d9c1445fee611ebd3dbb19e1e60da3a8bb752d42 100644
|
||||
index a12c3c5c9f7733f3e84a676cd4e58b95e9ad49bf..e8d07180ce69602895b4e584932c4322d3791c27 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -437,6 +437,16 @@ public abstract class PlayerList {
|
||||
@ -19,7 +19,7 @@ index a12c3c5c9f7733f3e84a676cd4e58b95e9ad49bf..d9c1445fee611ebd3dbb19e1e60da3a8
|
||||
onPlayerJoinFinish(player, worldserver1, s1);
|
||||
+ // Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead
|
||||
+ if (player.isDeadOrDying()) {
|
||||
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> plains = worldserver1.registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY)
|
||||
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> plains = worldserver1.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME)
|
||||
+ .getHolderOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS);
|
||||
+ player.connection.send(new net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket(
|
||||
+ new net.minecraft.world.level.chunk.EmptyLevelChunk(worldserver1, player.chunkPosition(), plains),
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Implement getComputedBiome API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
index e365081bf532488f2b41b22deb2fb2346d4f2322..3209d13a12a033e157621920a0cefdad5727463f 100644
|
||||
index e365081bf532488f2b41b22deb2fb2346d4f2322..446657577aa843e6ebc5143b6c511f33d27b6360 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
@@ -214,6 +214,13 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
||||
@ -15,7 +15,7 @@ index e365081bf532488f2b41b22deb2fb2346d4f2322..3209d13a12a033e157621920a0cefdad
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public Biome getComputedBiome(int x, int y, int z) {
|
||||
+ return CraftBlock.biomeBaseToBiome(this.getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), this.getHandle().getBiome(new BlockPos(x, y, z)));
|
||||
+ return CraftBlock.biomeBaseToBiome(this.getHandle().registryAccess().registryOrThrow(Registries.BIOME), this.getHandle().getBiome(new BlockPos(x, y, z)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
@ -40,7 +40,7 @@ index e0bf615fb1b99abbab2be55a4ee345204b36e218..7b3b12b4b2f5dbd37e23a7f5a0ad2abd
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java
|
||||
index cdd474e9b0363641839a66d3e61fec46c735879a..3611e3e9d33a0f1d82a78a27ea5c2c649225f564 100644
|
||||
index cdd474e9b0363641839a66d3e61fec46c735879a..1a987b3c8f044dfd217e984dc122582095367e46 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/tag/CraftFluidTag.java
|
||||
@@ -14,9 +14,10 @@ public class CraftFluidTag extends CraftTag<net.minecraft.world.level.material.F
|
||||
@ -51,7 +51,7 @@ index cdd474e9b0363641839a66d3e61fec46c735879a..3611e3e9d33a0f1d82a78a27ea5c2c64
|
||||
@Override
|
||||
public boolean isTagged(Fluid fluid) {
|
||||
- return registry.getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.Registry.FLUID_REGISTRY, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(fluid.getKey()))).is(tag); // Paper
|
||||
+ return registry.getHolderOrThrow(KEY_CACHE.computeIfAbsent(fluid, f -> net.minecraft.resources.ResourceKey.create(net.minecraft.core.Registry.FLUID_REGISTRY, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(f.getKey())))).is(tag); // Paper - cache key
|
||||
+ return registry.getHolderOrThrow(KEY_CACHE.computeIfAbsent(fluid, f -> net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.FLUID, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(f.getKey())))).is(tag); // Paper - cache key
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add NamespacedKey biome methods
|
||||
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 7afa387ab07da199ba719fa08a1faba66c3025fa..ee25a6f714d58f3a6b9f7d9d28880c4e63bc6a44 100644
|
||||
index 45e13c9dc4a65207728cdb401511b187597fe199..17336102d37a5ab05c3b3c93fcf46961d0ffa7e2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -607,6 +607,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@ -17,13 +17,13 @@ index 7afa387ab07da199ba719fa08a1faba66c3025fa..ee25a6f714d58f3a6b9f7d9d28880c4e
|
||||
+ @Override
|
||||
+ public org.bukkit.NamespacedKey getBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z) {
|
||||
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
|
||||
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY).getKey(cra.getHandle().getBiome(new net.minecraft.core.BlockPos(x, y, z)).value()));
|
||||
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getKey(cra.getHandle().getBiome(new net.minecraft.core.BlockPos(x, y, z)).value()));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z, org.bukkit.NamespacedKey biomeKey) {
|
||||
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
|
||||
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.Registry.BIOME_REGISTRY, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
|
||||
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
|
||||
+ cra.setBiome(x, y, z, biomeBase);
|
||||
+ }
|
||||
// Paper end
|
||||
|
Loading…
Reference in New Issue
Block a user