3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

More patch work

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-24 18:15:59 +02:00
Ursprung 1de0dc8828
Commit 4e654f2a3a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
35 geänderte Dateien mit 136 neuen und 221 gelöschten Zeilen

Datei anzeigen

@ -3,6 +3,8 @@ From: Nassim Jahnke <nassim@njahnke.dev>
Date: Wed, 1 Dec 2021 12:36:25 +0100
Subject: [PATCH] Prevent sending oversized item data in equipment and metadata
TODO: Check if still needed with compacted items over the network and limits
diff --git a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java
index 3ee4c01e4505241e575b8b2e96338ba27b793a2b..d70f77e4d5ca59c9f802ecb354fa8d53d1e10134 100644

Datei anzeigen

@ -3,6 +3,8 @@ From: Noah van der Aa <ndvdaa@gmail.com>
Date: Tue, 3 Aug 2021 17:28:27 +0200
Subject: [PATCH] Hide unnecessary itemmeta from clients
TODO: Needs updating for data components
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index a51564e8dce3c125ed5f05cc23548a05c1e79a95..d2c2075fb0378fd7ec148281d37d886c77a78ce8 100644

Datei anzeigen

@ -6,6 +6,8 @@ Subject: [PATCH] Fix bees aging inside hives
Fixes bees incorrectly being aged up due to upstream's
resetting the ticks inside hive on a failed release
TODO: Test if still needed
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 a69a81ba6a2b65978b5cf00810ed12156a5f89e6..55b0e2bf98a285cdcd30e40d94192b7a1802efd8 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java

Datei anzeigen

@ -29,7 +29,7 @@ index 3ebba8af1cf2d2eaf6670860b011c7dc1da62890..acf57732dd902bd23166e60788477b69
+ // Paper end - old getSpawnEgg API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index e495b2ce1f129172314178222de9bba7bfe56572..0542b72550ee92293b2b8fdb8a19bea6f8633030 100644
index e495b2ce1f129172314178222de9bba7bfe56572..b08de24fbc5addefe61d5b1919898775260d4a54 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -375,6 +375,15 @@ public class Commodore {
@ -39,9 +39,9 @@ index e495b2ce1f129172314178222de9bba7bfe56572..0542b72550ee92293b2b8fdb8a19bea6
+ // Paper start - ItemFactory#getSpawnEgg (paper had original method that returned ItemStack, upstream added identical but returned Material)
+ if (owner.equals("org/bukkit/inventory/ItemFactory") && name.equals("getSpawnEgg") && desc.equals("(Lorg/bukkit/entity/EntityType;)Lorg/bukkit/inventory/ItemStack;")) {
+ super.visitInsn(Opcodes.SWAP); // has 1 param, this moves the owner instance to the top for the checkcast
+ super.visitTypeInsn(Opcodes.CHECKCAST, CB_PACKAGE + "/inventory/CraftItemFactory");
+ super.visitTypeInsn(Opcodes.CHECKCAST, CB_PACKAGE_PREFIX + "inventory/CraftItemFactory");
+ super.visitInsn(Opcodes.SWAP); // moves param back to the the top of stack
+ super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE + "/inventory/CraftItemFactory", "getSpawnEgg0", desc, false);
+ super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE_PREFIX + "inventory/CraftItemFactory", "getSpawnEgg0", desc, false);
+ return;
+ }
+ // Paper end - ItemFactory#getSpawnEgg

Datei anzeigen

@ -19,10 +19,10 @@ index 49028463ba47e760281545c2f7597e3db8d6c453..7620c72a4c243cbeea245203ce03a97c
}
final Object val = config.get(key);
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index edd968686292237e95afdf99a291f501386144ef..d09d5192f0a571e9758e95dd5e1392a9caa88bde 100644
index a8768f1925d5824ca985be1b53694ee233273758..748caca458eb4eec6ece22d8362e36de252f07dd 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -431,7 +431,14 @@ public abstract class ChunkGenerator {
@@ -437,7 +437,14 @@ public abstract class ChunkGenerator {
return (String) optional.orElseGet(placedfeature::toString);
};

Datei anzeigen

@ -57,10 +57,10 @@ index 0000000000000000000000000000000000000000..6bd0afddbcc461149dfe9a5c7a86fff6
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 6b4c9ef02931491dd048646ead494892f06504c5..608d860b940dee870a3df3d52efaed5e9eab17cf 100644
index 4bc7b3d7c5214b3272614fe3fce8e4d8d2264867..784788d8d3d1a07efbd406b6c463e046699081e2 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -179,6 +179,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -192,6 +192,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] don't attempt to teleport dead entities
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 685cd5c719a0bf8d3e41aa95b0e84effe1241948..a9c1561ae9ec5a3db7a0602314c9a935ddf3fdfd 100644
index 24e4db0e80b774e5681e031f56cb7da844656f8f..555202937152abaabf4b7a6e637c9a290d180ea8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -718,7 +718,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -731,7 +731,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit start
public void postTick() {
// No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle

Datei anzeigen

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Thu, 25 Nov 2021 10:25:09 +0100
Subject: [PATCH] Prevent excessive velocity through repeated crits
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f5c18ac111188ae2397eaf41cac28edda98c1002..be044167883611dde0665749d9e243b9c7b6fbd2 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2748,16 +2748,28 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.hasEffect(MobEffects.JUMP) ? 0.1F * ((float) this.getEffect(MobEffects.JUMP).getAmplifier() + 1.0F) : 0.0F;
}
+ protected long lastJumpTime = 0L; // Paper - Prevent excessive velocity through repeated crits
protected void jumpFromGround() {
float f = this.getJumpPower();
if (f > 1.0E-5F) {
Vec3 vec3d = this.getDeltaMovement();
+ // Paper start - Prevent excessive velocity through repeated crits
+ long time = System.nanoTime();
+ boolean canCrit = true;
+ if (this instanceof net.minecraft.world.entity.player.Player) {
+ canCrit = false;
+ if (time - this.lastJumpTime > (long)(0.250e9)) {
+ this.lastJumpTime = time;
+ canCrit = true;
+ }
+ }
+ // Paper end - Prevent excessive velocity through repeated crits
this.setDeltaMovement(vec3d.x, (double) f, vec3d.z);
if (this.isSprinting()) {
float f1 = this.getYRot() * 0.017453292F;
-
+ if (canCrit) // Paper - Prevent excessive velocity through repeated crits
this.addDeltaMovement(new Vec3((double) (-Mth.sin(f1)) * 0.2D, 0.0D, (double) Mth.cos(f1) * 0.2D));
}

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Remove client-side code using deprecated for removal
Fixes warnings on build
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 722734ce612fb790ddc80488a795a85ebcd4a842..72e734af483dc03e1ae947b2ab3b6fa7df38ce62 100644
index c7a21a11efba5c212958d56095217621828c1062..2cd0a4dc4f0baa08bd7f5a053303bb63733f0bab 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -935,16 +935,7 @@ public class Util {
@@ -964,16 +964,7 @@ public class Util {
}
public void openUrl(URL url) {

Datei anzeigen

@ -13,10 +13,10 @@ Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
index 724d77b014a738ad32a1708bd31c0f1a5d76fd57..bdd9f38dcb16b74c5916b75713dbe5082b32497d 100644
index 1e7235413fae39dc530eb843f1846f74bb5268b6..635fc086d832c641f840cf36d18cdc0fcc3beef3 100644
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
@@ -51,9 +51,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
@@ -50,9 +50,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
return to.setValue(BERRIES, from.getValue(BERRIES));
}
@ -37,7 +37,7 @@ index 724d77b014a738ad32a1708bd31c0f1a5d76fd57..bdd9f38dcb16b74c5916b75713dbe508
@Override
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index aa029bee9839497e48ff639e286a024280150362..5b96d1ae4bd8546311e986bc312b1f85883a67f4 100644
index 73595922dcff8e7a8595fcf033ab238bc4096630..112d2feba5f75a2a873b595617780515945c10e4 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -91,6 +91,10 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
@ -52,7 +52,7 @@ index aa029bee9839497e48ff639e286a024280150362..5b96d1ae4bd8546311e986bc312b1f85
modifier = world.spigotConfig.wheatModifier;
}
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
index b74e61064926a7c7fb03286651ea52c150f86107..30300ef3ec839dfa944c992ab50db4d3859bb02e 100644
index 164a855d99cf36205bd9fce04640109f20a2b96c..cf05da1c86e3018db11dc079bf50317b6639e5cc 100644
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
@@ -60,12 +60,18 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
@ -76,12 +76,12 @@ index b74e61064926a7c7fb03286651ea52c150f86107..30300ef3ec839dfa944c992ab50db4d3
return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE);
}
diff --git a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
index 83cc52de8cbb538f8ff2dbce0594f44b8d404b8e..d3827a6759c99d945767498d37a6dbb6b70b6d0d 100644
index fd7f7d58cd159f663f8f474d9c73841c795d2990..b98e17d21d43610fb7a7ce1641c518598ff48cb0 100644
--- a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
@@ -114,7 +114,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
if (!isHanging(state)) {
- if (random.nextInt(7) == 0) {
+ if (random.nextFloat() < (world.spigotConfig.saplingModifier / (100.0F * 7))) { // Paper - Fix Spigot growth modifiers

Datei anzeigen

@ -5,10 +5,10 @@ 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 ba06184bad7e8ae55cb2d55f6196e8f990d2811d..7eccacb978f047a4774e58b11bc3f9ab3959b049 100644
index 43e4e893f0e7eed1959e6ccfa43c39ff00f083b3..86dce6796f92a5b0ae2b1bd837267c4e3f6754d0 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
@@ -64,6 +64,7 @@ public abstract class ContainerOpenersCounter {
@@ -69,6 +69,7 @@ public abstract class ContainerOpenersCounter {
public void decrementOpeners(Player player, Level world, BlockPos pos, BlockState state) {
int oldPower = Math.max(0, Math.min(15, this.openCount)); // CraftBukkit - Get power before new viewer is added

Datei anzeigen

@ -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 5c507b1160835fd4beb3b2d5b621250540545d4e..ab85050a64d4897aff11d0780d8cb26660918ac7 100644
index 5a0658932cc45c49c9285b1419d574dd83041732..bb22b84c32848869967a47a60f9d8a0629a59e2a 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -3,6 +3,7 @@ package net.minecraft.world.entity.decoration;
@@ -2,6 +2,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 - Add PlayerItemFrameChangeEvent
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
@@ -185,6 +186,13 @@ public class ItemFrame extends HangingEntity {
import net.minecraft.core.component.DataComponents;
@@ -179,6 +180,13 @@ public class ItemFrame extends HangingEntity {
return true;
}
// CraftBukkit end
@ -30,7 +30,7 @@ index 5c507b1160835fd4beb3b2d5b621250540545d4e..ab85050a64d4897aff11d0780d8cb266
this.dropItem(source.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
@@ -451,13 +459,26 @@ public class ItemFrame extends HangingEntity {
@@ -429,11 +437,24 @@ public class ItemFrame extends HangingEntity {
}
}
@ -43,9 +43,7 @@ index 5c507b1160835fd4beb3b2d5b621250540545d4e..ab85050a64d4897aff11d0780d8cb266
+ this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()));
+ // Paper end - Add PlayerItemFrameChangeEvent
this.gameEvent(GameEvent.BLOCK_CHANGE, player);
if (!player.getAbilities().instabuild) {
itemstack.shrink(1);
}
itemstack.consume(1, player);
}
} else {
+ // Paper start - Add PlayerItemFrameChangeEvent

Datei anzeigen

@ -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 dc37989ab5e0971a144a8248152169b4fd868067..c366992f3e48f9a3a69ba48491d678ba73e81d61 100644
index 382c5a9ad23523b830edc7c81767b13a49aca087..85ed4c0775bccf52e5d7d39ec70a315aff9e1c2d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2466,6 +2466,88 @@ public final class CraftServer implements Server {
@@ -2483,6 +2483,88 @@ public final class CraftServer implements Server {
return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME));
}

Datei anzeigen

@ -6,7 +6,7 @@ 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 bfde7573acb6d84accfd3f7fee877bbfb3b0852f..260ca4a9c170567b27488466f802c91212997f91 100644
index fc335e4e80553e8c6c915e7813e9610ac10649c2..5b59b19a6d913ebdfc28a755e3a1a8b8384a3116 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -337,13 +337,17 @@ public class CraftChunk implements Chunk {
@ -18,8 +18,8 @@ index bfde7573acb6d84accfd3f7fee877bbfb3b0852f..260ca4a9c170567b27488466f802c912
for (int i = 0; i < cs.length; i++) {
- CompoundTag data = new CompoundTag();
- data.put("block_states", ChunkSerializer.BLOCK_STATE_CODEC.encodeStart(NbtOps.INSTANCE, cs[i].getStates()).get().left().get());
- sectionBlockIDs[i] = ChunkSerializer.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, data.getCompound("block_states")).get().left().get();
- data.put("block_states", ChunkSerializer.BLOCK_STATE_CODEC.encodeStart(NbtOps.INSTANCE, cs[i].getStates()).getOrThrow());
- sectionBlockIDs[i] = ChunkSerializer.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, data.getCompound("block_states")).getOrThrow(ChunkSerializer.ChunkReadException::new);
+ // Paper start - Fix ChunkSnapshot#isSectionEmpty(int); and remove codec usage
+ sectionEmpty[i] = cs[i].hasOnlyAir(); // fix sectionEmpty array not being filled
+ if (!sectionEmpty[i]) {
@ -35,8 +35,8 @@ index bfde7573acb6d84accfd3f7fee877bbfb3b0852f..260ca4a9c170567b27488466f802c912
}
if (biome != null) {
- data.put("biomes", biomeCodec.encodeStart(NbtOps.INSTANCE, cs[i].getBiomes()).get().left().get());
- biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).get().left().get();
- data.put("biomes", biomeCodec.encodeStart(NbtOps.INSTANCE, cs[i].getBiomes()).getOrThrow());
- biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).getOrThrow(ChunkSerializer.ChunkReadException::new);
+ biome[i] = ((PalettedContainer<Holder<net.minecraft.world.level.biome.Biome>>) cs[i].getBiomes()).copy(); // Paper - Perf: use copy instead of round tripping with codecs
}
}

Datei anzeigen

@ -5,10 +5,10 @@ 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 5da0c6bf4f04448f640a11931b2cc5b91cf83f12..9f7b49a6a50cb53d914c8f4b5132c035c5ab71da 100644
index e858d32c7e8e228a1f0327a33054671ad105c2eb..24563a43f25d4621291b1ba6f24773cccedddbfe 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
@@ -42,6 +42,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -47,6 +47,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
public final int[] cookingProgress;
public final int[] cookingTime;
private final RecipeManager.CachedCheck<Container, CampfireCookingRecipe> quickCheck;
@ -16,7 +16,7 @@ index 5da0c6bf4f04448f640a11931b2cc5b91cf83f12..9f7b49a6a50cb53d914c8f4b5132c035
public CampfireBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.CAMPFIRE, pos, state);
@@ -49,6 +50,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -54,6 +55,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);
@ -24,7 +24,7 @@ index 5da0c6bf4f04448f640a11931b2cc5b91cf83f12..9f7b49a6a50cb53d914c8f4b5132c035
}
public static void cookTick(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire) {
@@ -59,7 +61,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -64,7 +66,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
if (!itemstack.isEmpty()) {
flag = true;
@ -34,7 +34,7 @@ index 5da0c6bf4f04448f640a11931b2cc5b91cf83f12..9f7b49a6a50cb53d914c8f4b5132c035
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
@@ -172,6 +176,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -177,6 +181,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length));
}
@ -51,8 +51,8 @@ index 5da0c6bf4f04448f640a11931b2cc5b91cf83f12..9f7b49a6a50cb53d914c8f4b5132c035
}
@Override
@@ -180,6 +194,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ContainerHelper.saveAllItems(nbt, this.items, true);
@@ -185,6 +199,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ContainerHelper.saveAllItems(nbt, this.items, true, registryLookup);
nbt.putIntArray("CookingTimes", this.cookingProgress);
nbt.putIntArray("CookingTotalTimes", this.cookingTime);
+ // Paper start - Add more Campfire API
@ -66,12 +66,12 @@ index 5da0c6bf4f04448f640a11931b2cc5b91cf83f12..9f7b49a6a50cb53d914c8f4b5132c035
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCampfire.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCampfire.java
index 07556d0961569c1be62a697414bd4ec512b04ac0..cc641dc70dc12b902bd9cad93fffded9032f1e82 100644
index 4850cbf2c326f1155e04a204abed2d200c02342d..a776bba2ec51c6aecce98a3abceb2c235522d99d 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCampfire.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCampfire.java
@@ -56,4 +56,40 @@ public class CraftCampfire extends CraftBlockEntityState<CampfireBlockEntity> im
public CraftCampfire copy() {
return new CraftCampfire(this);
@@ -62,4 +62,40 @@ public class CraftCampfire extends CraftBlockEntityState<CampfireBlockEntity> im
public CraftCampfire copy(Location location) {
return new CraftCampfire(this, location);
}
+
+ // Paper start

Datei anzeigen

@ -8,10 +8,10 @@ This ensures at least a valid version of the chunk exists
on disk, even if outdated
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 140d6e455c1729f6e31e95facba5520b75ad838c..169e375c814ff814d15101d09dccc67783f50465 100644
index 12b7d50f49a2184aaf220a4a50a137b217c57124..f1237f6fd6414900ffbad0caee31aa83310eeef4 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -420,6 +420,7 @@ public class RegionFile implements AutoCloseable {
@@ -442,6 +442,7 @@ public class RegionFile implements AutoCloseable {
}
@ -19,7 +19,7 @@ index 140d6e455c1729f6e31e95facba5520b75ad838c..169e375c814ff814d15101d09dccc677
private class ChunkBuffer extends ByteArrayOutputStream {
private final ChunkPos pos;
@@ -433,6 +434,23 @@ public class RegionFile implements AutoCloseable {
@@ -455,6 +456,23 @@ public class RegionFile implements AutoCloseable {
super.write(RegionFile.this.version.getId());
this.pos = chunkcoordintpair;
}
@ -44,10 +44,10 @@ index 140d6e455c1729f6e31e95facba5520b75ad838c..169e375c814ff814d15101d09dccc677
public void close() throws IOException {
ByteBuffer bytebuffer = ByteBuffer.wrap(this.buf, 0, this.count);
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index b5b7b73048eaadfe58961631427da7574d42f5e8..fa086a19f038b929f356292b2f657929765f7b6f 100644
index 9748b798f55ee0cbfdce1a2b2c48700623ef17a5..c4eef3aade889c69cefd873bec2d031cc54103ea 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -145,10 +145,17 @@ public class RegionFileStorage implements AutoCloseable {
@@ -147,10 +147,17 @@ public class RegionFileStorage implements AutoCloseable {
try {
NbtIo.write(nbt, (DataOutput) dataoutputstream);
@ -66,7 +66,7 @@ index b5b7b73048eaadfe58961631427da7574d42f5e8..fa086a19f038b929f356292b2f657929
} catch (Throwable throwable1) {
throwable.addSuppressed(throwable1);
}
@@ -156,10 +163,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -158,10 +165,7 @@ public class RegionFileStorage implements AutoCloseable {
throw throwable;
}
@ -78,7 +78,7 @@ index b5b7b73048eaadfe58961631427da7574d42f5e8..fa086a19f038b929f356292b2f657929
}
// Paper start - Chunk save reattempt
return;
@@ -202,4 +206,13 @@ public class RegionFileStorage implements AutoCloseable {
@@ -204,4 +208,13 @@ public class RegionFileStorage implements AutoCloseable {
}
}

Datei anzeigen

@ -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 a9c1561ae9ec5a3db7a0602314c9a935ddf3fdfd..a14ac8aef9aec14a3ca31a61d66f03fec0841927 100644
index 555202937152abaabf4b7a6e637c9a290d180ea8..2e0dc24bf6732637b29e21c8817f0d3502a2a89a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3263,6 +3263,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3279,6 +3279,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void restoreFrom(Entity original) {
@ -22,7 +22,7 @@ index a9c1561ae9ec5a3db7a0602314c9a935ddf3fdfd..a14ac8aef9aec14a3ca31a61d66f03fe
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
nbttagcompound.remove("Dimension");
@@ -3353,10 +3360,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3369,10 +3376,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
// CraftBukkit end

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Entity powdered snow API
public net.minecraft.world.entity.monster.Skeleton inPowderSnowTime
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index c819fa8e5b69c23558a89b68f9a5a31e1b233ca3..25c064a7da80ef98a758d7cb8bd1aa3de452e2e4 100644
index a61638bc8200f6aa25d9c3254aea6c0cd38bcbf1..97716f0a20fbc5f7048256ad1942e8f56e9fb72b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1070,6 +1070,13 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1080,6 +1080,13 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
// Paper end - raw entity serialization API

Datei anzeigen

@ -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 0dbdcd443fe8a299119ea5ba3acb1a0412856184..3dfe79684f662ac7cae4583bfe03a633438b4df7 100644
index 2f2c9fb65d4cc8bd40303216e03c5c1956305ff4..e6bfbe2588e0c2a1be14e38d654e889d392ad4db 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
@@ -159,15 +159,15 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -160,15 +160,15 @@ public class PistonBaseBlock extends DirectionalBlock {
}
// CraftBukkit start
@ -55,7 +55,7 @@ index 0dbdcd443fe8a299119ea5ba3acb1a0412856184..3dfe79684f662ac7cae4583bfe03a633
// PAIL: checkME - what happened to setTypeAndData?
// CraftBukkit end
world.blockEvent(pos, this, b0, enumdirection.get3DDataValue());
@@ -244,6 +244,13 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -245,6 +245,13 @@ public class PistonBaseBlock extends DirectionalBlock {
BlockState iblockdata2 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT);
@ -69,7 +69,7 @@ index 0dbdcd443fe8a299119ea5ba3acb1a0412856184..3dfe79684f662ac7cae4583bfe03a633
world.setBlock(pos, iblockdata2, 20);
world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata2, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true));
world.blockUpdated(pos, iblockdata2.getBlock());
@@ -270,6 +277,13 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -271,6 +278,13 @@ public class PistonBaseBlock extends DirectionalBlock {
if (type == 1 && !iblockdata3.isAir() && PistonBaseBlock.isPushable(iblockdata3, world, blockposition1, enumdirection.getOpposite(), false, enumdirection) && (iblockdata3.getPistonPushReaction() == PushReaction.NORMAL || iblockdata3.is(Blocks.PISTON) || iblockdata3.is(Blocks.STICKY_PISTON))) {
this.moveBlocks(world, pos, enumdirection, false);
} else {

Datei anzeigen

@ -5,31 +5,31 @@ Subject: [PATCH] Validate usernames
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index a7da99ac31bbcb8b6f1814a2d5509c7067aafb08..fb582acfe9e5cb68314ee39e1d54a550d6700e76 100644
index 5fa0947bd6029f37d786488b44ec23090c45963a..49627a02cb15e94e7c3ddfe65aa663d982a34408 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -63,6 +63,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
public GameProfile authenticatedProfile; // Paper - public
@@ -83,6 +83,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
private final String serverId;
private final boolean transferred;
private ServerPlayer player; // CraftBukkit
+ public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding
public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) {
public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection, boolean transferred) {
this.state = ServerLoginPacketListenerImpl.State.HELLO;
@@ -137,7 +138,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -164,7 +165,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@Override
public void handleHello(ServerboundHelloPacket packet) {
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
- Validate.validState(Player.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]);
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation && !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) Validate.validState(Player.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); // Paper - config username validation
- Validate.validState(StringUtil.isValidPlayerName(packet.name()), "Invalid characters in username", new Object[0]);
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation && !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) Validate.validState(StringUtil.isValidPlayerName(packet.name()), "Invalid characters in username", new Object[0]); // Paper - config username validation
this.requestedUsername = packet.name();
GameProfile gameprofile = this.server.getSingleplayerProfile();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 7cd6d91fe154d29ec0b0fc0a5a50713bbc2c1c83..95ba9b3bf957e5f744e85b3834a50ee2eb925a70 100644
index a476762125f5f7b6fbda37837b50880d415b25c6..825a63a23adceaea0de996f6c6122c44f5e700c0 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -678,7 +678,7 @@ public abstract class PlayerList {
@@ -676,7 +676,7 @@ public abstract class PlayerList {
for (int i = 0; i < this.players.size(); ++i) {
entityplayer = (ServerPlayer) this.players.get(i);
@ -38,17 +38,15 @@ index 7cd6d91fe154d29ec0b0fc0a5a50713bbc2c1c83..95ba9b3bf957e5f744e85b3834a50ee2
list.add(entityplayer);
}
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index e06cb31f9e3eda651a44dcede095ef7b38ef2ba7..7c0db708575ef26a1dd73709bf22653f21e0c863 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -2341,9 +2341,23 @@ public abstract class Player extends LivingEntity {
diff --git a/src/main/java/net/minecraft/util/StringUtil.java b/src/main/java/net/minecraft/util/StringUtil.java
index d3fc549a08993376c76c4ebebb788fea3f4ddf69..ae7ef47446c15b8a6878dd2d31b60cd0670eaf83 100644
--- a/src/main/java/net/minecraft/util/StringUtil.java
+++ b/src/main/java/net/minecraft/util/StringUtil.java
@@ -64,7 +64,23 @@ public class StringUtil {
}
public static boolean isValidUsername(String name) {
- return name.length() > 16 ? false : name.chars().filter((i) -> {
- return i <= 32 || i >= 127;
- }).findAny().isEmpty();
public static boolean isValidPlayerName(String name) {
- return name.length() <= 16 && name.chars().filter(c -> c <= 32 || c >= 127).findAny().isEmpty();
+ // Paper start - username validation overriding
+ if (name == null || name.isEmpty() || name.length() > 16) {
+ return false;
@ -68,4 +66,4 @@ index e06cb31f9e3eda651a44dcede095ef7b38ef2ba7..7c0db708575ef26a1dd73709bf22653f
+ // Paper end - username validation overriding
}
public static float getPickRange(boolean creative) {
public static String filterText(String string) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Make water animal spawn height configurable
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 7ef707f0098f2663ebc0ef0f5b35897c9d33c1cf..75884a9e69a28404752c1a2cf854335bb78cac01 100644
index f74cfa008886e0b74b850982d60ceb8879243c36..6f22705072fecbe91196e4966fca2eeec060f120 100644
--- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
@@ -74,6 +74,10 @@ public abstract class WaterAnimal extends PathfinderMob {
@@ -68,6 +68,10 @@ public abstract class WaterAnimal extends PathfinderMob {
) {
int i = world.getSeaLevel();
int j = i - 13;

Datei anzeigen

@ -5,10 +5,10 @@ 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 86283e9b7c3ad18e4deb8fcd3de624be92908c55..e367711dc3ef96280fe672f02e2ce99e43a5cd3c 100644
index 00a83b766f9e32b6403296901e806b07d4e4818e..3832033003dbf5f5b43b9786b5fd4c965764cc9f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -597,7 +597,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -608,7 +608,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver));
LevelStem worlddimension = (LevelStem) dimensions.get(dimensionKey);
@ -18,10 +18,10 @@ index 86283e9b7c3ad18e4deb8fcd3de624be92908c55..e367711dc3ef96280fe672f02e2ce99e
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 c366992f3e48f9a3a69ba48491d678ba73e81d61..b3e1f987d31ef5a8f90bc366e248de86e93b9634 100644
index 85ed4c0775bccf52e5d7d39ec70a315aff9e1c2d..6348f452a437c10f8291148e9bd4642b5fb09ec2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1272,7 +1272,7 @@ public final class CraftServer implements Server {
@@ -1275,7 +1275,7 @@ public final class CraftServer implements Server {
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
LevelStem worlddimension = iregistry.get(actualDimension);
@ -31,7 +31,7 @@ index c366992f3e48f9a3a69ba48491d678ba73e81d61..b3e1f987d31ef5a8f90bc366e248de86
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 139281eab642a3676987fa9b3597b5b6e1a99e9c..5d5e5e811d065411e5def069533e8f9ab974ed55 100644
index 268ce3e66ce85b1b7cf2378a32bf4fd3f0f4f268..5b404c9f923fd4f1822dbb2ff25b24157c0a8fe5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -212,6 +212,29 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Multiple Entries with Scoreboards
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
index 0f05f1c2a30fef68ae635f4a2476b8cd1b6a127d..3f9712a8da937b03b03f7124e0671eb6905a2b2f 100644
index 1d0c473442b5c72245c356054440323e3c5d4711..f8fe125f12a6a00899d1d6acfa448be882b81557 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
@@ -51,6 +51,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi
@@ -58,6 +58,11 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi
);
}
@ -17,15 +17,14 @@ index 0f05f1c2a30fef68ae635f4a2476b8cd1b6a127d..3f9712a8da937b03b03f7124e0671eb6
+ return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), players);
+ }
+ // Paper end - Multiple Entries with Scoreboards
+
public ClientboundSetPlayerTeamPacket(FriendlyByteBuf buf) {
private ClientboundSetPlayerTeamPacket(RegistryFriendlyByteBuf buf) {
this.name = buf.readUtf();
this.method = buf.readByte();
diff --git a/src/main/java/net/minecraft/server/ServerScoreboard.java b/src/main/java/net/minecraft/server/ServerScoreboard.java
index c4904b358fc2f493e6a9572a84b8110a927da208..76d67d01388ecc1af6b43212e018edc678e84d72 100644
index 65a206c9969d5c7eee6bd185e398244365b5a809..f180001493146ef0d54079a8b2b47ad7decc24ca 100644
--- a/src/main/java/net/minecraft/server/ServerScoreboard.java
+++ b/src/main/java/net/minecraft/server/ServerScoreboard.java
@@ -104,6 +104,25 @@ public class ServerScoreboard extends Scoreboard {
@@ -106,6 +106,25 @@ public class ServerScoreboard extends Scoreboard {
}
}
@ -51,7 +50,7 @@ index c4904b358fc2f493e6a9572a84b8110a927da208..76d67d01388ecc1af6b43212e018edc6
@Override
public void removePlayerFromTeam(String scoreHolderName, PlayerTeam team) {
super.removePlayerFromTeam(scoreHolderName, team);
@@ -111,6 +130,17 @@ public class ServerScoreboard extends Scoreboard {
@@ -113,6 +132,17 @@ public class ServerScoreboard extends Scoreboard {
this.setDirty();
}

Datei anzeigen

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Mon, 21 Jun 2021 22:12:53 -0400
Subject: [PATCH] Always allow item changing in Fireball
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Fireball.java b/src/main/java/net/minecraft/world/entity/projectile/Fireball.java
index 307f545b79f01e22b1ffa9e41a0d353b3fa6a21d..58ea1fdc8dd5eb48d9642edecbbba1751e7037b6 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Fireball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Fireball.java
@@ -27,7 +27,7 @@ public abstract class Fireball extends AbstractHurtingProjectile implements Item
}
public void setItem(ItemStack stack) {
- if (!stack.is(Items.FIRE_CHARGE) || stack.hasTag()) {
+ if (true || !stack.is(Items.FIRE_CHARGE) || stack.hasTag()) { // Paper - always allow item changing
this.getEntityData().set(Fireball.DATA_ITEM_STACK, stack.copyWithCount(1));
}

Datei anzeigen

@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Thu, 25 Nov 2021 10:25:09 +0100
Subject: [PATCH] Prevent excessive velocity through repeated crits
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 31eb77e4e5f07b120708edeca497ef2eef1fcf13..ed6fd20ff608e764d6b0f517f6c9c85c533f1646 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2697,13 +2697,26 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.hasEffect(MobEffects.JUMP) ? 0.1F * ((float) this.getEffect(MobEffects.JUMP).getAmplifier() + 1.0F) : 0.0F;
}
+ protected long lastJumpTime = 0L; // Paper - Prevent excessive velocity through repeated crits
protected void jumpFromGround() {
Vec3 vec3d = this.getDeltaMovement();
+ // Paper start - Prevent excessive velocity through repeated crits
+ long time = System.nanoTime();
+ boolean canCrit = true;
+ if (this instanceof net.minecraft.world.entity.player.Player) {
+ canCrit = false;
+ if (time - this.lastJumpTime > (long)(0.250e9)) {
+ this.lastJumpTime = time;
+ canCrit = true;
+ }
+ }
+ // Paper end - Prevent excessive velocity through repeated crits
this.setDeltaMovement(vec3d.x, (double) this.getJumpPower(), vec3d.z);
if (this.isSprinting()) {
float f = this.getYRot() * 0.017453292F;
+ if (canCrit) // Paper - Prevent excessive velocity through repeated crits
this.setDeltaMovement(this.getDeltaMovement().add((double) (-Mth.sin(f) * 0.2F), 0.0D, (double) (Mth.cos(f) * 0.2F)));
}

Datei anzeigen

@ -1,50 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake <jake.m.potrebic@gmail.com>
Date: Tue, 30 Nov 2021 12:01:56 -0800
Subject: [PATCH] Fix removing recipes from RecipeIterator
== AT ==
public net.minecraft.world.item.crafting.RecipeManager byName
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
index 65b12eaab871019def074bf17257772ff7f09806..5217e9f7e78e5d4d5751bba51554ff46666b77dd 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
@@ -13,6 +13,7 @@ import org.bukkit.inventory.Recipe;
public class RecipeIterator implements Iterator<Recipe> {
private final Iterator<Map.Entry<RecipeType<?>, Object2ObjectLinkedOpenHashMap<ResourceLocation, RecipeHolder<?>>>> recipes;
private Iterator<RecipeHolder<?>> current;
+ private Recipe currentRecipe; // Paper - fix removing recipes from RecipeIterator
public RecipeIterator() {
this.recipes = MinecraftServer.getServer().getRecipeManager().recipes.entrySet().iterator();
@@ -36,15 +37,27 @@ public class RecipeIterator implements Iterator<Recipe> {
public Recipe next() {
if (this.current == null || !this.current.hasNext()) {
this.current = this.recipes.next().getValue().values().iterator();
- return this.next();
+ // Paper start - fix removing recipes from RecipeIterator
+ this.currentRecipe = this.next();
+ return this.currentRecipe;
+ // Paper end - fix removing recipes from RecipeIterator
}
- return this.current.next().toBukkitRecipe();
+ // Paper start - fix removing recipes from RecipeIterator
+ this.currentRecipe = this.current.next().toBukkitRecipe();
+ return this.currentRecipe;
+ // Paper end - fix removing recipes from RecipeIterator
}
@Override
public void remove() {
Preconditions.checkState(this.current != null, "next() not yet called");
+
+ // Paper start - fix removing recipes from RecipeIterator
+ if (this.currentRecipe instanceof org.bukkit.Keyed keyed) {
+ MinecraftServer.getServer().getRecipeManager().byName.remove(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(keyed.getKey()));
+ }
+ // Paper end - fix removing recipes from RecipeIterator
this.current.remove();
}
}

Datei anzeigen

@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 21 Dec 2021 22:13:26 -0800
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 83f1d79147630084b24be20602571f36fc62a1b3..5c9a0c91ae53b575d325a294c702668d30252fcf 100644
--- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
+++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
@@ -298,7 +298,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
}
private static MobEffectInstance loadSpecifiedEffect(MobEffect type, CompoundTag nbt) {
- int i = nbt.getByte("amplifier");
+ int i = Byte.toUnsignedInt(nbt.getByte("amplifier")); // Paper - correctly load amplifiers > 127
int j = nbt.getInt("duration");
boolean bl = nbt.getBoolean("ambient");
boolean bl2 = true;