More more more more more more more more more patches

This commit is contained in:
Nassim Jahnke 2022-06-08 14:33:46 +02:00
parent 391e65f1af
commit 301cf577c2
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
36 changed files with 168 additions and 168 deletions

View File

@ -8,14 +8,14 @@ Chunks not marked as lit will always go through the light engine,
so they should always have their block sources parsed.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 54ade15cdab222e9818f2635a8a12418e78e1ce6..887b3bc6370d23d2ff38e8fdbe286d678b035cc7 100644
index 3c220d833ca6bb9409bc71d6f61e61783dba236b..727e652cc233e983d6e7ce0e5a1937afa7355a5d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -312,16 +312,33 @@ public class ChunkSerializer {
@@ -318,16 +318,33 @@ public class ChunkSerializer {
BelowZeroRetrogen belowzeroretrogen = protochunk.getBelowZeroRetrogen();
boolean flag2 = chunkstatus.isOrAfter(ChunkStatus.LIGHT) || belowzeroretrogen != null && belowzeroretrogen.targetStatus().isOrAfter(ChunkStatus.LIGHT);
boolean flag5 = chunkstatus.isOrAfter(ChunkStatus.LIGHT) || belowzeroretrogen != null && belowzeroretrogen.targetStatus().isOrAfter(ChunkStatus.LIGHT);
- if (!flag && flag2) {
- if (!flag && flag5) {
- Iterator iterator = BlockPos.betweenClosed(chunkPos.getMinBlockX(), world.getMinBuildHeight(), chunkPos.getMinBlockZ(), chunkPos.getMaxBlockX(), world.getMaxBuildHeight() - 1, chunkPos.getMaxBlockZ()).iterator();
+ if (!flag) { // Paper - fix incorrect parsing of blocks that emit light - it should always parse it, unless the chunk is marked as lit
+ // Paper start - let's make sure the implementation isn't as slow as possible
@ -41,7 +41,7 @@ index 54ade15cdab222e9818f2635a8a12418e78e1ce6..887b3bc6370d23d2ff38e8fdbe286d67
+ continue;
+ }
- if (((ChunkAccess) object).getBlockState(blockposition).getLightEmission() != 0) {
- if (((ChunkAccess) object1).getBlockState(blockposition).getLightEmission() != 0) {
- protochunk.addLight(blockposition);
+ // index = x | (z << 4) | (y << 8)
+ protochunk.addLight(new BlockPos(offX | (index & 15), offY | (index >>> 8), offZ | ((index >>> 4) & 15)));

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent sending oversized item data in equipment and metadata
diff --git a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java
index 3eb6bf4258b1de4697f96c2011df493cf7414a0c..bbf4e6b0ca0fe046469c675fc9e0929b64006548 100644
index 0c79613597e9ed1fbeeb36e9cb60a70bbda17bb9..79593d42ef881aa96eab7ea1e50683fa48ff4896 100644
--- a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java
+++ b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java
@@ -127,7 +127,7 @@ public class EntityDataSerializers {
@@ -38,7 +38,7 @@ public class EntityDataSerializers {
public static final EntityDataSerializer<ItemStack> ITEM_STACK = new EntityDataSerializer<ItemStack>() {
@Override
public void write(FriendlyByteBuf buf, ItemStack value) {
@ -18,10 +18,10 @@ index 3eb6bf4258b1de4697f96c2011df493cf7414a0c..bbf4e6b0ca0fe046469c675fc9e0929b
@Override
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 9760ff4b6ca0e555f01151968cbfe0cdb8960e35..7464336f0c7ee59e59552afbad7bed0afcecef87 100644
index 2abfc5c801cd58223986d6c5012fc381e66f0d9a..5d30612fbb5e9edc7301b3bae31c1764fc6630c6 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -319,7 +319,10 @@ public class ServerEntity {
@@ -303,7 +303,10 @@ public class ServerEntity {
ItemStack itemstack = ((LivingEntity) this.entity).getItemBySlot(enumitemslot);
if (!itemstack.isEmpty()) {
@ -34,10 +34,10 @@ index 9760ff4b6ca0e555f01151968cbfe0cdb8960e35..7464336f0c7ee59e59552afbad7bed0a
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 18dfc235f17510ae9eda3ffd7c04b7aa8c4aac89..1f8ba8dbb69bf9be998ed99095ecdeacba5ab03d 100644
index abae967b466ed64c2c995130589320c8a58128d2..522d4ca03bf539dcb38ddf8cf97a1627a7698bc3 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3077,7 +3077,10 @@ public abstract class LivingEntity extends Entity {
@@ -3109,7 +3109,10 @@ public abstract class LivingEntity extends Entity {
equipmentChanges.forEach((enumitemslot, itemstack) -> {
ItemStack itemstack1 = itemstack.copy();
@ -49,7 +49,7 @@ index 18dfc235f17510ae9eda3ffd7c04b7aa8c4aac89..1f8ba8dbb69bf9be998ed99095ecdeac
switch (enumitemslot.getType()) {
case HAND:
this.setLastHandItem(enumitemslot, itemstack1);
@@ -3090,6 +3093,34 @@ public abstract class LivingEntity extends Entity {
@@ -3122,6 +3125,34 @@ public abstract class LivingEntity extends Entity {
((ServerLevel) this.level).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
}

View File

@ -23,10 +23,10 @@ index 409cffcf74b32beba09b2fe800d1329ee64426f8..99008ac6943c56f74f912e739709a472
log(" " + type + ":");
com.google.common.collect.Table<String, String, Integer> table = com.google.common.collect.HashBasedTable.create();
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 7464336f0c7ee59e59552afbad7bed0afcecef87..fe29bf349b987d633b185b9d44d221053fa2cc83 100644
index 5d30612fbb5e9edc7301b3bae31c1764fc6630c6..a482cc1c4d7eab531cd3f5cf42f7d3a43470ef6b 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -321,7 +321,7 @@ public class ServerEntity {
@@ -305,7 +305,7 @@ public class ServerEntity {
if (!itemstack.isEmpty()) {
// Paper start - prevent oversized data
final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false);
@ -36,10 +36,10 @@ index 7464336f0c7ee59e59552afbad7bed0afcecef87..fe29bf349b987d633b185b9d44d22105
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 1f8ba8dbb69bf9be998ed99095ecdeacba5ab03d..5ef73cf97df2949d308d4cc9213bfb173c15b4a5 100644
index 522d4ca03bf539dcb38ddf8cf97a1627a7698bc3..7bd5c41c08d198c4278486a245872d2f31162627 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3079,7 +3079,7 @@ public abstract class LivingEntity extends Entity {
@@ -3111,7 +3111,7 @@ public abstract class LivingEntity extends Entity {
// Paper start - prevent oversized data
ItemStack toSend = sanitizeItemStack(itemstack1, true);
@ -48,7 +48,7 @@ index 1f8ba8dbb69bf9be998ed99095ecdeacba5ab03d..5ef73cf97df2949d308d4cc9213bfb17
// Paper end
switch (enumitemslot.getType()) {
case HAND:
@@ -3093,6 +3093,59 @@ public abstract class LivingEntity extends Entity {
@@ -3125,6 +3125,59 @@ public abstract class LivingEntity extends Entity {
((ServerLevel) this.level).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent ContainerOpenersCounter openCount from going negative
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java b/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
index 5dceda79d13412a73002af39511c9268c47788ea..55c5dfc51196ff04abeb8b0eb82a399dd8a90e1c 100644
index 76bdce9c1555c57f8cde6d4701ee1846ea3b67d8..bb34a517a32185c53f7d769a3b3661e6d5d49f09 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
@@ -50,6 +50,7 @@ public abstract class ContainerOpenersCounter {

View File

@ -5,18 +5,18 @@ Subject: [PATCH] Add PlayerItemFrameChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index d02f507ac58bae5d4f669dae52cc01c35651cee5..a6d94e99d18cd569545981014af733ba8fdb4d31 100644
index ac0fe310b01506b3b2a767d47f65cefb57f58c7d..d2a77b4ca343d19e1c70afe3f3906a9bd53d0eec 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -2,6 +2,7 @@ package net.minecraft.world.entity.decoration;
@@ -3,6 +3,7 @@ package net.minecraft.world.entity.decoration;
import com.mojang.logging.LogUtils;
import java.util.OptionalInt;
import javax.annotation.Nullable;
+import io.papermc.paper.event.player.PlayerItemFrameChangeEvent; // Paper
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
@@ -185,6 +186,13 @@ public class ItemFrame extends HangingEntity {
@@ -187,6 +188,13 @@ public class ItemFrame extends HangingEntity {
return true;
}
// CraftBukkit end
@ -30,7 +30,7 @@ index d02f507ac58bae5d4f669dae52cc01c35651cee5..a6d94e99d18cd569545981014af733ba
this.dropItem(source.getEntity(), false);
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
}
@@ -427,13 +435,22 @@ public class ItemFrame extends HangingEntity {
@@ -451,13 +459,22 @@ public class ItemFrame extends HangingEntity {
return InteractionResult.FAIL;
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add player health update API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 818e9f36f5e19bd160cf7ee0805f6337a418bce5..0978be96a4ef26dc0a2e3cc1bb10931496502413 100644
index 4b3dd5ac0a238966dce53dc7523ec2a2f753a6e7..1ad8ab6c9413e79385b2f796c960ea3184d72bdf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2136,9 +2136,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2133,9 +2133,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().maxHealthCache = getMaxHealth();
}
@ -22,7 +22,7 @@ index 818e9f36f5e19bd160cf7ee0805f6337a418bce5..0978be96a4ef26dc0a2e3cc1bb109314
if (this.getHandle().queueHealthUpdatePacket) {
this.getHandle().queuedHealthUpdatePacket = packet;
} else {
@@ -2146,7 +2148,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2143,7 +2145,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 83bbe0e65760a7f380e19da5a3938b1a30e5d679..8769e15a395b1c6e72f3e4a7f96b8c90c34e7569 100644
index a97565735bf6005b77859e8453171cd8eaefab81..5bfd4457f551e5e71e0f74a0d52568e165404e22 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2317,6 +2317,90 @@ public final class CraftServer implements Server {
@@ -2299,6 +2299,90 @@ public final class CraftServer implements Server {
return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), world); // Paper - Anti-Xray - Add parameters
}

View File

@ -1180,10 +1180,10 @@ index 0000000000000000000000000000000000000000..d67a40e7be030142443680c89e1763fc
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6b9622c41966843411184493f42b3d4005be533e..3c13862e7ec96e7ee57c942bb2a7084f4553ae20 100644
index 0a4934cabf5d04b0561d33f5e777f38b2e721608..1f8282ab903293a4221bce48b5d4d5f4284fe781 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -414,7 +414,7 @@ public class ServerPlayer extends Player {
@@ -421,7 +421,7 @@ public class ServerPlayer extends Player {
if (blockposition1 != null) {
this.moveTo(blockposition1, 0.0F, 0.0F);
@ -1192,7 +1192,7 @@ index 6b9622c41966843411184493f42b3d4005be533e..3c13862e7ec96e7ee57c942bb2a7084f
break;
}
}
@@ -422,7 +422,7 @@ public class ServerPlayer extends Player {
@@ -429,7 +429,7 @@ public class ServerPlayer extends Player {
} else {
this.moveTo(blockposition, 0.0F, 0.0F);
@ -1202,7 +1202,7 @@ index 6b9622c41966843411184493f42b3d4005be533e..3c13862e7ec96e7ee57c942bb2a7084f
}
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 2aa31d8ad15100b3a25dd7da41bf17b126ba937e..bb4e844c77c76eb893c55844c5a814ccd337b7f4 100644
index 082a16f49c07faadce68fc118b2fff859da422d0..ac9ee7f574f9b6c5e9c9368e54928e47ca62fb24 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -936,7 +936,7 @@ public abstract class PlayerList {
@ -1215,10 +1215,10 @@ index 2aa31d8ad15100b3a25dd7da41bf17b126ba937e..bb4e844c77c76eb893c55844c5a814cc
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 53588a621fb922112da7c585a09ba331fa03e858..396ee5a8aa57e7c2e9a14606d37cae3c02dc4283 100644
index 757abf11362fa9e402dd6dd44c3bfc0ad74c5021..2661a635b99fa55b79802bb1e71797362f6dfa7c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1095,9 +1095,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1119,9 +1119,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
float f2 = this.getBlockSpeedFactor();
this.setDeltaMovement(this.getDeltaMovement().multiply((double) f2, 1.0D, (double) f2));
@ -1266,7 +1266,7 @@ index 53588a621fb922112da7c585a09ba331fa03e858..396ee5a8aa57e7c2e9a14606d37cae3c
if (this.remainingFireTicks <= 0) {
this.setRemainingFireTicks(-this.getFireImmuneTicks());
}
@@ -1231,32 +1266,78 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1265,32 +1300,78 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
private Vec3 collide(Vec3 movement) {
@ -1366,7 +1366,7 @@ index 53588a621fb922112da7c585a09ba331fa03e858..396ee5a8aa57e7c2e9a14606d37cae3c
}
public static Vec3 collideBoundingBox(@Nullable Entity entity, Vec3 movement, AABB entityBoundingBox, Level world, List<VoxelShape> collisions) {
@@ -2354,11 +2435,30 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2402,11 +2483,30 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
float f = this.dimensions.width * 0.8F;
AABB axisalignedbb = AABB.ofSize(this.getEyePosition(), (double) f, 1.0E-6D, (double) f);
@ -1493,10 +1493,10 @@ index c0817ef8927f00e2fd3fbf3289f8041fcb494049..3f458ddd4dc04ed28510a212be76bb19
return List.of();
} else {
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index d545b05cfbb14e5a15b26efe372509e498605016..61590f2f04a797235299f1bd6b78a08f5bfe4a33 100644
index b8541b54886fc1f48b4c99cf449284ffece1a78a..771c6cf992664b65ffbf4ae0192bc7b09f77c2e6 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -719,6 +719,13 @@ public abstract class BlockBehaviour {
@@ -733,6 +733,13 @@ public abstract class BlockBehaviour {
return this.conditionallyFullOpaque;
}
// Paper end
@ -1510,7 +1510,7 @@ index d545b05cfbb14e5a15b26efe372509e498605016..61590f2f04a797235299f1bd6b78a08f
public void initCache() {
this.fluid = this.getBlock().getFluidState(this.asState()); // Paper - moved from getFluid()
@@ -728,7 +735,35 @@ public abstract class BlockBehaviour {
@@ -742,7 +749,35 @@ public abstract class BlockBehaviour {
}
this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here
this.opacityIfCached = this.cache == null || this.isConditionallyFullOpaque() ? -1 : this.cache.lightBlock; // Paper - cache opacity for light
@ -1548,10 +1548,10 @@ index d545b05cfbb14e5a15b26efe372509e498605016..61590f2f04a797235299f1bd6b78a08f
public Block getBlock() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index 6afad987f6dd1fd7243dfa6c50549c2a88768962..b11ad90c0956ac1b8ee069fa3f4553a2b4ce88e9 100644
index c2e3df8331cec5fe5650501a4dc4ac47f23ef11b..5afb598d288d32877834cfb7d9796b334767286d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -44,6 +44,110 @@ public class LevelChunkSection {
@@ -46,6 +46,110 @@ public class LevelChunkSection {
this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper - Anti-Xray - Add preset biomes
}
@ -1662,7 +1662,7 @@ index 6afad987f6dd1fd7243dfa6c50549c2a88768962..b11ad90c0956ac1b8ee069fa3f4553a2
public static int getBottomBlockY(int chunkPos) {
return chunkPos << 4;
}
@@ -68,8 +172,8 @@ public class LevelChunkSection {
@@ -70,8 +174,8 @@ public class LevelChunkSection {
return this.setBlockState(x, y, z, state, true);
}
@ -1673,7 +1673,7 @@ index 6afad987f6dd1fd7243dfa6c50549c2a88768962..b11ad90c0956ac1b8ee069fa3f4553a2
if (lock) {
iblockdata1 = (BlockState) this.states.getAndSet(x, y, z, state);
@@ -108,6 +212,7 @@ public class LevelChunkSection {
@@ -110,6 +214,7 @@ public class LevelChunkSection {
++this.tickingFluidCount;
}
@ -1681,7 +1681,7 @@ index 6afad987f6dd1fd7243dfa6c50549c2a88768962..b11ad90c0956ac1b8ee069fa3f4553a2
return iblockdata1;
}
@@ -157,6 +262,7 @@ public class LevelChunkSection {
@@ -159,6 +264,7 @@ public class LevelChunkSection {
});
// Paper end

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Optimise collision checking in player move packet handling
Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6d1e3104750b23e9d4b0ddea35e1241f8434a1ac..1a15711e657c93965c2839dc130b7c53d86482b0 100644
index 9c7d1ce759e119b21e942add5e42ad203226d72b..8b033cdd65402950e597efab7b2407f5baf4c3aa 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -587,7 +587,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -613,7 +613,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
return;
}
@ -18,7 +18,7 @@ index 6d1e3104750b23e9d4b0ddea35e1241f8434a1ac..1a15711e657c93965c2839dc130b7c53
d6 = d3 - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above
d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; // Paper - diff on change, used for checking large move vectors above
@@ -595,6 +595,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -621,6 +621,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
boolean flag1 = entity.verticalCollisionBelow;
entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
@ -26,7 +26,7 @@ index 6d1e3104750b23e9d4b0ddea35e1241f8434a1ac..1a15711e657c93965c2839dc130b7c53
double d11 = d7;
d6 = d3 - entity.getX();
@@ -608,16 +609,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -634,16 +635,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
boolean flag2 = false;
if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
@ -54,7 +54,7 @@ index 6d1e3104750b23e9d4b0ddea35e1241f8434a1ac..1a15711e657c93965c2839dc130b7c53
entity.absMoveTo(d0, d1, d2, f, f1);
this.player.absMoveTo(d0, d1, d2, this.player.getYRot(), this.player.getXRot()); // CraftBukkit
this.connection.send(new ClientboundMoveVehiclePacket(entity));
@@ -703,7 +712,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -729,7 +738,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
private boolean noBlocksAround(Entity entity) {
@ -88,7 +88,7 @@ index 6d1e3104750b23e9d4b0ddea35e1241f8434a1ac..1a15711e657c93965c2839dc130b7c53
}
@Override
@@ -1252,7 +1286,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1281,7 +1315,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
if (this.awaitingPositionFromClient != null) {
@ -97,7 +97,7 @@ index 6d1e3104750b23e9d4b0ddea35e1241f8434a1ac..1a15711e657c93965c2839dc130b7c53
this.awaitingTeleportTime = this.tickCount;
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
}
@@ -1346,7 +1380,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1375,7 +1409,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
}
@ -106,7 +106,7 @@ index 6d1e3104750b23e9d4b0ddea35e1241f8434a1ac..1a15711e657c93965c2839dc130b7c53
d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above
d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above
@@ -1387,6 +1421,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1416,6 +1450,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
boolean flag1 = this.player.verticalCollisionBelow;
this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9));
@ -114,7 +114,7 @@ index 6d1e3104750b23e9d4b0ddea35e1241f8434a1ac..1a15711e657c93965c2839dc130b7c53
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move
// Paper start - prevent position desync
if (this.awaitingPositionFromClient != null) {
@@ -1406,12 +1441,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1435,12 +1470,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
boolean flag2 = false;
if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
@ -140,7 +140,7 @@ index 6d1e3104750b23e9d4b0ddea35e1241f8434a1ac..1a15711e657c93965c2839dc130b7c53
this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet(), false); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
} else {
// CraftBukkit start - fire PlayerMoveEvent
@@ -1497,6 +1543,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1526,6 +1572,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
}

View File

@ -10,10 +10,10 @@ This patch also prevents the saving/unloading of POI data when
world saving is disabled.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 727ee42ec573fd1d008f526f49d0e63396ef0a9d..0e6bc8f7b31581fe0e7adb13119b30295aeac48d 100644
index 6bae8378c14aa1ae35cf31f284bda2fcc61f1322..1794893cab3f26faa58745a95cb50d239f8a1484 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -848,6 +848,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -864,6 +864,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
// Paper end
}
@ -21,7 +21,7 @@ index 727ee42ec573fd1d008f526f49d0e63396ef0a9d..0e6bc8f7b31581fe0e7adb13119b3029
this.updatingChunks.queueUpdate(pos, holder); // Paper - Don't copy
this.modified = true;
@@ -999,7 +1000,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1015,7 +1016,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private void processUnloads(BooleanSupplier shouldKeepTicking) {
LongIterator longiterator = this.toDrop.iterator();
@ -30,7 +30,7 @@ index 727ee42ec573fd1d008f526f49d0e63396ef0a9d..0e6bc8f7b31581fe0e7adb13119b3029
long j = longiterator.nextLong();
ChunkHolder playerchunk = this.updatingChunks.queueRemove(j); // Paper - Don't copy
@@ -1047,6 +1048,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1063,6 +1064,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z);
}
// Paper end
@ -38,7 +38,7 @@ index 727ee42ec573fd1d008f526f49d0e63396ef0a9d..0e6bc8f7b31581fe0e7adb13119b3029
if (ichunkaccess instanceof LevelChunk) {
((LevelChunk) ichunkaccess).setLoaded(false);
}
@@ -1076,6 +1078,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1092,6 +1094,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
for (int index = 0, len = this.regionManagers.size(); index < len; ++index) {
this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z);
}
@ -46,16 +46,16 @@ index 727ee42ec573fd1d008f526f49d0e63396ef0a9d..0e6bc8f7b31581fe0e7adb13119b3029
} // Paper end
} finally { this.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes while unloading chunks
@@ -1152,6 +1155,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1167,6 +1170,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
this.poiManager.loadInData(pos, chunkHolder.poiData);
chunkHolder.tasks.forEach(Runnable::run);
+ this.getPoiManager().dequeueUnload(pos.longKey); // Paper
// Paper end
if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.level.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async
if (chunkHolder.protoChunk != null) {
ProtoChunk protochunk = chunkHolder.protoChunk;
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
index 8a569e3300543cb171c3befae59969628adc424c..54013682ee07cfe34f47070b6460c21ff420130f 100644
index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..400732788820a94acebccb1ad64789e0f6defdb1 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
@@ -1,5 +1,6 @@
@ -65,7 +65,7 @@ index 8a569e3300543cb171c3befae59969628adc424c..54013682ee07cfe34f47070b6460c21f
import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair;
import it.unimi.dsi.fastutil.longs.Long2ByteMap;
@@ -35,16 +36,145 @@ import net.minecraft.world.level.chunk.storage.SectionStorage;
@@ -38,16 +39,145 @@ import net.minecraft.world.level.chunk.storage.SectionStorage;
public class PoiManager extends SectionStorage<PoiSection> {
public static final int MAX_VILLAGE_DISTANCE = 6;
public static final int VILLAGE_SECTION_SIZE = 1;
@ -87,10 +87,10 @@ index 8a569e3300543cb171c3befae59969628adc424c..54013682ee07cfe34f47070b6460c21f
+ }
+ // Paper end - unload poi data
private final LongSet loadedChunks = new LongOpenHashSet();
public final net.minecraft.server.level.ServerLevel world; // Paper // Paper public
private final net.minecraft.server.level.ServerLevel world; // Paper
public PoiManager(Path path, DataFixer dataFixer, boolean dsync, LevelHeightAccessor world) {
super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, world);
public PoiManager(Path path, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world) {
super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, registryManager, world);
+ if (world == null) { throw new IllegalStateException("world must be non-null"); } // Paper - require non-null
this.world = (net.minecraft.server.level.ServerLevel)world; // Paper
- this.distanceTracker = new PoiManager.DistanceTracker();
@ -210,10 +210,10 @@ index 8a569e3300543cb171c3befae59969628adc424c..54013682ee07cfe34f47070b6460c21f
+ }
+ // Paper end - actually unload POI data
+
public void add(BlockPos pos, PoiType type) {
public void add(BlockPos pos, Holder<PoiType> type) {
this.getOrCreate(SectionPos.asLong(pos)).add(pos, type);
}
@@ -181,8 +311,8 @@ public class PoiManager extends SectionStorage<PoiSection> {
@@ -182,8 +312,8 @@ public class PoiManager extends SectionStorage<PoiSection> {
}
public int sectionsToVillage(SectionPos pos) {
@ -224,7 +224,7 @@ index 8a569e3300543cb171c3befae59969628adc424c..54013682ee07cfe34f47070b6460c21f
}
boolean isVillageCenter(long pos) {
@@ -195,7 +325,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
@@ -198,7 +328,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
@Override
public void tick(BooleanSupplier shouldKeepTicking) {
// Paper start - async chunk io
@ -233,7 +233,7 @@ index 8a569e3300543cb171c3befae59969628adc424c..54013682ee07cfe34f47070b6460c21f
ChunkPos chunkcoordintpair = SectionPos.of(this.dirty.firstLong()).chunk();
net.minecraft.nbt.CompoundTag data;
@@ -205,19 +335,24 @@ public class PoiManager extends SectionStorage<PoiSection> {
@@ -208,19 +338,24 @@ public class PoiManager extends SectionStorage<PoiSection> {
com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world,
chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY);
}
@ -261,7 +261,7 @@ index 8a569e3300543cb171c3befae59969628adc424c..54013682ee07cfe34f47070b6460c21f
}
public void checkConsistencyWithBlocks(ChunkPos chunkPos, LevelChunkSection chunkSection) {
@@ -275,7 +410,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
@@ -278,7 +413,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
@Override
protected int getLevelFromSource(long id) {
@ -271,10 +271,10 @@ index 8a569e3300543cb171c3befae59969628adc424c..54013682ee07cfe34f47070b6460c21f
@Override
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
index 3cfc57b49fb3d85c4b9039907fc22bad3a0efe3e..2df0b55a18e57163e49770e83ef067a5587d2126 100644
index 72be000b43c0026bc3b9236171f00a73cc4078e9..0f0718f0ee729715afcc4ba48307f5768a1a088d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
@@ -52,6 +52,40 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
@@ -58,6 +58,40 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
// Paper - remove mojang I/O thread
}
@ -315,7 +315,7 @@ index 3cfc57b49fb3d85c4b9039907fc22bad3a0efe3e..2df0b55a18e57163e49770e83ef067a5
protected void tick(BooleanSupplier shouldKeepTicking) {
while(this.hasWork() && shouldKeepTicking.getAsBoolean()) {
ChunkPos chunkPos = SectionPos.of(this.dirty.firstLong()).chunk();
@@ -166,6 +200,7 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
@@ -175,6 +209,7 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
});
}
}

View File

@ -6,14 +6,14 @@ Subject: [PATCH] Fix ChunkSnapshot#isSectionEmpty(int) and optimize
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 0cf67d55ab30ab145ffb2ff562c26c47c2e2879e..403aba29347c779da75337531c3723632120e7c9 100644
index 7fd9f20d60339270d5e4adbf098ac38a832fb224..7f538d8a6918fbb659d4090c7157d02b3d085478 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -282,13 +282,17 @@ public class CraftChunk implements Chunk {
PalettedContainer<Holder<Biome>>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null;
@@ -283,13 +283,17 @@ public class CraftChunk implements Chunk {
PalettedContainerRO<Holder<Biome>>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null;
Registry<Biome> iregistry = this.worldServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
- Codec<PalettedContainer<Holder<Biome>>> biomeCodec = PalettedContainer.codec(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes
- Codec<PalettedContainerRO<Holder<Biome>>> biomeCodec = PalettedContainer.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS));
for (int i = 0; i < cs.length; i++) {
- CompoundTag data = new CompoundTag();
@ -31,7 +31,7 @@ index 0cf67d55ab30ab145ffb2ff562c26c47c2e2879e..403aba29347c779da75337531c372363
LevelLightEngine lightengine = chunk.level.getLightEngine();
DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(x, i, z));
@@ -307,8 +311,7 @@ public class CraftChunk implements Chunk {
@@ -308,8 +312,7 @@ public class CraftChunk implements Chunk {
}
if (biome != null) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Update Log4j
diff --git a/build.gradle.kts b/build.gradle.kts
index 4715d1386afd939628c392a7d8062e5887d7a507..0282e3b75470e1a68ea1fc228082483514ba432e 100644
index a7c7d450f22f9642fadeac9cb601214cfa9a2b02..3ff7814add16834c70494afb76d8a7788545d009 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -20,10 +20,11 @@ dependencies {
@ -19,6 +19,6 @@ index 4715d1386afd939628c392a7d8062e5887d7a507..0282e3b75470e1a68ea1fc2280824835
// Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper
+ implementation("org.apache.logging.log4j:log4j-slf4j18-impl:2.17.1") // Paper
implementation("org.ow2.asm:asm:9.2")
implementation("org.ow2.asm:asm-commons:9.2") // Paper - ASM event executor generation
runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3")
implementation("org.ow2.asm:asm:9.3")
implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation
implementation("commons-lang:commons-lang:2.6")

View File

@ -5,25 +5,26 @@ Subject: [PATCH] Add more Campfire API
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
index 1d2dbaec8201de12fb65e2c01ca8a1ead7e873a7..96c161b15a62a720fa991e8849f35956f767ff09 100644
index 18b22efe9f5335bb49aa0e899727d1911dc20718..8e198941b4ad7845d73ab1cfea5ac07b0014fe22 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -32,12 +32,14 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
private final NonNullList<ItemStack> items;
@@ -39,6 +39,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
public final int[] cookingProgress;
public final int[] cookingTime;
private final RecipeManager.CachedCheck<Container, CampfireCookingRecipe> quickCheck;
+ public final boolean[] stopCooking; // Paper
public CampfireBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.CAMPFIRE, pos, state);
this.items = NonNullList.withSize(4, ItemStack.EMPTY);
@@ -46,6 +47,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
this.cookingProgress = new int[4];
this.cookingTime = new int[4];
this.quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING);
+ this.stopCooking = new boolean[4]; // Paper
}
public static void cookTick(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire) {
@@ -48,7 +50,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -56,7 +58,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
if (!itemstack.isEmpty()) {
flag = true;
@ -33,7 +34,7 @@ index 1d2dbaec8201de12fb65e2c01ca8a1ead7e873a7..96c161b15a62a720fa991e8849f35956
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
@@ -155,6 +159,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -163,6 +167,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length));
}
@ -50,7 +51,7 @@ index 1d2dbaec8201de12fb65e2c01ca8a1ead7e873a7..96c161b15a62a720fa991e8849f35956
}
@Override
@@ -163,6 +177,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -171,6 +185,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ContainerHelper.saveAllItems(nbt, this.items, true);
nbt.putIntArray("CookingTimes", this.cookingProgress);
nbt.putIntArray("CookingTotalTimes", this.cookingTime);

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix tripwire state inconsistency
This patch prevents updating and re-setting the tripwire when being removed in certain conditions
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
index 6b40bf94fbaa18605b59b92ad1582e8dc3a6a9cd..7d89b9ed84209c161b2c6fec5304abbbf41f2e80 100644
index 4e2fb4ee8e46b3c363992ff23e26f5a648c5f003..7f60175bf671d282c11e9084670d2bb900968255 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
@@ -74,7 +74,7 @@ public class TripWireBlock extends Block {
@ -41,10 +41,10 @@ index 6b40bf94fbaa18605b59b92ad1582e8dc3a6a9cd..7d89b9ed84209c161b2c6fec5304abbb
} else if (iblockdata1.is((Block) this)) {
++k;
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
index 02a3e1ced592784b9c66927c76376c7ab413367d..a4344bf2267112e3c1e31c07c9f6b8eae9666947 100644
index 4a516828e5c6abd63511ee7c93fcff11203cf8d0..004dce26ff073f1de52a84cd425c4f60fdab5e50 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -107,6 +107,12 @@ public class TripWireHookBlock extends Block {
@@ -108,6 +108,12 @@ public class TripWireHookBlock extends Block {
}
public void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1) {
@ -57,7 +57,7 @@ index 02a3e1ced592784b9c66927c76376c7ab413367d..a4344bf2267112e3c1e31c07c9f6b8ea
Direction enumdirection = (Direction) state.getValue(TripWireHookBlock.FACING);
boolean flag2 = (Boolean) state.getValue(TripWireHookBlock.ATTACHED);
boolean flag3 = (Boolean) state.getValue(TripWireHookBlock.POWERED);
@@ -140,6 +146,7 @@ public class TripWireHookBlock extends Block {
@@ -141,6 +147,7 @@ public class TripWireHookBlock extends Block {
boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED);
flag5 |= flag6 && flag7;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Forward CraftEntity in teleport command
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 396ee5a8aa57e7c2e9a14606d37cae3c02dc4283..18294d7cdb4619bb128c626ef567622bae187c8d 100644
index 2661a635b99fa55b79802bb1e71797362f6dfa7c..526c564ebbf44421af8595d14bbbadc0de02c081 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3177,6 +3177,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3224,6 +3224,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public void restoreFrom(Entity original) {
@ -22,7 +22,7 @@ index 396ee5a8aa57e7c2e9a14606d37cae3c02dc4283..18294d7cdb4619bb128c626ef567622b
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
nbttagcompound.remove("Dimension");
@@ -3258,10 +3265,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3305,10 +3312,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (worldserver.getTypeKey() == LevelStem.END) { // CraftBukkit
ServerLevel.makeObsidianPlatform(worldserver, this); // CraftBukkit
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Entity powdered snow API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 9e5f338d0bb64ac47a99cd08a2ab083d2f5caf6c..0a998832afacb25cbaf39737d14aa33eab6967b7 100644
index ad3d005992d7f79b4c756410b063427acaddfbc5..4ab2b20529acb61baca3878281258ba0818b8479 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1294,5 +1294,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1305,5 +1305,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
entity.setRot(location.getYaw(), location.getPitch());
return !entity.valid && entity.level.addFreshEntity(entity, reason);
}

View File

@ -10,10 +10,10 @@ when if this was fixed on the client, that wouldn't be needed.
Mojira Issue: https://bugs.mojang.com/browse/MC-235045
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index fa912cffb2349914d1a550d3d1c69ba5934658dc..9e01ee1776a02dd7be0a47ac3a06e69968d26bdc 100644
index a98cd0aecc034038d81194fd87c4f8df65b86095..a1e36435187a51d2fe100945b90f409b8f9305c1 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -527,6 +527,11 @@ public class PaperConfig {
@@ -523,6 +523,11 @@ public class PaperConfig {
itemValidationBookPageLength = getInt("settings.item-validation.book.page", itemValidationBookPageLength);
}
@ -26,10 +26,10 @@ index fa912cffb2349914d1a550d3d1c69ba5934658dc..9e01ee1776a02dd7be0a47ac3a06e699
public final double packetLimitInterval;
public final double maxPacketRate;
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index db26d834d9a59c4fd60f99077f0118c08293678f..00bbf33aa44e2d5a4e755a2d7c1a60de9e36674f 100644
index 3ad9f1327cd99e16e8eca86d72cb8a57f28b245e..e6c254cfa83b218ad2a0e957306d8019adf0aaa7 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -330,4 +330,20 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
@@ -366,4 +366,20 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
return this.source.getBukkitSender(this);
}
// CraftBukkit end
@ -51,10 +51,10 @@ index db26d834d9a59c4fd60f99077f0118c08293678f..00bbf33aa44e2d5a4e755a2d7c1a60de
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 13a0f78abbb00b489b63d88ce14f60cb04402085..b66afde6851ceaeccb84aea00cdc333dfbf3d4b0 100644
index af00f7dcbc1c4fb8da25128d5603b3ef041db7da..a51040aec86c0be2b124619d8fea2111778ad684 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -409,6 +409,7 @@ public class Commands {
@@ -411,6 +411,7 @@ public class Commands {
private void fillUsableCommands(CommandNode<CommandSourceStack> tree, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
Iterator iterator = tree.getChildren().iterator();
@ -62,7 +62,7 @@ index 13a0f78abbb00b489b63d88ce14f60cb04402085..b66afde6851ceaeccb84aea00cdc333d
while (iterator.hasNext()) {
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
if ( !org.spigotmc.SpigotConfig.sendNamespaced && commandnode2.getName().contains( ":" ) ) continue; // Spigot
@@ -430,6 +431,12 @@ public class Commands {
@@ -432,6 +433,12 @@ public class Commands {
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider()));
@ -76,20 +76,20 @@ index 13a0f78abbb00b489b63d88ce14f60cb04402085..b66afde6851ceaeccb84aea00cdc333d
}
diff --git a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
index 1f3076e59bac23d428c747ae12619e4b4e5fdd5a..1d23d05d7028c5f820f172cc54153f56848e1d05 100644
index 850db283bf12345e9e7d7e8e590dbe8135c6dce1..a2ea64b7ec5f47224312a1e08dd64347be6f7c43 100644
--- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
+++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
@@ -127,7 +127,7 @@ public class EntityArgument implements ArgumentType<EntitySelector> {
@@ -128,7 +128,7 @@ public class EntityArgument implements ArgumentType<EntitySelector> {
StringReader stringreader = new StringReader(suggestionsbuilder.getInput());
stringreader.setCursor(suggestionsbuilder.getStart());
SharedSuggestionProvider icompletionprovider = (SharedSuggestionProvider) commandcontext.getSource();
- EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2));
+ EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2), true); // Paper
try {
argumentparserselector.parse();
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
index 2816fd4a57fe51689daf1b4850ad3ab3c9749225..cdbe0695a29d0854d7f59c1f63a74bd0c1dbf4d9 100644
index ad99d67af92cda03beb1142b02082ee1bfc8a64a..a57ae219d57ed47baedfb73b3d815f39d4f87035 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
@@ -115,12 +115,19 @@ public class EntitySelectorParser {
@ -113,12 +113,12 @@ index 2816fd4a57fe51689daf1b4850ad3ab3c9749225..cdbe0695a29d0854d7f59c1f63a74bd0
this.level = MinMaxBounds.Ints.ANY;
this.rotX = WrappedMinMaxBounds.ANY;
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
index e5a23bf6ab92bb1fa7485df1fe52f68f111bc1b1..f0bc168393ba87310d3c43b236b024c46b66ba39 100644
index c2b26a089c423e5df9a5cbfd1c70efbd1acb0e7a..f15e6fd9b9d35554044bf9f713b60d4c549d9b5e 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
+++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
@@ -68,6 +68,19 @@ public class EntitySelectorOptions {
@@ -67,6 +67,19 @@ public class EntitySelectorOptions {
public static final DynamicCommandExceptionType ERROR_ENTITY_TYPE_INVALID = new DynamicCommandExceptionType((entity) -> {
return new TranslatableComponent("argument.entity.options.type.invalid", entity);
return Component.translatable("argument.entity.options.type.invalid", entity);
});
+ // Paper start
+ public static final DynamicCommandExceptionType ERROR_ENTITY_TAG_INVALID = new DynamicCommandExceptionType((object) -> {
@ -136,7 +136,7 @@ index e5a23bf6ab92bb1fa7485df1fe52f68f111bc1b1..f0bc168393ba87310d3c43b236b024c4
private static void register(String id, EntitySelectorOptions.Modifier handler, Predicate<EntitySelectorParser> condition, Component description) {
OPTIONS.put(id, new EntitySelectorOptions.Option(handler, condition, description));
@@ -315,6 +328,12 @@ public class EntitySelectorOptions {
@@ -314,6 +327,12 @@ public class EntitySelectorOptions {
if (reader.isTag()) {
TagKey<EntityType<?>> tagKey = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, ResourceLocation.read(reader.getReader()));

View File

@ -19,15 +19,15 @@ index 99008ac6943c56f74f912e739709a4724da322ef..b2d9dbf4e006899a932bd6bed40228d4
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java
index 457880c9e894a83d88505cf0b7235df919eea591..1d66588cfe94d190a34dc376b4b5bff9461a3529 100644
index 6e0bd0eab0b06a4ac3042496bbb91292544e9f3c..37539f7680013ab99ed3313b82f9829617d17a71 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Monster.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java
@@ -90,7 +90,7 @@ public abstract class Monster extends PathfinderMob implements Enemy {
public static boolean isDarkEnoughToSpawn(ServerLevelAccessor world, BlockPos pos, Random random) {
if (world.getBrightness(LightLayer.SKY, pos) > random.nextInt(32)) {
return false;
- } else if (world.getBrightness(LightLayer.BLOCK, pos) > 0) {
+ } else if (world.getBrightness(LightLayer.BLOCK, pos) > (world.getLevel().paperConfig.maxBlockLightForMonsterSpawning >= 0 ? world.getLevel().paperConfig.maxBlockLightForMonsterSpawning : 0)) { // Paper - configurable max block light level
@@ -93,7 +93,7 @@ public abstract class Monster extends PathfinderMob implements Enemy {
return false;
} else {
int i = world.getLevel().isThundering() ? world.getMaxLocalRawBrightness(pos, 10) : world.getMaxLocalRawBrightness(pos);
DimensionType dimensionType = world.dimensionType();
- int i = dimensionType.monsterSpawnBlockLightLimit();
+ int i = world.getLevel().paperConfig.maxBlockLightForMonsterSpawning >= 0 ? world.getLevel().paperConfig.maxBlockLightForMonsterSpawning : dimensionType.monsterSpawnBlockLightLimit(); // Paper
if (i < 15 && world.getBrightness(LightLayer.BLOCK, pos) > i) {
return false;
} else {

View File

@ -27,10 +27,10 @@ Co-authored-by: Zach Brown <zach@zachbr.io>
Co-authored-by: Madeline Miller <mnmiller1@me.com>
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index 322b3119682fbab5e790ce9255e96a519f03143d..2e5803035a46f890e8bfc59908c0040f9a960703 100644
index 6d3c9d6c75897af52bbcce50bf23f28269a3ff5c..4d4d28377e5766432d3fd18192bbc1d795fbd69c 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -145,15 +145,15 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -146,15 +146,15 @@ public class PistonBaseBlock extends DirectionalBlock {
}
// CraftBukkit start
@ -55,7 +55,7 @@ index 322b3119682fbab5e790ce9255e96a519f03143d..2e5803035a46f890e8bfc59908c0040f
// PAIL: checkME - what happened to setTypeAndData?
// CraftBukkit end
world.blockEvent(pos, this, b0, enumdirection.get3DDataValue());
@@ -235,6 +235,13 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -236,6 +236,13 @@ public class PistonBaseBlock extends DirectionalBlock {
BlockState iblockdata1 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT);
@ -69,7 +69,7 @@ index 322b3119682fbab5e790ce9255e96a519f03143d..2e5803035a46f890e8bfc59908c0040f
world.setBlock(pos, iblockdata1, 20);
world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata1, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change
world.blockUpdated(pos, iblockdata1.getBlock());
@@ -261,6 +268,13 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -262,6 +269,13 @@ public class PistonBaseBlock extends DirectionalBlock {
if (type == 1 && !iblockdata2.isAir() && PistonBaseBlock.isPushable(iblockdata2, world, blockposition1, enumdirection.getOpposite(), false, enumdirection) && (iblockdata2.getPistonPushReaction() == PushReaction.NORMAL || iblockdata2.is(Blocks.PISTON) || iblockdata2.is(Blocks.STICKY_PISTON))) {
this.moveBlocks(world, pos, enumdirection, false);
} else {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Load effect amplifiers greater than 127 correctly
MOJIRA: MC-118857
diff --git a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
index fefc8a1b5dbdc02f9f3e31055840170b9a6274b9..b84610d00f710c656d9eaf85b80e796f8be4bca3 100644
index 9537f6dbc51f21d3e4dd5d28cf77c3f29e35eab8..2faf634994f355ef1bf07fc70f1a0f4451db5fcc 100644
--- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
+++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
@@ -235,7 +235,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
@@ -265,7 +265,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
}
private static MobEffectInstance loadSpecifiedEffect(MobEffect type, CompoundTag nbt) {

View File

@ -7,10 +7,10 @@ Fixes bees incorrectly being aged up due to upstream's
resetting the ticks inside hive on a failed release
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
index 19127ec5d89235ea9af549810b24783e0af85a3d..483dc52c793d9f90a35b1d091dd8ce71115e4640 100644
index 82ad97800cb115cc4830337a59cc4608c1d4a7a0..41c9f074203915c31c1ae7a160ce509c13383f84 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -325,7 +325,7 @@ public class BeehiveBlockEntity extends BlockEntity {
@@ -328,7 +328,7 @@ public class BeehiveBlockEntity extends BlockEntity {
for (Iterator iterator = bees.iterator(); iterator.hasNext(); ++tileentitybeehive_hivebee.ticksInHive) {
tileentitybeehive_hivebee = (BeehiveBlockEntity.BeeData) iterator.next();
@ -19,7 +19,7 @@ index 19127ec5d89235ea9af549810b24783e0af85a3d..483dc52c793d9f90a35b1d091dd8ce71
BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus = tileentitybeehive_hivebee.entityData.getBoolean("HasNectar") ? BeehiveBlockEntity.BeeReleaseStatus.HONEY_DELIVERED : BeehiveBlockEntity.BeeReleaseStatus.BEE_RELEASED;
if (BeehiveBlockEntity.releaseOccupant(world, pos, state, tileentitybeehive_hivebee, (List) null, tileentitybeehive_releasestatus, flowerPos)) {
@@ -333,10 +333,11 @@ public class BeehiveBlockEntity extends BlockEntity {
@@ -336,10 +336,11 @@ public class BeehiveBlockEntity extends BlockEntity {
iterator.remove();
// CraftBukkit start
} else {
@ -32,7 +32,7 @@ index 19127ec5d89235ea9af549810b24783e0af85a3d..483dc52c793d9f90a35b1d091dd8ce71
}
if (flag) {
@@ -425,12 +426,14 @@ public class BeehiveBlockEntity extends BlockEntity {
@@ -428,12 +429,14 @@ public class BeehiveBlockEntity extends BlockEntity {
final CompoundTag entityData;
int ticksInHive;

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Check player world in endPortalSoundRadius
Fixes Spigot's endPortalSoundRadius not checking player worlds
diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
index beb3713937470d7c5d8cadce3f3a823ca48d3726..d9c20eca27382e89ddb13f1c8e84348242ca6ceb 100644
index a88ffff41481d346a99762352094cdb4e8dd6cc2..0b3e9e4ed162a6d9e1f3f55b9522b75c94d13254 100644
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
@@ -66,7 +66,7 @@ public class EnderEyeItem extends Item {
@@ -68,7 +68,7 @@ public class EnderEyeItem extends Item {
double deltaX = soundPos.getX() - player.getX();
double deltaZ = soundPos.getZ() - player.getZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Validate usernames
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 9e01ee1776a02dd7be0a47ac3a06e69968d26bdc..94a96c34e207a84a7c9226e9255beb6d0371f068 100644
index a1e36435187a51d2fe100945b90f409b8f9305c1..6706e502a068766e2eff3f790bbca004698932d1 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -495,6 +495,12 @@ public class PaperConfig {
@@ -491,6 +491,12 @@ public class PaperConfig {
set("settings.unsupported-settings.allow-tnt-duplication", null);
}
@ -22,19 +22,19 @@ index 9e01ee1776a02dd7be0a47ac3a06e69968d26bdc..94a96c34e207a84a7c9226e9255beb6d
public static int maxPlayerAutoSavePerTick = 10;
private static void playerAutoSaveRate() {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index f5c1dff1d571e89f960f11400edbcbbea0620575..7065aa4522431d08018fec8e591ba7c255398140 100644
index 38521660c6fa7c1a19c5268dac05928b5ec983f4..221f32e034ccb57907f79bae4ecec324e9cdb14e 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -61,6 +61,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
private ServerPlayer delayedAcceptPlayer;
@@ -71,6 +71,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
private ProfilePublicKey playerProfilePublicKey;
public String hostname = ""; // CraftBukkit - add field
private int velocityLoginMessageId = -1; // Paper - Velocity support
+ public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding
public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) {
this.state = ServerLoginPacketListenerImpl.State.HELLO;
@@ -226,11 +227,39 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
// Paper end
@@ -263,10 +264,38 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
}
}
+ // Paper start - validate usernames
@ -60,21 +60,20 @@ index f5c1dff1d571e89f960f11400edbcbbea0620575..7065aa4522431d08018fec8e591ba7c2
@Override
public void handleHello(ServerboundHelloPacket packet) {
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
this.gameProfile = packet.getGameProfile();
Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(this.gameProfile.getName()), "Invalid characters in username", new Object[0]);
Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]);
+ // Paper start - validate usernames
+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) {
+ if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(this.gameProfile.getName())) {
+ if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(packet.name())) {
+ ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!");
+ return;
+ }
+ }
+ // Paper end - validate usernames
if (this.server.usesAuthentication() && !this.connection.isMemoryConnection()) {
this.state = ServerLoginPacketListenerImpl.State.KEY;
this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce));
try {
this.playerProfilePublicKey = ServerLoginPacketListenerImpl.validatePublicKey(packet, this.server.getServiceSignatureValidator(), this.server.enforceSecureProfile());
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index bb4e844c77c76eb893c55844c5a814ccd337b7f4..32f710e52da781ed9a0df8249a9ca79f1804b24a 100644
index ac9ee7f574f9b6c5e9c9368e54928e47ca62fb24..6951b8e320dcea2c2ce4271ed03a20c729ff503b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -707,7 +707,7 @@ public abstract class PlayerList {

View File

@ -34,11 +34,11 @@ index b2d9dbf4e006899a932bd6bed40228d4f744d865..100de7e366c4ea8ce158b0fc0258e4db
private void containerUpdateTickRate() {
containerUpdateTickRate = getInt("container-update-tick-rate", 1);
diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
index 69f7e034cab1bfd7ca5dffc660b6decd739adf35..c039b896ee85543c26a8ab76640080f539deaa4c 100644
index 522abd880c1e7f7c9026f0ab6457bc649f11802c..1b6d426b44e200b3634c0a9ac7c3a315841ada40 100644
--- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
@@ -79,6 +79,10 @@ public abstract class WaterAnimal extends PathfinderMob {
public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType<? extends WaterAnimal> type, LevelAccessor world, MobSpawnType reason, BlockPos pos, Random random) {
public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType<? extends WaterAnimal> type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource random) {
int i = world.getSeaLevel();
int j = i - 13;
+ // Paper start

View File

@ -5,33 +5,33 @@ Subject: [PATCH] Expose vanilla BiomeProvider from WorldInfo
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index df955666723a8cb1e612311f0b8e77fb577d6be5..01aefce226ae82d707b38b0d56d2580d411a3c9a 100644
index 6279b843ad04769b202b74913e328c86f256ee13..718b477b2f53a3b2decb4c045ece12ab75aee23d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -582,7 +582,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
chunkgenerator = worlddimension.generator();
@@ -558,7 +558,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Paper end
- org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), holder.value());
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), holder.value(), chunkgenerator, this.registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY)); // Paper
- org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.typeHolder().value());
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.typeHolder().value(), worlddimension.generator(), this.registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY)); // Paper
if (biomeProvider == null && gen != null) {
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 8769e15a395b1c6e72f3e4a7f96b8c90c34e7569..b4133f8dde5edb75b8d2d1008c50db7810276913 100644
index 5bfd4457f551e5e71e0f74a0d52568e165404e22..f8b7cd7026fcd73c8cf0245d9f7ba58a453fb733 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1217,7 +1217,7 @@ public final class CraftServer implements Server {
chunkgenerator = worlddimension.generator();
}
@@ -1202,7 +1202,7 @@ public final class CraftServer implements Server {
Registry<LevelStem> iregistry = worlddata.worldGenSettings().dimensions();
LevelStem worlddimension = (LevelStem) iregistry.get(actualDimension);
- WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), holder.value());
+ WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), holder.value(), chunkgenerator, this.getHandle().getServer().registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY)); // Paper
- WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.typeHolder().value());
+ WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.typeHolder().value(), worlddimension.generator(), this.getHandle().getServer().registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY)); // Paper
if (biomeProvider == null && generator != null) {
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 f05ff9891d59cd7ae4e37c05c690dda0c75962fe..925907eff49e26cac48e895f44c55f80b9a6f81e 100644
index 24d2a9b4a1c602b8ac5960ed9668ab70f34d6620..63e4b8e4e44d6885b537ca3dd052dd806411f618 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -195,6 +195,31 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -67,7 +67,7 @@ index f05ff9891d59cd7ae4e37c05c690dda0c75962fe..925907eff49e26cac48e895f44c55f80
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 aeffb30cd91d4b21850059d33070c537bd5cb25e..3918c24dfb6cda4cff18016cca807c2dbc2a9156 100644
index 3795dc9b12d62113146e803554283acd8d0e5db9..704bd0ca45eccce5fa1e6f72690398e428b0af44 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftWorldInfo.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftWorldInfo.java
@@ -17,8 +17,17 @@ public class CraftWorldInfo implements WorldInfo {
@ -86,7 +86,7 @@ index aeffb30cd91d4b21850059d33070c537bd5cb25e..3918c24dfb6cda4cff18016cca807c2d
+ this.vanillaChunkGenerator = chunkGenerator;
+ // Paper end
this.name = worldDataServer.getLevelName();
this.uuid = WorldUUID.getUUID(session.levelPath.toFile());
this.uuid = WorldUUID.getUUID(session.levelDirectory.path().toFile());
this.environment = environment;
@@ -28,6 +37,10 @@ public class CraftWorldInfo implements WorldInfo {
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add config option for worlds affected by time cmd
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 94a96c34e207a84a7c9226e9255beb6d0371f068..318e28b5e93b6842d48745ec53bcc25dbfeaff72 100644
index 6706e502a068766e2eff3f790bbca004698932d1..8fff289a02234cbe5e808fe6e736788a2ed1e5c2 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -647,4 +647,9 @@ public class PaperConfig {
@@ -637,4 +637,9 @@ public class PaperConfig {
private static void sendFullPosForHardCollidingEntities() {
sendFullPosForHardCollidingEntities = getBoolean("settings.send-full-pos-for-hard-colliding-entities", true);
}
@ -19,7 +19,7 @@ index 94a96c34e207a84a7c9226e9255beb6d0371f068..318e28b5e93b6842d48745ec53bcc25d
+ }
}
diff --git a/src/main/java/net/minecraft/server/commands/TimeCommand.java b/src/main/java/net/minecraft/server/commands/TimeCommand.java
index ad4860bf64979e6b10bc6aecc4ac67a5c069e030..da854c5bfaf9e791b272a497caf864748f3dfbda 100644
index e1908c2fcad3d1505bdcd65ba7ceb3dfa42c5c39..b462a2ea6150bf749e8632d0abda11c0aa84247c 100644
--- a/src/main/java/net/minecraft/server/commands/TimeCommand.java
+++ b/src/main/java/net/minecraft/server/commands/TimeCommand.java
@@ -51,7 +51,7 @@ public class TimeCommand {