mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
More patchy patched patches
This commit is contained in:
parent
00dec09758
commit
810c0219d9
56 changed files with 153 additions and 178 deletions
|
@ -52,7 +52,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListene
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
|
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName() {
|
public String getUserName() {
|
||||||
|
@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Override
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@ -705,12 +705,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
this.sync = dsync;
|
this.sync = dsync;
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
Files.createDirectories(this.folder);
|
FileUtil.createDirectoriesSafe(this.folder);
|
||||||
Path path = this.folder;
|
Path path = this.folder;
|
||||||
int j = chunkcoordintpair.getRegionX();
|
int j = chunkcoordintpair.getRegionX();
|
||||||
- Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca");
|
- Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca");
|
||||||
+ Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); // Paper - diff on change
|
+ Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); // Paper - diff on change
|
||||||
if (existingOnly && !Files.exists(path1)) return null; // CraftBukkit
|
if (existingOnly && !java.nio.file.Files.exists(path1)) return null; // CraftBukkit
|
||||||
- RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync);
|
- RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync);
|
||||||
+ RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header
|
+ RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header
|
||||||
|
|
|
@ -235,7 +235,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper end - optimise state lookup
|
+ // Paper end - optimise state lookup
|
||||||
}
|
}
|
||||||
|
|
||||||
public void populateNeighbours(Map<Map<Property<?>, Comparable<?>>, S> states) {
|
public <T extends Comparable<T>, V extends T> S trySetValue(Property<T> property, V value) {
|
||||||
@@ -0,0 +0,0 @@ public abstract class StateHolder<O, S> {
|
@@ -0,0 +0,0 @@ public abstract class StateHolder<O, S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -193,7 +193,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ } // Paper
|
+ } // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeltaMovement(double x, double y, double z) {
|
public void addDeltaMovement(Vec3 velocity) {
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||||
}
|
}
|
||||||
// Paper end - fix MC-4
|
// Paper end - fix MC-4
|
|
@ -76,6 +76,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- Arrays.asList(
|
- Arrays.asList(
|
||||||
- Material.ACACIA_SIGN,
|
- Material.ACACIA_SIGN,
|
||||||
- Material.ACACIA_WALL_SIGN,
|
- Material.ACACIA_WALL_SIGN,
|
||||||
|
- Material.BAMBOO_SIGN,
|
||||||
|
- Material.BAMBOO_WALL_SIGN,
|
||||||
- Material.BIRCH_SIGN,
|
- Material.BIRCH_SIGN,
|
||||||
- Material.BIRCH_WALL_SIGN,
|
- Material.BIRCH_WALL_SIGN,
|
||||||
- Material.CRIMSON_SIGN,
|
- Material.CRIMSON_SIGN,
|
||||||
|
@ -97,10 +99,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
-
|
-
|
||||||
- register(
|
- register(
|
||||||
- Arrays.asList(
|
- Arrays.asList(
|
||||||
|
- Material.ACACIA_HANGING_SIGN,
|
||||||
|
- Material.ACACIA_WALL_HANGING_SIGN,
|
||||||
|
- Material.BAMBOO_HANGING_SIGN,
|
||||||
|
- Material.BAMBOO_WALL_HANGING_SIGN,
|
||||||
|
- Material.BIRCH_HANGING_SIGN,
|
||||||
|
- Material.BIRCH_WALL_HANGING_SIGN,
|
||||||
|
- Material.CRIMSON_HANGING_SIGN,
|
||||||
|
- Material.CRIMSON_WALL_HANGING_SIGN,
|
||||||
|
- Material.DARK_OAK_HANGING_SIGN,
|
||||||
|
- Material.DARK_OAK_WALL_HANGING_SIGN,
|
||||||
|
- Material.JUNGLE_HANGING_SIGN,
|
||||||
|
- Material.JUNGLE_WALL_HANGING_SIGN,
|
||||||
|
- Material.MANGROVE_HANGING_SIGN,
|
||||||
|
- Material.MANGROVE_WALL_HANGING_SIGN,
|
||||||
|
- Material.OAK_HANGING_SIGN,
|
||||||
|
- Material.OAK_WALL_HANGING_SIGN,
|
||||||
|
- Material.SPRUCE_HANGING_SIGN,
|
||||||
|
- Material.SPRUCE_WALL_HANGING_SIGN,
|
||||||
|
- Material.WARPED_HANGING_SIGN,
|
||||||
|
- Material.WARPED_WALL_HANGING_SIGN
|
||||||
|
- ), CraftHangingSign.class, CraftHangingSign::new, HangingSignBlockEntity::new
|
||||||
|
- );
|
||||||
|
-
|
||||||
|
- register(
|
||||||
|
- Arrays.asList(
|
||||||
- Material.CREEPER_HEAD,
|
- Material.CREEPER_HEAD,
|
||||||
- Material.CREEPER_WALL_HEAD,
|
- Material.CREEPER_WALL_HEAD,
|
||||||
- Material.DRAGON_HEAD,
|
- Material.DRAGON_HEAD,
|
||||||
- Material.DRAGON_WALL_HEAD,
|
- Material.DRAGON_WALL_HEAD,
|
||||||
|
- Material.PIGLIN_HEAD,
|
||||||
|
- Material.PIGLIN_WALL_HEAD,
|
||||||
- Material.PLAYER_HEAD,
|
- Material.PLAYER_HEAD,
|
||||||
- Material.PLAYER_WALL_HEAD,
|
- Material.PLAYER_WALL_HEAD,
|
||||||
- Material.SKELETON_SKULL,
|
- Material.SKELETON_SKULL,
|
||||||
|
@ -220,6 +249,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new);
|
- register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new);
|
||||||
- register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new);
|
- register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new);
|
||||||
- register(Material.CHEST, CraftChest.class, CraftChest::new, ChestBlockEntity::new);
|
- register(Material.CHEST, CraftChest.class, CraftChest::new, ChestBlockEntity::new);
|
||||||
|
- register(Material.CHISELED_BOOKSHELF, CraftChiseledBookshelf.class, CraftChiseledBookshelf::new, ChiseledBookShelfBlockEntity::new);
|
||||||
- register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new);
|
- register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new);
|
||||||
- register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new);
|
- register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new);
|
||||||
- register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new);
|
- register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new);
|
||||||
|
@ -257,6 +287,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new);
|
+ register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new);
|
||||||
+ register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new);
|
+ register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new);
|
||||||
+ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new);
|
+ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new);
|
||||||
|
+ register(BlockEntityType.CHISELED_BOOKSHELF, CraftChiseledBookshelf.class, CraftChiseledBookshelf::new);
|
||||||
+ register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new);
|
+ register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new);
|
||||||
+ register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new);
|
+ register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new);
|
||||||
+ register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new);
|
+ register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new);
|
|
@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/core/Vec3i.java
|
--- a/src/main/java/net/minecraft/core/Vec3i.java
|
||||||
+++ b/src/main/java/net/minecraft/core/Vec3i.java
|
+++ b/src/main/java/net/minecraft/core/Vec3i.java
|
||||||
@@ -0,0 +0,0 @@ public class Vec3i implements Comparable<Vec3i> {
|
@@ -0,0 +0,0 @@ public class Vec3i implements Comparable<Vec3i> {
|
||||||
return IntStream.of(vec3i.getX(), vec3i.getY(), vec3i.getZ());
|
return IntStream.of(vec.getX(), vec.getY(), vec.getZ());
|
||||||
});
|
});
|
||||||
public static final Vec3i ZERO = new Vec3i(0, 0, 0);
|
public static final Vec3i ZERO = new Vec3i(0, 0, 0);
|
||||||
- private int x;
|
- private int x;
|
|
@ -840,19 +840,19 @@ diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.jav
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||||
@@ -0,0 +0,0 @@ public class AcquirePoi extends Behavior<PathfinderMob> {
|
@@ -0,0 +0,0 @@ public class AcquirePoi {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllClosestFirstWithType(this.poiType, predicate, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet());
|
- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllClosestFirstWithType(poiPredicate, predicate2, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet());
|
||||||
+ // Paper start - optimise POI access
|
+ // Paper start - optimise POI access
|
||||||
+ java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
|
+ java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
|
||||||
+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, this.poiType, predicate, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
|
+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
|
||||||
+ Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes);
|
+ Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes);
|
||||||
+ // Paper end - optimise POI access
|
+ // Paper end - optimise POI access
|
||||||
Path path = findPathToPois(entity, set);
|
Path path = findPathToPois(entity, set);
|
||||||
if (path != null && path.canReach()) {
|
if (path != null && path.canReach()) {
|
||||||
BlockPos blockPos = path.getTarget();
|
BlockPos blockPos = path.getTarget();
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
|
@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
||||||
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||||
// Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error
|
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
||||||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,8 +118,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
|
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
|
||||||
boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper
|
boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper
|
||||||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
int l;
|
||||||
|
|
||||||
gameprofilerfiller.popPush("iceandsnow");
|
|
||||||
if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow
|
if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow
|
||||||
- blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.getBlockRandomPos(j, 0, k, 15));
|
- blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.getBlockRandomPos(j, 0, k, 15));
|
||||||
- BlockPos blockposition1 = blockposition.below();
|
- BlockPos blockposition1 = blockposition.below();
|
||||||
|
@ -141,14 +141,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
int i1 = this.getGameRules().getInt(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT);
|
||||||
|
BlockState iblockdata;
|
||||||
|
|
||||||
+ blockposition.setY(normalY); // Paper
|
+ blockposition.setY(normalY); // Paper
|
||||||
if (biomebase.shouldSnow(this, blockposition)) {
|
if (i1 > 0 && biomebase.shouldSnow(this, blockposition)) {
|
||||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit
|
iblockdata = this.getBlockState(blockposition);
|
||||||
|
if (iblockdata.is(Blocks.SNOW)) {
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+ blockposition.setY(downY); // Paper
|
+ blockposition.setY(downY); // Paper
|
||||||
|
|
||||||
- BlockState iblockdata = this.getBlockState(blockposition1);
|
- iblockdata = this.getBlockState(blockposition1);
|
||||||
+ BlockState iblockdata = this.getBlockState(blockposition); // Paper
|
+ iblockdata = this.getBlockState(blockposition); // Paper
|
||||||
Biome.Precipitation biomebase_precipitation = biomebase.getPrecipitation();
|
Biome.Precipitation biomebase_precipitation = biomebase.getPrecipitation();
|
||||||
|
|
||||||
- if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.coldEnoughToSnow(blockposition1)) {
|
- if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.coldEnoughToSnow(blockposition1)) {
|
||||||
|
@ -167,19 +174,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
timings.chunkTicksBlocks.startTiming(); // Paper
|
timings.chunkTicksBlocks.startTiming(); // Paper
|
||||||
if (randomTickSpeed > 0) {
|
if (randomTickSpeed > 0) {
|
||||||
- LevelChunkSection[] achunksection = chunk.getSections();
|
- LevelChunkSection[] achunksection = chunk.getSections();
|
||||||
- int l = achunksection.length;
|
- int j1 = achunksection.length;
|
||||||
-
|
-
|
||||||
- for (int i1 = 0; i1 < l; ++i1) {
|
- for (int k1 = 0; k1 < j1; ++k1) {
|
||||||
- LevelChunkSection chunksection = achunksection[i1];
|
- LevelChunkSection chunksection = achunksection[k1];
|
||||||
-
|
-
|
||||||
- if (chunksection.isRandomlyTicking()) {
|
- if (chunksection.isRandomlyTicking()) {
|
||||||
- int j1 = chunksection.bottomBlockY();
|
- int l1 = chunksection.bottomBlockY();
|
||||||
-
|
-
|
||||||
- for (int k1 = 0; k1 < randomTickSpeed; ++k1) {
|
- for (l = 0; l < randomTickSpeed; ++l) {
|
||||||
- BlockPos blockposition2 = this.getBlockRandomPos(j, j1, k, 15);
|
- BlockPos blockposition2 = this.getBlockRandomPos(j, l1, k, 15);
|
||||||
-
|
-
|
||||||
- gameprofilerfiller.push("randomTick");
|
- gameprofilerfiller.push("randomTick");
|
||||||
- BlockState iblockdata1 = chunksection.getBlockState(blockposition2.getX() - j, blockposition2.getY() - j1, blockposition2.getZ() - k);
|
- BlockState iblockdata2 = chunksection.getBlockState(blockposition2.getX() - j, blockposition2.getY() - l1, blockposition2.getZ() - k);
|
||||||
+ LevelChunkSection[] sections = chunk.getSections();
|
+ LevelChunkSection[] sections = chunk.getSections();
|
||||||
+ int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
|
+ int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
|
||||||
+ for (int sectionIndex = 0; sectionIndex < sections.length; ++sectionIndex) {
|
+ for (int sectionIndex = 0; sectionIndex < sections.length; ++sectionIndex) {
|
||||||
|
@ -188,8 +195,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
- if (iblockdata1.isRandomlyTicking()) {
|
- if (iblockdata2.isRandomlyTicking()) {
|
||||||
- iblockdata1.randomTick(this, blockposition2, this.random);
|
- iblockdata2.randomTick(this, blockposition2, this.random);
|
||||||
- }
|
- }
|
||||||
+ int yPos = (sectionIndex + minSection) << 4;
|
+ int yPos = (sectionIndex + minSection) << 4;
|
||||||
+ for (int a = 0; a < randomTickSpeed; ++a) {
|
+ for (int a = 0; a < randomTickSpeed; ++a) {
|
||||||
|
@ -199,7 +206,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
- FluidState fluid = iblockdata1.getFluidState();
|
- FluidState fluid = iblockdata2.getFluidState();
|
||||||
+ long raw = section.tickingList.getRaw(index);
|
+ long raw = section.tickingList.getRaw(index);
|
||||||
+ int location = com.destroystokyo.paper.util.maplist.IBlockDataList.getLocationFromRaw(raw);
|
+ int location = com.destroystokyo.paper.util.maplist.IBlockDataList.getLocationFromRaw(raw);
|
||||||
+ int randomX = location & 15;
|
+ int randomX = location & 15;
|
||||||
|
@ -216,7 +223,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- }
|
- }
|
||||||
+ iblockdata.randomTick(this, blockposition2, this.randomTickRandom);
|
+ iblockdata.randomTick(this, blockposition2, this.randomTickRandom);
|
||||||
+ // We drop the fluid tick since LAVA is ALREADY TICKED by the above method (See LiquidBlock).
|
+ // We drop the fluid tick since LAVA is ALREADY TICKED by the above method (See LiquidBlock).
|
||||||
+ // TODO CHECK ON UPDATE
|
+ // TODO CHECK ON UPDATE (ping the Canadian)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,27 +17,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
this.compositeFunction = LootItemFunctions.compose(functions);
|
this.compositeFunction = LootItemFunctions.compose(functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ @Deprecated // Paper - preserve overstacked items
|
|
||||||
public static Consumer<ItemStack> createStackSplitter(Consumer<ItemStack> lootConsumer) {
|
|
||||||
+ // Paper start - preserve overstacked items
|
+ // Paper start - preserve overstacked items
|
||||||
+ return createStackSplitter(lootConsumer, null);
|
+ @Deprecated
|
||||||
|
public static Consumer<ItemStack> createStackSplitter(LootContext context, Consumer<ItemStack> consumer) {
|
||||||
|
+ return createStackSplitter(context, consumer, null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+ public static Consumer<ItemStack> createStackSplitter(LootContext context, Consumer<ItemStack> consumer, @org.jetbrains.annotations.Nullable net.minecraft.server.level.ServerLevel level) {
|
||||||
+ public static Consumer<ItemStack> createStackSplitter(Consumer<ItemStack> lootConsumer, @org.jetbrains.annotations.Nullable net.minecraft.server.level.ServerLevel world) {
|
+ boolean skipSplitter = level != null && !level.paperConfig().fixes.splitOverstackedLoot;
|
||||||
+ boolean skipSplitter = world != null && !world.paperConfig().fixes.splitOverstackedLoot;
|
+ // Paper end
|
||||||
+ // Paper end
|
|
||||||
return (itemstack) -> {
|
return (itemstack) -> {
|
||||||
- if (itemstack.getCount() < itemstack.getMaxStackSize()) {
|
if (itemstack.isItemEnabled(context.getLevel().enabledFeatures())) {
|
||||||
+ if (skipSplitter || itemstack.getCount() < itemstack.getMaxStackSize()) { // Paper - preserve overstacked items
|
- if (itemstack.getCount() < itemstack.getMaxStackSize()) {
|
||||||
lootConsumer.accept(itemstack);
|
+ if (skipSplitter || itemstack.getCount() < itemstack.getMaxStackSize()) { // Paper - preserve overstacked items
|
||||||
} else {
|
consumer.accept(itemstack);
|
||||||
int i = itemstack.getCount();
|
} else {
|
||||||
|
int i = itemstack.getCount();
|
||||||
|
|
||||||
|
+
|
||||||
|
while (i > 0) {
|
||||||
|
ItemStack itemstack1 = itemstack.copy();
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class LootTable {
|
@@ -0,0 +0,0 @@ public class LootTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getRandomItems(LootContext context, Consumer<ItemStack> lootConsumer) {
|
public void getRandomItems(LootContext context, Consumer<ItemStack> lootConsumer) {
|
||||||
- this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer));
|
- this.getRandomItemsRaw(context, LootTable.createStackSplitter(context, lootConsumer));
|
||||||
+ this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer, context.getLevel())); // Paper - preserve overstacked items
|
+ this.getRandomItemsRaw(context, LootTable.createStackSplitter(context, lootConsumer, context.getLevel())); // Paper - preserve overstacked items
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectArrayList<ItemStack> getRandomItems(LootContext context) {
|
public ObjectArrayList<ItemStack> getRandomItems(LootContext context) {
|
||||||
|
@ -49,8 +54,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
NonNullList<ItemStack> nonNullList = NonNullList.create();
|
NonNullList<ItemStack> nonNullList = NonNullList.create();
|
||||||
this.entries.forEach((entry) -> {
|
this.entries.forEach((entry) -> {
|
||||||
entry.expand(context, (choice) -> {
|
entry.expand(context, (choice) -> {
|
||||||
- choice.createItemStack(LootTable.createStackSplitter(nonNullList::add), context);
|
- choice.createItemStack(LootTable.createStackSplitter(context, nonNullList::add), context);
|
||||||
+ choice.createItemStack(LootTable.createStackSplitter(nonNullList::add, context.getLevel()), context); // Paper - preserve overstacked items
|
+ choice.createItemStack(LootTable.createStackSplitter(context, nonNullList::add, context.getLevel()), context); // Paper - preserve overstacked items
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
CompoundTag compoundTag = new CompoundTag();
|
CompoundTag compoundTag = new CompoundTag();
|
|
@ -8,94 +8,66 @@ diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.j
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
||||||
@@ -0,0 +0,0 @@ public class GateBehavior<E extends LivingEntity> extends Behavior<E> {
|
@@ -0,0 +0,0 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
|
||||||
|
if (this.hasRequiredMemories(entity)) {
|
||||||
|
this.status = Behavior.Status.RUNNING;
|
||||||
|
this.orderPolicy.apply(this.behaviors);
|
||||||
|
- this.runningPolicy.apply(this.behaviors.stream(), world, entity, time);
|
||||||
|
+ this.runningPolicy.apply(this.behaviors.entries, world, entity, time);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
@@ -0,0 +0,0 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canStillUse(ServerLevel world, E entity, long time) {
|
public final void tickOrStop(ServerLevel world, E entity, long time) {
|
||||||
- return this.behaviors.stream().filter((task) -> {
|
|
||||||
- return task.getStatus() == Behavior.Status.RUNNING;
|
|
||||||
- }).anyMatch((task) -> {
|
|
||||||
- return task.canStillUse(world, entity, time);
|
|
||||||
- });
|
|
||||||
+ // Paper start - remove streams
|
|
||||||
+ List<ShufflingList.WeightedEntry<Behavior<? super E>>> entries = this.behaviors.entries;
|
|
||||||
+ for (int i = 0; i < entries.size(); i++) {
|
|
||||||
+ ShufflingList.WeightedEntry<Behavior<? super E>> entry = entries.get(i);
|
|
||||||
+ Behavior<? super E> behavior = entry.getData();
|
|
||||||
+ if (behavior.getStatus() == Status.RUNNING) {
|
|
||||||
+ if (behavior.canStillUse(world, entity, time)) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ return false;
|
|
||||||
+ // Paper end - remove streams
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@@ -0,0 +0,0 @@ public class GateBehavior<E extends LivingEntity> extends Behavior<E> {
|
|
||||||
@Override
|
|
||||||
protected void start(ServerLevel world, E entity, long time) {
|
|
||||||
this.orderPolicy.apply(this.behaviors);
|
|
||||||
- this.runningPolicy.apply(this.behaviors.stream(), world, entity, time);
|
|
||||||
+ this.runningPolicy.apply(this.behaviors.entries, world, entity, time); // Paper - remove streams
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void tick(ServerLevel world, E entity, long time) {
|
|
||||||
- this.behaviors.stream().filter((task) -> {
|
- this.behaviors.stream().filter((task) -> {
|
||||||
- return task.getStatus() == Behavior.Status.RUNNING;
|
- return task.getStatus() == Behavior.Status.RUNNING;
|
||||||
- }).forEach((task) -> {
|
- }).forEach((task) -> {
|
||||||
- task.tickOrStop(world, entity, time);
|
- task.tickOrStop(world, entity, time);
|
||||||
- });
|
- });
|
||||||
+ // Paper start - remove streams
|
+ // Paper start
|
||||||
+ List<ShufflingList.WeightedEntry<Behavior<? super E>>> entries = this.behaviors.entries;
|
+ for (BehaviorControl<? super E> task : this.behaviors) {
|
||||||
+ for (int i = 0; i < entries.size(); i++) {
|
+ if (task.getStatus() == Behavior.Status.RUNNING) {
|
||||||
+ ShufflingList.WeightedEntry<Behavior<? super E>> entry = entries.get(i);
|
+ task.tickOrStop(world, entity, time);
|
||||||
+ Behavior<? super E> behavior = entry.getData();
|
|
||||||
+ if (behavior.getStatus() == Status.RUNNING) {
|
|
||||||
+ behavior.tickOrStop(world, entity, time);
|
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - remove streams
|
+ // Paper end
|
||||||
}
|
if (this.behaviors.stream().noneMatch((task) -> {
|
||||||
|
return task.getStatus() == Behavior.Status.RUNNING;
|
||||||
|
})) {
|
||||||
|
@@ -0,0 +0,0 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
|
||||||
@Override
|
@Override
|
||||||
protected void stop(ServerLevel world, E entity, long time) {
|
public final void doStop(ServerLevel world, E entity, long time) {
|
||||||
|
this.status = Behavior.Status.STOPPED;
|
||||||
- this.behaviors.stream().filter((task) -> {
|
- this.behaviors.stream().filter((task) -> {
|
||||||
- return task.getStatus() == Behavior.Status.RUNNING;
|
- return task.getStatus() == Behavior.Status.RUNNING;
|
||||||
- }).forEach((task) -> {
|
- }).forEach((task) -> {
|
||||||
- task.doStop(world, entity, time);
|
- task.doStop(world, entity, time);
|
||||||
- });
|
- });
|
||||||
+ // Paper start - remove streams
|
+ for (BehaviorControl<? super E> behavior : this.behaviors) {
|
||||||
+ List<ShufflingList.WeightedEntry<Behavior<? super E>>> entries = this.behaviors.entries;
|
+ if (behavior.getStatus() == Behavior.Status.RUNNING) {
|
||||||
+ for (int i = 0; i < entries.size(); i++) {
|
|
||||||
+ ShufflingList.WeightedEntry<Behavior<? super E>> entry = entries.get(i);
|
|
||||||
+ Behavior<? super E> behavior = entry.getData();
|
|
||||||
+ if (behavior.getStatus() == Status.RUNNING) {
|
|
||||||
+ behavior.doStop(world, entity, time);
|
+ behavior.doStop(world, entity, time);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - remove streams
|
|
||||||
this.exitErasedMemories.forEach(entity.getBrain()::eraseMemory);
|
this.exitErasedMemories.forEach(entity.getBrain()::eraseMemory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class GateBehavior<E extends LivingEntity> extends Behavior<E> {
|
@@ -0,0 +0,0 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
|
||||||
public static enum RunningPolicy {
|
public static enum RunningPolicy {
|
||||||
RUN_ONE {
|
RUN_ONE {
|
||||||
@Override
|
@Override
|
||||||
- public <E extends LivingEntity> void apply(Stream<Behavior<? super E>> tasks, ServerLevel world, E entity, long time) {
|
- public <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time) {
|
||||||
- tasks.filter((task) -> {
|
- tasks.filter((task) -> {
|
||||||
- return task.getStatus() == Behavior.Status.STOPPED;
|
- return task.getStatus() == Behavior.Status.STOPPED;
|
||||||
- }).filter((task) -> {
|
- }).filter((task) -> {
|
||||||
- return task.tryStart(world, entity, time);
|
- return task.tryStart(world, entity, time);
|
||||||
- }).findFirst();
|
- }).findFirst();
|
||||||
+ // Paper start - remove streams
|
+ // Paper start - remove streams
|
||||||
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<Behavior<? super E>>> tasks, ServerLevel world, E entity, long time) {
|
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time) {
|
||||||
+ for (int i = 0; i < tasks.size(); i++) {
|
+ for (ShufflingList.WeightedEntry<BehaviorControl<? super E>> task : tasks) {
|
||||||
+ ShufflingList.WeightedEntry<Behavior<? super E>> task = tasks.get(i);
|
+ final BehaviorControl<? super E> behavior = task.getData();
|
||||||
+ Behavior<? super E> behavior = task.getData();
|
+ if (behavior.getStatus() == Behavior.Status.STOPPED && behavior.tryStart(world, entity, time)) {
|
||||||
+ if (behavior.getStatus() == Status.STOPPED && behavior.tryStart(world, entity, time)) {
|
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
@ -104,18 +76,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
},
|
},
|
||||||
TRY_ALL {
|
TRY_ALL {
|
||||||
@Override
|
@Override
|
||||||
- public <E extends LivingEntity> void apply(Stream<Behavior<? super E>> tasks, ServerLevel world, E entity, long time) {
|
- public <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time) {
|
||||||
- tasks.filter((task) -> {
|
- tasks.filter((task) -> {
|
||||||
- return task.getStatus() == Behavior.Status.STOPPED;
|
- return task.getStatus() == Behavior.Status.STOPPED;
|
||||||
- }).forEach((task) -> {
|
- }).forEach((task) -> {
|
||||||
- task.tryStart(world, entity, time);
|
- task.tryStart(world, entity, time);
|
||||||
- });
|
- });
|
||||||
+ // Paper start - remove streams
|
+ // Paper start - remove streams
|
||||||
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<Behavior<? super E>>> tasks, ServerLevel world, E entity, long time) {
|
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time) {
|
||||||
+ for (int i = 0; i < tasks.size(); i++) {
|
+ for (ShufflingList.WeightedEntry<BehaviorControl<? super E>> task : tasks) {
|
||||||
+ ShufflingList.WeightedEntry<Behavior<? super E>> task = tasks.get(i);
|
+ final BehaviorControl<? super E> behavior = task.getData();
|
||||||
+ Behavior<? super E> behavior = task.getData();
|
+ if (behavior.getStatus() == Behavior.Status.STOPPED) {
|
||||||
+ if (behavior.getStatus() == Status.STOPPED) {
|
|
||||||
+ behavior.tryStart(world, entity, time);
|
+ behavior.tryStart(world, entity, time);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
@ -123,8 +94,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
- public abstract <E extends LivingEntity> void apply(Stream<Behavior<? super E>> tasks, ServerLevel world, E entity, long time);
|
- public abstract <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time);
|
||||||
+ public abstract <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<Behavior<? super E>>> tasks, ServerLevel world, E entity, long time); // Paper - remove streams
|
+ public abstract <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time); // Paper - remove streams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
||||||
|
@ -134,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ import java.util.stream.Stream;
|
@@ -0,0 +0,0 @@ import java.util.stream.Stream;
|
||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
|
|
||||||
public class ShufflingList<U> {
|
public class ShufflingList<U> implements Iterable<U> {
|
||||||
- protected final List<ShufflingList.WeightedEntry<U>> entries;
|
- protected final List<ShufflingList.WeightedEntry<U>> entries;
|
||||||
+ public final List<ShufflingList.WeightedEntry<U>> entries; // Paper - public
|
+ public final List<ShufflingList.WeightedEntry<U>> entries; // Paper - public
|
||||||
private final RandomSource random = RandomSource.create();
|
private final RandomSource random = RandomSource.create();
|
|
@ -9,14 +9,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java
|
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java
|
||||||
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
|
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
|
||||||
@@ -0,0 +0,0 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
|
@@ -0,0 +0,0 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
|
||||||
this.namespace = StringUtils.isEmpty(id[0]) ? "minecraft" : id[0];
|
|
||||||
this.path = id[1];
|
|
||||||
if (!isValidNamespace(this.namespace)) {
|
|
||||||
- throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + this.namespace + ":" + this.path);
|
|
||||||
+ throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(this.namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(this.path)); // Paper
|
|
||||||
} else if (!isValidPath(this.path)) {
|
|
||||||
- throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + this.namespace + ":" + this.path);
|
|
||||||
+ throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + this.namespace + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(this.path)); // Paper
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private static String assertValidNamespace(String namespace, String path) {
|
||||||
|
if (!isValidNamespace(namespace)) {
|
||||||
|
- throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + namespace + ":" + path);
|
||||||
|
+ throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper
|
||||||
|
} else {
|
||||||
|
return namespace;
|
||||||
|
}
|
||||||
|
@@ -0,0 +0,0 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
|
||||||
|
|
||||||
|
private static String assertValidPath(String namespace, String path) {
|
||||||
|
if (!isValidPath(path)) {
|
||||||
|
- throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + namespace + ":" + path);
|
||||||
|
+ throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + namespace + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper
|
||||||
|
} else {
|
||||||
|
return path;
|
||||||
|
}
|
|
@ -344,7 +344,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListene
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
|
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
SecretKey secretkey = packet.getSecretKey(privatekey);
|
SecretKey secretkey = packet.getSecretKey(privatekey);
|
|
@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ this.serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings());
|
+ this.serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings());
|
||||||
+ this.serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save());
|
+ this.serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save());
|
||||||
+ this.convertable.saveDataTag(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
|
+ this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
|
@@ -0,0 +0,0 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||||
if (!world.isClientSide) {
|
if (!world.isClientSide && player.canUseGameMasterBlocks()) {
|
||||||
+ if (player.getItemInHand(hand).getItem() != Items.LIGHT || !player.mayInteract(world, pos) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return InteractionResult.FAIL; } // Paper
|
+ if (player.getItemInHand(hand).getItem() != Items.LIGHT || !player.mayInteract(world, pos) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return InteractionResult.FAIL; } // Paper
|
||||||
world.setBlock(pos, state.cycle(LEVEL), 2);
|
world.setBlock(pos, state.cycle(LEVEL), 2);
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
|
@ -1,45 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
|
||||||
Date: Sat, 16 Oct 2021 17:38:35 -0700
|
|
||||||
Subject: [PATCH] Use correct LevelStem registry when loading default
|
|
||||||
end/nether
|
|
||||||
|
|
||||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/resources/RegistryLoader.java b/src/main/java/net/minecraft/resources/RegistryLoader.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/resources/RegistryLoader.java
|
|
||||||
+++ b/src/main/java/net/minecraft/resources/RegistryLoader.java
|
|
||||||
@@ -0,0 +0,0 @@ public class RegistryLoader {
|
|
||||||
RegistryLoader.ReadCache<E> readCache = this.readCache(registryRef);
|
|
||||||
DataResult<Holder<E>> dataResult = readCache.values.get(entryKey);
|
|
||||||
if (dataResult != null) {
|
|
||||||
+ // Paper start - register in registry due to craftbukkit running this 3 times instead of once
|
|
||||||
+ if (registryRef == (ResourceKey) Registry.LEVEL_STEM_REGISTRY && dataResult.result().isPresent()) {
|
|
||||||
+ // OptionalInt.empty() because the LevelStem registry is only loaded from the resource manager, not the InMemory resource access
|
|
||||||
+ registry.registerOrOverride(java.util.OptionalInt.empty(), entryKey, dataResult.result().get().value(), dataResult.lifecycle());
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
return dataResult;
|
|
||||||
} else {
|
|
||||||
Holder<E> holder = registry.getOrCreateHolderOrThrow(entryKey);
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
||||||
long i = generatorsettings.seed();
|
|
||||||
long j = BiomeManager.obfuscateSeed(i);
|
|
||||||
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver));
|
|
||||||
- LevelStem worlddimension = (LevelStem) iregistry.get(dimensionKey);
|
|
||||||
+ // Paper start - Use correct LevelStem registry
|
|
||||||
+ final LevelStem worlddimension;
|
|
||||||
+ if (dimensionKey == LevelStem.END || dimensionKey == LevelStem.NETHER) {
|
|
||||||
+ worlddimension = generatorsettings.dimensions().get(dimensionKey);
|
|
||||||
+ } else {
|
|
||||||
+ worlddimension = iregistry.get(dimensionKey);
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.typeHolder().value());
|
|
||||||
if (biomeProvider == null && gen != null) {
|
|
Loading…
Reference in a new issue