mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 02:10:30 +01:00
31699ae9a8
* Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: a6a9d2a4 Remove some old ApiStatus.Experimental annotations be72314c SPIGOT-7300, PR-829: Add new DamageSource API providing enhanced information about entity damage b252cf05 SPIGOT-7576, PR-970: Add methods in MushroomCow to change stew effects b1c689bd PR-902: Add Server#isLoggingIPs to get log-ips configuration 08f86d1c PR-971: Add Player methods for client-side potion effects 2e3024a9 PR-963: Add API for in-world structures a23292a7 SPIGOT-7530, PR-948: Improve Resource Pack API with new 1.20.3 functionality 1851857b SPIGOT-3071, PR-969: Add entity spawn method with spawn reason cde4c52a SPIGOT-5553, PR-964: Add EntityKnockbackEvent CraftBukkit Changes: 38fd4bd50 Fix accidentally renamed internal damage method 80f0ce4be SPIGOT-7300, PR-1180: Add new DamageSource API providing enhanced information about entity damage 7e43f3b16 SPIGOT-7581: Fix typo in BlockMushroom ea14b7d90 SPIGOT-7576, PR-1347: Add methods in MushroomCow to change stew effects 4c687f243 PR-1259: Add Server#isLoggingIPs to get log-ips configuration 22a541a29 Improve support for per-world game rules cb7dccce2 PR-1348: Add Player methods for client-side potion effects b8d6109f0 PR-1335: Add API for in-world structures 4398a1b5b SPIGOT-7577: Make CraftWindCharge#explode discard the entity e74107678 Fix Crafter maximum stack size 0bb0f4f6a SPIGOT-7530, PR-1314: Improve Resource Pack API with new 1.20.3 functionality 4949f556d SPIGOT-3071, PR-1345: Add entity spawn method with spawn reason 20ac73ca2 PR-1353: Fix Structure#place not working as documented with 0 palette 3c1b77871 SPIGOT-6911, PR-1349: Change max book length in CraftMetaBook 333701839 SPIGOT-7572: Bee nests generated without bees f48f4174c SPIGOT-5553, PR-1336: Add EntityKnockbackEvent
148 lines
11 KiB
Diff
148 lines
11 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Fri, 25 Feb 2022 07:14:48 -0800
|
|
Subject: [PATCH] CB fixes
|
|
|
|
* Missing Level -> LevelStem generic in StructureCheck
|
|
Need to use the right for injectDatafixingContext (Spottedleaf)
|
|
|
|
* Removed incorrect parent perm for `minecraft.debugstick.always` (Machine_Maker)
|
|
|
|
* Fixed method signature of Marker#addPassenger (Machine_Maker)
|
|
|
|
* Removed unneeded UOE in CustomWorldChunkManager (extends BiomeSource) (Machine_Maker)
|
|
|
|
* Honor Server#getLootTable method contract (Machine_Maker)
|
|
|
|
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index 674c996af91de91ee6302cc67334b836ea4fa4de..93867b8883c6f5d5086e8fdc153e6d7c1e5d9fec 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -296,7 +296,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
long l = minecraftserver.getWorldData().worldGenOptions().seed();
|
|
|
|
- this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
|
|
+ this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), this.getTypeKey(), chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer); // Paper - Fix missing CB diff
|
|
this.structureManager = new StructureManager(this, this.serverLevelData.worldGenOptions(), this.structureCheck); // CraftBukkit
|
|
if ((this.dimension() == Level.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) || env == org.bukkit.World.Environment.THE_END) { // CraftBukkit - Allow to create EnderDragonBattle in default and custom END
|
|
this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenOptions().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
|
index 869f60e9407ed1c5bee536ef91a21f4d11f8f964..95e5d1d707e610c930b6098a86c5162fd29bf602 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
|
@@ -445,9 +445,9 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
|
}
|
|
|
|
@Override
|
|
- protected void actuallyHurt(DamageSource source, float amount) {
|
|
+ protected boolean actuallyHurt(DamageSource source, float amount) { // Paper - Fix CB...
|
|
this.standUpInstantly();
|
|
- super.actuallyHurt(source, amount);
|
|
+ return super.actuallyHurt(source, amount); // Paper - Fix CB...
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
|
|
index 161ad6ab1443b2ce33a2d7d91d189c855db0453b..15a9736a870055d639d03063c7cf67fd769fff36 100644
|
|
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
|
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
|
|
@@ -43,7 +43,7 @@ public class StructureCheck {
|
|
private final Registry<Biome> biomes;
|
|
private final Registry<Structure> structureConfigs;
|
|
private final StructureTemplateManager structureTemplateManager;
|
|
- private final ResourceKey<Level> dimension;
|
|
+ private final ResourceKey<net.minecraft.world.level.dimension.LevelStem> dimension; // Paper - fix missing CB diff
|
|
private final ChunkGenerator chunkGenerator;
|
|
private final RandomState randomState;
|
|
private final LevelHeightAccessor heightAccessor;
|
|
@@ -53,7 +53,7 @@ public class StructureCheck {
|
|
private final Long2ObjectMap<Object2IntMap<Structure>> loadedChunks = new Long2ObjectOpenHashMap<>();
|
|
private final Map<Structure, Long2BooleanMap> featureChecks = new HashMap<>();
|
|
|
|
- public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey<Level> worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) {
|
|
+ public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey<net.minecraft.world.level.dimension.LevelStem> worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff
|
|
this.storageAccess = chunkIoWorker;
|
|
this.registryAccess = registryManager;
|
|
this.structureTemplateManager = structureTemplateManager;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
|
|
index 809fdf2da78293391aa5c60c04f4ad652b152eec..955b0abd4019fc45df84719eee6bf413e59d941a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
|
|
@@ -172,4 +172,11 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
|
|
org.bukkit.loot.LootTable table = (org.bukkit.loot.LootTable) obj;
|
|
return table.getKey().equals(this.getKey());
|
|
}
|
|
+
|
|
+ // Paper start - satisfy equals/hashCode contract
|
|
+ @Override
|
|
+ public int hashCode() {
|
|
+ return java.util.Objects.hash(key);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index cd39509d383c47319b71797e5d1df41c2b8c7ab6..2cc1871c81056acd0582184bb684e672d14d3b6f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -2466,7 +2466,11 @@ public final class CraftServer implements Server {
|
|
Preconditions.checkArgument(key != null, "NamespacedKey key cannot be null");
|
|
|
|
LootDataManager registry = this.getServer().getLootData();
|
|
- return new CraftLootTable(key, registry.getLootTable(CraftNamespacedKey.toMinecraft(key)));
|
|
+ // Paper start - honor method contract
|
|
+ final ResourceLocation lootTableKey = CraftNamespacedKey.toMinecraft(key);
|
|
+ final Optional<net.minecraft.world.level.storage.loot.LootTable> table = registry.getElementOptional(net.minecraft.world.level.storage.loot.LootDataType.TABLE, lootTableKey);
|
|
+ return table.map(lootTable -> new CraftLootTable(key, lootTable)).orElse(null);
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index c8f0570b7d37a0c0bddb0a65c36fb32de584df8f..02060584892d630d91f58e864ed34656ee738572 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -122,6 +122,7 @@ public class Main {
|
|
|
|
this.acceptsAll(Main.asList("forceUpgrade"), "Whether to force a world upgrade");
|
|
this.acceptsAll(Main.asList("eraseCache"), "Whether to force cache erase during world upgrade");
|
|
+ this.accepts("safeMode", "Loads level with vanilla datapack only"); // Paper
|
|
this.acceptsAll(Main.asList("nogui"), "Disables the graphical console");
|
|
|
|
this.acceptsAll(Main.asList("nojline"), "Disables jline and emulates the vanilla console");
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
|
index 905adf97c0d1f0d1c774a6835a5dffcfea884e58..c017ce2ca1bc535795c958a2e509af2adf88efa9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
|
@@ -26,6 +26,7 @@ import org.bukkit.scheduler.BukkitWorker;
|
|
|
|
/**
|
|
* The fundamental concepts for this implementation:
|
|
+ * <ul>
|
|
* <li>Main thread owns {@link #head} and {@link #currentTick}, but it may be read from any thread</li>
|
|
* <li>Main thread exclusively controls {@link #temp} and {@link #pending}.
|
|
* They are never to be accessed outside of the main thread; alternatives exist to prevent locking.</li>
|
|
@@ -41,6 +42,7 @@ import org.bukkit.scheduler.BukkitWorker;
|
|
* <li>Sync tasks are only to be removed from runners on the main thread when coupled with a removal from pending and temp.</li>
|
|
* <li>Most of the design in this scheduler relies on queuing special tasks to perform any data changes on the main thread.
|
|
* When executed from inside a synchronous method, the scheduler will be updated before next execution by virtue of the frequent {@link #parsePending()} calls.</li>
|
|
+ * </ul>
|
|
*/
|
|
public class CraftScheduler implements BukkitScheduler {
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
|
|
index 5ac25dab93fd4c9e9533c80d1ca3d93446d7a365..245ad120a36b6defca7e6889faae1ca5fc33d0c7 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
|
|
@@ -15,7 +15,7 @@ public final class CraftDefaultPermissions {
|
|
DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".nbt.place", "Gives the user the ability to place restricted blocks with NBT in creative", org.bukkit.permissions.PermissionDefault.OP, parent);
|
|
DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".nbt.copy", "Gives the user the ability to copy NBT in creative", org.bukkit.permissions.PermissionDefault.TRUE, parent);
|
|
DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".debugstick", "Gives the user the ability to use the debug stick in creative", org.bukkit.permissions.PermissionDefault.OP, parent);
|
|
- DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".debugstick.always", "Gives the user the ability to use the debug stick in all game modes", org.bukkit.permissions.PermissionDefault.FALSE, parent);
|
|
+ DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".debugstick.always", "Gives the user the ability to use the debug stick in all game modes", org.bukkit.permissions.PermissionDefault.FALSE/* , parent */); // Paper - should not have this parent, as it's not a "vanilla" utility
|
|
// Spigot end
|
|
parent.recalculatePermissibles();
|
|
}
|