mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 17:31:06 +01:00
116 lines
8.4 KiB
Diff
116 lines
8.4 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 ae219be37c5fcec3dd3f8b08819551003e66d351..8309eb14140ebcf62ae7be1dfa0177ac7fcf83d7 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -294,7 +294,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/Marker.java b/src/main/java/net/minecraft/world/entity/Marker.java
|
|
index d9f07a311ec5a253bdfb681414e1f8033a576a23..6f110ece5686d1fc73b93fb9e0a73f2c1bcf4586 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Marker.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Marker.java
|
|
@@ -39,8 +39,9 @@ public class Marker extends Entity {
|
|
}
|
|
|
|
@Override
|
|
- protected void addPassenger(Entity passenger) {
|
|
+ protected boolean addPassenger(Entity passenger) { // Paper - fix upstream
|
|
passenger.stopRiding();
|
|
+ return false; // Paper - fix upstream
|
|
}
|
|
|
|
@Override
|
|
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 2222a8be261142dd7a42170ad3fe314eeea1deb5..136da73e372b59f37665743c70833e815cd0070b 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
|
|
@@ -421,9 +421,9 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
|
|
}
|
|
|
|
@Override
|
|
- protected void actuallyHurt(DamageSource source, float amount) {
|
|
+ protected boolean damageEntity0(DamageSource source, float amount) { // Paper - fix CB method rename issue
|
|
this.standUpPanic();
|
|
- super.actuallyHurt(source, amount);
|
|
+ return super.damageEntity0(source, amount); // Paper - fix CB method rename issue
|
|
}
|
|
|
|
@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 99af167b02c1291f9f5fd1a195a3eb65de87002b..874f7ea643d27eec47d51a10ad472af7e8ec402e 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
|
|
@@ -44,7 +44,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;
|
|
@@ -54,7 +54,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/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 7faf3100253b7b1fd7119cf83238d8a349e7a6bb..2d3e0eed3ef5ac3853ede30bd67866d2a6e87508 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -2302,7 +2302,13 @@ public final class CraftServer implements Server {
|
|
Validate.notNull(key, "NamespacedKey cannot be null");
|
|
|
|
LootTables registry = this.getServer().getLootTables();
|
|
- return new CraftLootTable(key, registry.get(CraftNamespacedKey.toMinecraft(key)));
|
|
+ // Paper start - honor method contract
|
|
+ final ResourceLocation lootTableKey = CraftNamespacedKey.toMinecraft(key);
|
|
+ if (!registry.getIds().contains(lootTableKey)) {
|
|
+ return null;
|
|
+ }
|
|
+ return new CraftLootTable(key, registry.get(lootTableKey));
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|
|
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 c93eec7a81ed83dc9190417dd51acb2780d3b60d..70d3949616c63038ad3e9bd1069db5ea2fb3f3b8 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();
|
|
}
|