13
0
geforkt von Mirrors/Paper

More more more more more more more more more more more patches

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-06-08 15:36:56 +02:00
Ursprung 7c319bce76
Commit dcb23664a3
44 geänderte Dateien mit 21 neuen und 113 gelöschten Zeilen

Datei anzeigen

@ -10,14 +10,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
@@ -0,0 +0,0 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
@Override
public void die(DamageSource source) {
public void die(DamageSource damageSource) {
if (!this.level.isClientSide && this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES) && this.getOwner() instanceof ServerPlayer) {
- this.getOwner().sendMessage(this.getCombatTracker().getDeathMessage(), Util.NIL_UUID);
- this.getOwner().sendSystemMessage(this.getCombatTracker().getDeathMessage());
+ // Paper start - TameableDeathMessageEvent
+ io.papermc.paper.event.entity.TameableDeathMessageEvent event = new io.papermc.paper.event.entity.TameableDeathMessageEvent((org.bukkit.entity.Tameable) getBukkitEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getCombatTracker().getDeathMessage()));
+ if (event.callEvent()) {
+ this.getOwner().sendMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.deathMessage()), Util.NIL_UUID);
+ } // Paper end - TameableDeathMessageEvent
+ this.getOwner().sendSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.deathMessage()));
+ }
+ // Paper end - TameableDeathMessageEvent
}
super.die(source);
super.die(damageSource);

Datei anzeigen

@ -31,40 +31,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
compoundTag.putBoolean("resolved", true);
if (!makeSureTagIsValid(compoundTag)) {
return false;
} else {
ListTag listTag = compoundTag.getList("pages", 8);
+ // Paper start - backport length limit
+ ListTag newPages = new ListTag();
for(int i = 0; i < listTag.size(); ++i) {
- listTag.set(i, (Tag)StringTag.valueOf(resolvePage(commandSource, player, listTag.getString(i))));
+ String resolvedPage = resolvePage(commandSource, player, listTag.getString(i));
+ if (resolvedPage.length() > 32767) {
+ return false;
+ }
+
+ newPages.add(i, StringTag.valueOf(resolvedPage));
}
if (compoundTag.contains("filtered_pages", 10)) {
CompoundTag compoundTag2 = compoundTag.getCompound("filtered_pages");
+ CompoundTag newFilteredPages = new CompoundTag();
for(String string : compoundTag2.getAllKeys()) {
- compoundTag2.putString(string, resolvePage(commandSource, player, compoundTag2.getString(string)));
+ String resolvedPage = resolvePage(commandSource, player, compoundTag2.getString(string));
+ if (resolvedPage.length() > 32767) {
+ return false;
+ }
+
+ newFilteredPages.putString(string, resolvedPage);
}
+
+ compoundTag.put("filtered_pages", newFilteredPages);
}
+ compoundTag.put("pages", newPages);
+ // Paper end
return true;
}
} else {

Datei anzeigen

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return;
+ }
+ // Paper end
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, pos);
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
} else if (precipitation == Biome.Precipitation.SNOW) {
- world.setBlockAndUpdate(pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState());
+ // Paper start - call event for initial fill
@ -28,31 +28,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return;
+ }
+ // Paper end
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, pos);
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
}
@@ -0,0 +0,0 @@ public class CauldronBlock extends AbstractCauldronBlock {
@Override
protected void receiveStalactiteDrip(BlockState state, Level world, BlockPos pos, Fluid fluid) {
if (fluid == Fluids.WATER) {
- LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState();
- LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
+ // Paper start - don't send level event or game event if cancelled
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
+ return;
+ }
+ // Paper end
world.levelEvent(1047, pos, 0);
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, pos);
} else if (fluid == Fluids.LAVA) {
- LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.LAVA_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
iblockdata1 = Blocks.LAVA_CAULDRON.defaultBlockState();
- LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
+ // Paper start - don't send level event or game event if cancelled
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.LAVA_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
+ return;
+ }
+ // Paper end
world.levelEvent(1046, pos, 0);
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, pos);
}
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java

Datei anzeigen

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/level/block/MushroomBlock.java
@@ -0,0 +0,0 @@ public class MushroomBlock extends BushBlock implements BonemealableBlock {
public boolean growMushroom(ServerLevel world, BlockPos pos, BlockState state, Random random) {
public boolean growMushroom(ServerLevel world, BlockPos pos, BlockState state, RandomSource random) {
world.removeBlock(pos, false);
- SaplingBlock.treeType = (this == Blocks.BROWN_MUSHROOM) ? TreeType.BROWN_MUSHROOM : TreeType.BROWN_MUSHROOM; // CraftBukkit
+ SaplingBlock.treeType = (this == Blocks.BROWN_MUSHROOM) ? TreeType.BROWN_MUSHROOM : TreeType.RED_MUSHROOM; // CraftBukkit // Paper

Datei anzeigen

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy {
public static boolean checkSlimeSpawnRules(EntityType<Slime> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
public static boolean checkSlimeSpawnRules(EntityType<Slime> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
if (world.getDifficulty() != Difficulty.PEACEFUL) {
+ // Paper start - fix slime spawners; Fixes MC-50647
+ if (spawnReason == MobSpawnType.SPAWNER) {

Datei anzeigen

@ -41,5 +41,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end - block invalid positions
// Paper end
// Paper start - fix MC-4
if (this instanceof ItemEntity) {
if (this.position.x != x || this.position.y != y || this.position.z != z) {
synchronized (this.posLock) { // Paper

Datei anzeigen

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - preserve this check from vanilla
// SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule)
this.dropFromLootTable(source, this.lastHurtByPlayerTime > 0);
this.dropFromLootTable(damageSource, this.lastHurtByPlayerTime > 0);
for (org.bukkit.inventory.ItemStack item : this.drops) {
loot.add(item);
}

Datei anzeigen

@ -1,56 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 12 Mar 2022 06:31:13 -0800
Subject: [PATCH] Fix swamp hut cat generation deadlock
The worldgen thread will attempt to get structure references
via the world's getChunkAt method, which is fine if the gen is
not cancelled - but if the chunk was unloaded, the call will block
indefinitely. Instead of using the world state, we use the already
supplied generatoraccess which will always have the chunk available.
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
@@ -0,0 +0,0 @@ public class Cat extends TamableAnimal {
Registry<ConfiguredStructureFeature<?, ?>> iregistry = worldserver1.registryAccess().registryOrThrow(Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY);
if (ChunkGenerator.allConfigurations(iregistry, StructureFeature.SWAMP_HUT).anyMatch((structurefeature) -> {
- return worldserver1.structureFeatureManager().getStructureWithPieceAt(this.blockPosition(), structurefeature).isValid();
+ return worldserver1.structureFeatureManager().getStructureWithPieceAt(this.blockPosition(), structurefeature, world).isValid(); // Paper - fix deadlock
})) {
this.setCatType(10);
this.setPersistenceRequired();
diff --git a/src/main/java/net/minecraft/world/level/StructureFeatureManager.java b/src/main/java/net/minecraft/world/level/StructureFeatureManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/StructureFeatureManager.java
+++ b/src/main/java/net/minecraft/world/level/StructureFeatureManager.java
@@ -0,0 +0,0 @@ public class StructureFeatureManager {
}
public List<StructureStart> startsForFeature(SectionPos sectionPos, ConfiguredStructureFeature<?, ?> configuredStructureFeature) {
- LongSet longSet = this.level.getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES).getReferencesForFeature(configuredStructureFeature);
+ // Paper start - add world option
+ return this.startsForFeature(sectionPos, configuredStructureFeature, (ServerLevelAccessor)null);
+ }
+ public List<StructureStart> startsForFeature(SectionPos sectionPos, ConfiguredStructureFeature<?, ?> configuredStructureFeature, ServerLevelAccessor world) {
+ LongSet longSet = (world == null ? this.level : world).getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES).getReferencesForFeature(configuredStructureFeature);
+ // Paper end - add world option
ImmutableList.Builder<StructureStart> builder = ImmutableList.builder();
this.fillStartsForFeature(configuredStructureFeature, longSet, builder::add);
return builder.build();
@@ -0,0 +0,0 @@ public class StructureFeatureManager {
}
public StructureStart getStructureWithPieceAt(BlockPos pos, ConfiguredStructureFeature<?, ?> configuredStructureFeature) {
- for(StructureStart structureStart : this.startsForFeature(SectionPos.of(pos), configuredStructureFeature)) {
+ // Paper start - add world option
+ return this.getStructureWithPieceAt(pos, configuredStructureFeature, (ServerLevelAccessor)null);
+ }
+ public StructureStart getStructureWithPieceAt(BlockPos pos, ConfiguredStructureFeature<?, ?> configuredStructureFeature, ServerLevelAccessor world) {
+ // Paper end - add world option
+ for(StructureStart structureStart : this.startsForFeature(SectionPos.of(pos), configuredStructureFeature, world)) { // Paper - add world option
if (this.structureHasPieceAt(pos, structureStart)) {
return structureStart;
}