mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 20:21:41 +01:00
More more more more more more more more more more patches
This commit is contained in:
parent
bf30d497ba
commit
7c319bce76
@ -48,14 +48,6 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -0,0 +0,0 @@ import net.minecraft.world.level.biome.BiomeSource;
|
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.dimension.DimensionType;
|
|
||||||
import net.minecraft.world.level.dimension.LevelStem;
|
|
||||||
+import net.minecraft.world.level.gameevent.GameEvent;
|
|
||||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
|
||||||
import net.minecraft.world.level.levelgen.PatrolSpawner;
|
|
||||||
import net.minecraft.world.level.levelgen.PhantomSpawner;
|
|
||||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||||
return (org.bukkit.Tag<T>) new CraftEntityTag(Registry.ENTITY_TYPE, entityTagKey);
|
return (org.bukkit.Tag<T>) new CraftEntityTag(Registry.ENTITY_TYPE, entityTagKey);
|
||||||
}
|
}
|
||||||
@ -79,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ case org.bukkit.Tag.REGISTRY_GAME_EVENTS -> {
|
+ case org.bukkit.Tag.REGISTRY_GAME_EVENTS -> {
|
||||||
+ Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class);
|
+ Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class);
|
||||||
+ Registry<GameEvent> gameEvents = Registry.GAME_EVENT;
|
+ Registry<net.minecraft.world.level.gameevent.GameEvent> gameEvents = Registry.GAME_EVENT;
|
||||||
+ return gameEvents.getTags().map(pair -> (org.bukkit.Tag<T>) new io.papermc.paper.CraftGameEventTag(gameEvents, pair.getFirst())).collect(ImmutableList.toImmutableList());
|
+ return gameEvents.getTags().map(pair -> (org.bukkit.Tag<T>) new io.papermc.paper.CraftGameEventTag(gameEvents, pair.getFirst())).collect(ImmutableList.toImmutableList());
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+ }
|
+ }
|
@ -8,18 +8,18 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
|
@@ -0,0 +0,0 @@ public abstract class ChunkGenerator {
|
||||||
int k = concentricringsstructureplacement.spread();
|
HolderSet<Biome> holderset = concentricringsstructureplacement.preferredBiomes();
|
||||||
Random random = new Random();
|
RandomSource randomsource = RandomSource.create();
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ if (this.conf.strongholdSeed != null && this.structureSets.getResourceKey(holder).orElse(null) == net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.STRONGHOLDS) {
|
+ if (this.conf.strongholdSeed != null && this.structureSets.getResourceKey(holder).orElse(null) == net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.STRONGHOLDS) {
|
||||||
+ random.setSeed(this.conf.strongholdSeed);
|
+ randomsource.setSeed(this.conf.strongholdSeed);
|
||||||
+ } else {
|
+ } else {
|
||||||
|
randomsource.setSeed(this instanceof FlatLevelSource ? 0L : randomstate.legacyLevelSeed());
|
||||||
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
random.setSeed(this.ringPlacementSeed);
|
double d0 = randomsource.nextDouble() * 3.141592653589793D * 2.0D;
|
||||||
+ } // Paper
|
|
||||||
double d0 = random.nextDouble() * 3.141592653589793D * 2.0D;
|
|
||||||
int l = 0;
|
int l = 0;
|
||||||
int i1 = 0;
|
int i1 = 0;
|
||||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
@ -31,9 +31,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||||
@@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy {
|
@@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy {
|
||||||
|
|
||||||
public static boolean checkSlimeSpawnRules(EntityType<Slime> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
public static boolean checkSlimeSpawnRules(EntityType<Slime> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
|
||||||
if (world.getDifficulty() != Difficulty.PEACEFUL) {
|
if (world.getDifficulty() != Difficulty.PEACEFUL) {
|
||||||
- if (world.getBiome(pos).is(Biomes.SWAMP) && pos.getY() > 50 && pos.getY() < 70 && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) {
|
- if (world.getBiome(pos).is(BiomeTags.ALLOWS_SURFACE_SLIME_SPAWNS) && pos.getY() > 50 && pos.getY() < 70 && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) {
|
||||||
+ // Paper start - Replace rules for Height in Swamp Biome
|
+ // Paper start - Replace rules for Height in Swamp Biome
|
||||||
+ final double maxHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMaxSpawnHeightInSwamp;
|
+ final double maxHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMaxSpawnHeightInSwamp;
|
||||||
+ final double minHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMinSpawnHeightInSwamp;
|
+ final double minHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMinSpawnHeightInSwamp;
|
@ -4,19 +4,6 @@ Date: Sat, 16 Oct 2021 22:57:31 -0700
|
|||||||
Subject: [PATCH] Add missing block data mins and maxes
|
Subject: [PATCH] Add missing block data mins and maxes
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftLeaves.java b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftLeaves.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftLeaves.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/type/CraftLeaves.java
|
|
||||||
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.block.data.type;
|
|
||||||
import org.bukkit.block.data.type.Leaves;
|
|
||||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
|
||||||
|
|
||||||
-public class CraftLeaves extends CraftBlockData implements Leaves {
|
|
||||||
+public abstract class CraftLeaves extends CraftBlockData implements Leaves { // Paper - make abstract (not used anyways)
|
|
||||||
|
|
||||||
private static final net.minecraft.world.level.block.state.properties.IntegerProperty DISTANCE = getInteger("distance");
|
|
||||||
private static final net.minecraft.world.level.block.state.properties.BooleanProperty PERSISTENT = getBoolean("persistent");
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCandle.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCandle.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCandle.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCandle.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCandle.java
|
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCandle.java
|
||||||
@ -34,22 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
// org.bukkit.craftbukkit.block.data.CraftLightable
|
// org.bukkit.craftbukkit.block.data.CraftLightable
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCauldron.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCauldron.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCauldron.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCauldron.java
|
|
||||||
@@ -0,0 +0,0 @@ public final class CraftCauldron extends org.bukkit.craftbukkit.block.data.Craft
|
|
||||||
public int getMaximumLevel() {
|
|
||||||
return getMax(CraftCauldron.LEVEL);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ // Paper start
|
|
||||||
+ @Override
|
|
||||||
+ public int getMinimumLevel() {
|
|
||||||
+ return getMin(CraftCauldron.LEVEL);
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java
|
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java
|
||||||
@ -103,8 +74,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLeaves.java
|
--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLeaves.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLeaves.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftLeaves.java
|
||||||
@@ -0,0 +0,0 @@ public final class CraftLeaves extends org.bukkit.craftbukkit.block.data.CraftBl
|
@@ -0,0 +0,0 @@ public final class CraftLeaves extends org.bukkit.craftbukkit.block.data.CraftBl
|
||||||
public void setDistance(int distance) {
|
public void setWaterlogged(boolean waterlogged) {
|
||||||
set(CraftLeaves.DISTANCE, distance);
|
set(CraftLeaves.WATERLOGGED, waterlogged);
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start
|
@ -9,17 +9,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
|
||||||
@@ -0,0 +0,0 @@ public class SculkSensorBlockEntity extends BlockEntity implements VibrationList
|
@@ -0,0 +0,0 @@ public class SculkSensorBlockEntity extends BlockEntity implements VibrationList
|
||||||
public void load(CompoundTag nbt) {
|
this.listener = listener;
|
||||||
super.load(nbt);
|
});
|
||||||
this.lastVibrationFrequency = nbt.getInt("last_vibration_frequency");
|
}
|
||||||
+ if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) this.listener.listenerRange = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY); // Paper
|
+ if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) this.listener.listenerRange = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY); // Paper
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ private static final String PAPER_LISTENER_RANGE_NBT_KEY = "Paper.ListenerRange"; // Paper
|
+ private static final String PAPER_LISTENER_RANGE_NBT_KEY = "Paper.ListenerRange"; // Paper
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt) {
|
protected void saveAdditional(CompoundTag nbt) {
|
||||||
super.saveAdditional(nbt);
|
super.saveAdditional(nbt);
|
||||||
nbt.putInt("last_vibration_frequency", this.lastVibrationFrequency);
|
@@ -0,0 +0,0 @@ public class SculkSensorBlockEntity extends BlockEntity implements VibrationList
|
||||||
|
VibrationListener.codec(this).encodeStart(NbtOps.INSTANCE, this.listener).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> {
|
||||||
|
nbt.put("listener", listenerNbt);
|
||||||
|
});
|
||||||
+ if (this.listener.listenerRange != ((SculkSensorBlock) net.minecraft.world.level.block.Blocks.SCULK_SENSOR).getListenerRange()) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.listener.listenerRange); // Paper - only save if it's different from the default
|
+ if (this.listener.listenerRange != ((SculkSensorBlock) net.minecraft.world.level.block.Blocks.SCULK_SENSOR).getListenerRange()) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.listener.listenerRange); // Paper - only save if it's different from the default
|
||||||
}
|
}
|
||||||
|
|
@ -17,16 +17,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerEntity {
|
@@ -0,0 +0,0 @@ public class ServerEntity {
|
||||||
}
|
boolean flag2 = flag1 || this.tickCount % 60 == 0;
|
||||||
// CraftBukkit end
|
boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1;
|
||||||
|
|
||||||
- if (this.tickCount > 0 || this.entity instanceof AbstractArrow) {
|
- if (this.tickCount > 0 || this.entity instanceof AbstractArrow) {
|
||||||
+ if (!(this.entity instanceof net.minecraft.world.entity.decoration.HangingEntity) || this.tickCount > 0 || this.entity instanceof AbstractArrow) { // Paper - Always update position
|
+ if (!(this.entity instanceof net.minecraft.world.entity.decoration.HangingEntity) || this.tickCount > 0 || this.entity instanceof AbstractArrow) { // Paper - Always update position
|
||||||
// Paper start - remove allocation of Vec3D here
|
long k = this.positionCodec.encodeX(vec3d);
|
||||||
long k = ClientboundMoveEntityPacket.entityToPacket(vec3d_dx);
|
long l = this.positionCodec.encodeY(vec3d);
|
||||||
long l = ClientboundMoveEntityPacket.entityToPacket(vec3d_dy);
|
long i1 = this.positionCodec.encodeZ(vec3d);
|
||||||
long i1 = ClientboundMoveEntityPacket.entityToPacket(vec3d_dz);
|
|
||||||
// Paper end - remove allocation of Vec3D here
|
|
||||||
boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L;
|
boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L;
|
||||||
+ if (this.entity instanceof net.minecraft.world.entity.decoration.Painting) {flag4 = true;} // Paper - Always send exact position for paintings
|
+ if (this.entity instanceof net.minecraft.world.entity.decoration.Painting) {flag4 = true;} // Paper - Always send exact position for paintings
|
||||||
|
|
@ -15,15 +15,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class Zombie extends Monster {
|
@@ -0,0 +0,0 @@ public class Zombie extends Monster {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getExperienceReward(Player player) {
|
public int getExperienceReward() {
|
||||||
+ final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward
|
+ final int previousReward = this.xpReward; // Paper - store previous value to reset after calculating XP reward
|
||||||
if (this.isBaby()) {
|
if (this.isBaby()) {
|
||||||
this.xpReward = (int) ((double) this.xpReward * 2.5D);
|
this.xpReward = (int) ((double) this.xpReward * 2.5D);
|
||||||
}
|
}
|
||||||
|
|
||||||
- return super.getExperienceReward(player);
|
- return super.getExperienceReward();
|
||||||
+ // Paper start - only change the XP reward for the calculations in the super method
|
+ // Paper start - only change the XP reward for the calculations in the super method
|
||||||
+ int reward = super.getExperienceReward(player);
|
+ int reward = super.getExperienceReward();
|
||||||
+ this.xpReward = previousReward;
|
+ this.xpReward = previousReward;
|
||||||
+ return reward;
|
+ return reward;
|
||||||
+ // Paper end
|
+ // Paper end
|
30
patches/server/Kick-on-main-for-illegal-chars.patch
Normal file
30
patches/server/Kick-on-main-for-illegal-chars.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nassim Jahnke <nassim@njahnke.dev>
|
||||||
|
Date: Mon, 17 Jan 2022 19:47:19 +0100
|
||||||
|
Subject: [PATCH] Kick on main for illegal chars
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.getMessage())) {
|
||||||
|
+ this.server.scheduleOnMain(() -> { // Paper - push to main for event firing
|
||||||
|
this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause
|
||||||
|
+ }); // Paper - push to main for event firing
|
||||||
|
} else {
|
||||||
|
if (this.tryHandleChat(packet.getMessage(), packet.getTimeStamp())) {
|
||||||
|
// CraftBukkit start
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@Override
|
||||||
|
public void handleChatCommand(ServerboundChatCommandPacket packet) {
|
||||||
|
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
|
||||||
|
+ this.server.scheduleOnMain(() -> { // Paper - push to main for event firing
|
||||||
|
this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
|
||||||
|
+ }); // Paper - push to main for event firing
|
||||||
|
} else {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
if (this.tryHandleChat(packet.command(), packet.timeStamp())) {
|
@ -28,14 +28,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
@@ -0,0 +0,0 @@ import java.util.logging.Logger;
|
||||||
import net.minecraft.Util;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.advancements.AdvancementProgress;
|
import net.minecraft.advancements.AdvancementProgress;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
+import net.minecraft.core.SectionPos; // Paper
|
+import net.minecraft.core.SectionPos; // Paper
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.chat.ChatType;
|
import net.minecraft.network.chat.ChatSender;
|
||||||
@@ -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.send(packet);
|
this.getHandle().connection.send(packet);
|
||||||
}
|
}
|
@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||||
globalMaxConcurrentChunkLoads = getDouble("settings.chunk-loading.global-max-concurrent-loads", 500.0);
|
private static void timeCommandAffectsAllWorlds() {
|
||||||
playerMaxChunkLoadRate = getDouble("settings.chunk-loading.player-max-chunk-load-rate", -1.0);
|
timeCommandAffectsAllWorlds = getBoolean("settings.time-command-affects-all-worlds", timeCommandAffectsAllWorlds);
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ public static boolean useDimensionTypeForCustomSpawners;
|
+ public static boolean useDimensionTypeForCustomSpawners;
|
||||||
@ -31,15 +31,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.commandStorage = new CommandStorage(worldpersistentdata);
|
this.commandStorage = new CommandStorage(worldpersistentdata);
|
||||||
} else {
|
} else {
|
||||||
ChunkProgressListener worldloadlistener = this.progressListenerFactory.create(11);
|
ChunkProgressListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||||
- world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, holder, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
- world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||||
+ // Paper start - option to use the dimension_type to check if spawners should be added. I imagine mojang will add some datapack-y way of managing this in the future.
|
+ // Paper start - option to use the dimension_type to check if spawners should be added. I imagine mojang will add some datapack-y way of managing this in the future.
|
||||||
+ final List<CustomSpawner> spawners;
|
+ final List<CustomSpawner> spawners;
|
||||||
+ if (com.destroystokyo.paper.PaperConfig.useDimensionTypeForCustomSpawners && this.registryHolder.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(holder.value()).orElseThrow() == DimensionType.OVERWORLD_LOCATION) {
|
+ if (com.destroystokyo.paper.PaperConfig.useDimensionTypeForCustomSpawners && this.registryHolder.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(worlddimension.typeHolder().value()).orElseThrow() == net.minecraft.world.level.dimension.BuiltinDimensionTypes.OVERWORLD) {
|
||||||
+ spawners = list;
|
+ spawners = list;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ spawners = Collections.emptyList();
|
+ spawners = Collections.emptyList();
|
||||||
+ }
|
+ }
|
||||||
+ world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, holder, worldloadlistener, chunkgenerator, flag, j, spawners, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
+ world = new ServerLevel(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, spawners, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
@ -33,8 +33,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker();
|
- private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker();
|
||||||
+ //private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker(); // Paper - replace ticket level propagator
|
+ //private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker(); // Paper - replace ticket level propagator
|
||||||
public static final int MOB_SPAWN_RANGE = 8; // private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); // Paper - no longer used
|
public static final int MOB_SPAWN_RANGE = 8; // private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); // Paper - no longer used
|
||||||
//private final TickingTracker tickingTicketsTracker = new TickingTracker(); // Paper - no longer used
|
private final TickingTracker tickingTicketsTracker = new TickingTracker();
|
||||||
//private final DistanceManager.PlayerTicketTracker playerTicketManager = new DistanceManager.PlayerTicketTracker(33); // Paper - no longer used
|
private final DistanceManager.PlayerTicketTracker playerTicketManager = new DistanceManager.PlayerTicketTracker(33);
|
||||||
@@ -0,0 +0,0 @@ public abstract class DistanceManager {
|
@@ -0,0 +0,0 @@ public abstract class DistanceManager {
|
||||||
this.chunkMap = chunkMap; // Paper
|
this.chunkMap = chunkMap; // Paper
|
||||||
}
|
}
|
||||||
@ -98,9 +98,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ protected long ticketLevelUpdateCount; // Paper - replace ticket level propagator
|
+ protected long ticketLevelUpdateCount; // Paper - replace ticket level propagator
|
||||||
public boolean runAllUpdates(ChunkMap chunkStorage) {
|
public boolean runAllUpdates(ChunkMap chunkStorage) {
|
||||||
//this.f.a(); // Paper - no longer used
|
//this.f.a(); // Paper - no longer used
|
||||||
//this.tickingTicketsTracker.runAllUpdates(); // Paper - no longer used
|
this.tickingTicketsTracker.runAllUpdates();
|
||||||
org.spigotmc.AsyncCatcher.catchOp("DistanceManagerTick"); // Paper
|
org.spigotmc.AsyncCatcher.catchOp("DistanceManagerTick"); // Paper
|
||||||
//this.playerTicketManager.runAllUpdates(); // Paper - no longer used
|
this.playerTicketManager.runAllUpdates();
|
||||||
- int i = Integer.MAX_VALUE - this.ticketTracker.runDistanceUpdates(Integer.MAX_VALUE);
|
- int i = Integer.MAX_VALUE - this.ticketTracker.runDistanceUpdates(Integer.MAX_VALUE);
|
||||||
- boolean flag = i != 0;
|
- boolean flag = i != 0;
|
||||||
+ boolean flag = this.ticketLevelPropagator.propagateUpdates(); // Paper - replace ticket level propagator
|
+ boolean flag = this.ticketLevelPropagator.propagateUpdates(); // Paper - replace ticket level propagator
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||||
@@ -0,0 +0,0 @@ public class BlockItem extends Item {
|
@@ -0,0 +0,0 @@ public class BlockItem extends Item {
|
||||||
if (this instanceof WaterLilyBlockItem || this instanceof SolidBucketItem) {
|
if (this instanceof PlaceOnWaterBlockItem || this instanceof SolidBucketItem) {
|
||||||
blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos());
|
blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos());
|
||||||
}
|
}
|
||||||
+ final org.bukkit.block.BlockState oldBlockstate = blockstate != null ? blockstate : org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); // Paper
|
+ final org.bukkit.block.BlockState oldBlockstate = blockstate != null ? blockstate : org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); // Paper
|
@ -1,40 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kieran Wallbanks <kieran.wallbanks@gmail.com>
|
|
||||||
Date: Mon, 21 Jun 2021 14:23:50 +0100
|
|
||||||
Subject: [PATCH] Fix NotePlayEvent
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
|
||||||
@@ -0,0 +0,0 @@ public class NoteBlock extends Block {
|
|
||||||
private void playNote(Level world, BlockPos blockposition, BlockState data) { // CraftBukkit
|
|
||||||
if (world.getBlockState(blockposition.above()).isAir()) {
|
|
||||||
// CraftBukkit start
|
|
||||||
- org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.getValue(NoteBlock.INSTRUMENT), data.getValue(NoteBlock.NOTE));
|
|
||||||
- if (!event.isCancelled()) {
|
|
||||||
+ // Paper start - move NotePlayEvent call to fix instrument/note changes
|
|
||||||
world.blockEvent(blockposition, this, 0, 0);
|
|
||||||
- }
|
|
||||||
+ // Paper end
|
|
||||||
// CraftBukkit end
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class NoteBlock extends Block {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) {
|
|
||||||
- int k = (Integer) state.getValue(NoteBlock.NOTE);
|
|
||||||
+ // Paper start - move NotePlayEvent call to fix instrument/note changes
|
|
||||||
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, pos, state.getValue(INSTRUMENT), state.getValue(NOTE));
|
|
||||||
+ if (event.isCancelled()) return false;
|
|
||||||
+ int k = event.getNote().getId();
|
|
||||||
float f = (float) Math.pow(2.0D, (double) (k - 12) / 12.0D);
|
|
||||||
|
|
||||||
- world.playSound((Player) null, pos, ((NoteBlockInstrument) state.getValue(NoteBlock.INSTRUMENT)).getSoundEvent(), SoundSource.RECORDS, 3.0F, f);
|
|
||||||
+ world.playSound(null, pos, org.bukkit.craftbukkit.block.data.CraftBlockData.toNMS(event.getInstrument(), NoteBlockInstrument.class).getSoundEvent(), SoundSource.RECORDS, 3.0F, f);
|
|
||||||
+ // Paper end
|
|
||||||
world.addParticle(ParticleTypes.NOTE, (double) pos.getX() + 0.5D, (double) pos.getY() + 1.2D, (double) pos.getZ() + 0.5D, (double) k / 24.0D, 0.0D, 0.0D);
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
||||||
Date: Tue, 1 Mar 2022 14:12:17 -0800
|
|
||||||
Subject: [PATCH] Fix World#locateNearestStructure
|
|
||||||
|
|
||||||
1.18.2 switched to TagKeys to reference tags of objects, and this method
|
|
||||||
impl needs to be changed to reflect that
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
||||||
this.resources.managers.updateRegistryTags(this.registryAccess());
|
|
||||||
io.papermc.paper.registry.PaperRegistry.clearCaches(); // Paper
|
|
||||||
net.minecraft.world.item.alchemy.PotionBrewing.reload(); // Paper
|
|
||||||
+ // Paper start - clear cache cause datapacks can add more configured structures
|
|
||||||
+ for (ServerLevel level : this.levels.values()) {
|
|
||||||
+ level.getWorld().structureCache.clear();
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper
|
|
||||||
if (Thread.currentThread() != this.serverThread) return; // Paper
|
|
||||||
//this.getPlayerList().saveAll(); // Paper - we don't need to do this
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
||||||
if (optional.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
- Pair<BlockPos, Holder<ConfiguredStructureFeature<?, ?>>> pair = this.getChunkSource().getGenerator().findNearestMapFeature(this, (HolderSet) optional.get(), pos, radius, skipExistingChunks);
|
|
||||||
+ // Paper start
|
|
||||||
+ return this.findNearestMapFeature(optional.get(), pos, radius, skipExistingChunks);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ public @Nullable BlockPos findNearestMapFeature(HolderSet<ConfiguredStructureFeature<?, ?>> holderSet, BlockPos pos, int radius, boolean skipExistingChunks) {
|
|
||||||
+ {
|
|
||||||
+ {
|
|
||||||
+ Pair<BlockPos, Holder<ConfiguredStructureFeature<?, ?>>> pair = this.getChunkSource().getGenerator().findNearestMapFeature(this, holderSet, pos, radius, skipExistingChunks);
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
return pair != null ? (BlockPos) pair.getFirst() : null;
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
||||||
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public final Map<StructureType, List<Holder.Reference<net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature<?, ?>>>> structureCache = new java.util.HashMap<>(); // Paper
|
|
||||||
@Override
|
|
||||||
public Location locateNearestStructure(Location origin, StructureType structureType, int radius, boolean findUnexplored) {
|
|
||||||
BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ());
|
|
||||||
- BlockPos nearest = this.getHandle().findNearestMapFeature(TagKey.create(Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY, CraftNamespacedKey.toMinecraft(structureType.getKey())), originPos, radius, findUnexplored);
|
|
||||||
+ // Paper start - fix because you can't just create random TagKeys
|
|
||||||
+ if (!this.getHandle().serverLevelData.worldGenSettings().generateFeatures()) { // from ServerLevel#findNearestMapFeature
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ final List<Holder.Reference<net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature<?, ?>>> features = this.structureCache.computeIfAbsent(structureType, (type) -> {
|
|
||||||
+ final Registry<net.minecraft.world.level.levelgen.feature.StructureFeature<?>> structureFeatureRegistry = this.getHandle().registryAccess().registryOrThrow(Registry.STRUCTURE_FEATURE_REGISTRY);
|
|
||||||
+ return this.getHandle().registryAccess().registryOrThrow(Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY).holders().filter(holder -> {
|
|
||||||
+ return structureType.getKey().equals(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(Objects.requireNonNull(structureFeatureRegistry.getKey(holder.value().feature))));
|
|
||||||
+ }).toList();
|
|
||||||
+ });
|
|
||||||
+ BlockPos nearest = this.getHandle().findNearestMapFeature(net.minecraft.core.HolderSet.direct(features), originPos, radius, findUnexplored);
|
|
||||||
+ // Paper end
|
|
||||||
return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Nassim Jahnke <nassim@njahnke.dev>
|
|
||||||
Date: Mon, 17 Jan 2022 19:47:19 +0100
|
|
||||||
Subject: [PATCH] Kick on main for illegal chars
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
||||||
|
|
||||||
for (int i = 0; i < s.length(); ++i) {
|
|
||||||
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
|
||||||
+ this.server.scheduleOnMain(() -> { // Paper - push to main for event firing
|
|
||||||
this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause
|
|
||||||
+ }); // Paper - push to main for event firing
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user