From be922367c3272fe6ec5fd54fcccaaa339f976261 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 13 Aug 2024 10:44:34 +0200 Subject: [PATCH] Merge Patches --- .../1047-Initialisation-improvements.patch | 717 ------------------ ...vements-II.patch => 1047-SW-Patches.patch} | 685 +++++++++++++++-- 2 files changed, 639 insertions(+), 763 deletions(-) delete mode 100644 patches/server/1047-Initialisation-improvements.patch rename patches/server/{1048-Initialisation-improvements-II.patch => 1047-SW-Patches.patch} (96%) diff --git a/patches/server/1047-Initialisation-improvements.patch b/patches/server/1047-Initialisation-improvements.patch deleted file mode 100644 index da412ca690..0000000000 --- a/patches/server/1047-Initialisation-improvements.patch +++ /dev/null @@ -1,717 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lixfel -Date: Wed, 1 Feb 2023 21:36:57 +0100 -Subject: [PATCH] Initialisation improvements - - -diff --git a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java -index 660b2ec6b63a4ceffee44ab11f54dfa7c0d0996f..81902d28ac96cebb98d66bf5a4ff4237bf00d181 100644 ---- a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java -+++ b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java -@@ -92,7 +92,7 @@ public enum VersionHistoryManager { - )) { - gson.toJson(currentData, writer); - } catch (final IOException e) { -- logger.log(Level.SEVERE, "Failed to write to version history file", e); -+ //logger.log(Level.SEVERE, "Failed to write to version history file", e); - } - } - -diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java -index 87e5f614ba988547a827486740db217e28585773..c83eae306debfe34fb6383cb83a3dad0f74431a4 100644 ---- a/src/main/java/io/papermc/paper/configuration/Configurations.java -+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java -@@ -114,7 +114,7 @@ public abstract class Configurations { - loader.save(node); - } catch (ConfigurateException ex) { - if (ex.getCause() instanceof AccessDeniedException) { -- LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex); -+ //LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex); - } else throw ex; - } - } -diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index 783eac6e458c6f1a0584301fb84a2fe341868f34..ec2194d292f79ea66a2b85835189f270cb727f9f 100644 ---- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -@@ -459,8 +459,6 @@ public class PaperConfigurations extends Configurations mappingsByMojangName; - - ObfHelper() { -- final @Nullable Set maps = loadMappingsIfPresent(); -+ final @Nullable Set maps = null; - if (maps != null) { - this.mappingsByObfName = maps.stream().collect(Collectors.toUnmodifiableMap(ClassMapping::obfName, map -> map)); - this.mappingsByMojangName = maps.stream().collect(Collectors.toUnmodifiableMap(ClassMapping::mojangName, map -> map)); -diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 1d1e76de60e40224f5cb81893f9ee50fe987badb..1c0db35868d76f873c187a6e9191dfe15b80b58f 100644 ---- a/src/main/java/net/minecraft/commands/Commands.java -+++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -156,65 +156,63 @@ public class Commands { - - public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) { - // Paper -- AdvancementCommands.register(this.dispatcher); -- AttributeCommand.register(this.dispatcher, commandRegistryAccess); -- ExecuteCommand.register(this.dispatcher, commandRegistryAccess); -- BossBarCommands.register(this.dispatcher, commandRegistryAccess); -+ //AdvancementCommands.register(this.dispatcher); -+ //AttributeCommand.register(this.dispatcher, commandRegistryAccess); -+ //ExecuteCommand.register(this.dispatcher, commandRegistryAccess); -+ //BossBarCommands.register(this.dispatcher, commandRegistryAccess); - ClearInventoryCommands.register(this.dispatcher, commandRegistryAccess); -- CloneCommands.register(this.dispatcher, commandRegistryAccess); -- DamageCommand.register(this.dispatcher, commandRegistryAccess); -- DataCommands.register(this.dispatcher); -- DataPackCommand.register(this.dispatcher); -- DebugCommand.register(this.dispatcher); -- DefaultGameModeCommands.register(this.dispatcher); -- DifficultyCommand.register(this.dispatcher); -+ //CloneCommands.register(this.dispatcher, commandRegistryAccess); -+ //DamageCommand.register(this.dispatcher, commandRegistryAccess); -+ //DataCommands.register(this.dispatcher); -+ //DataPackCommand.register(this.dispatcher); -+ //DebugCommand.register(this.dispatcher); -+ //DefaultGameModeCommands.register(this.dispatcher); -+ //DifficultyCommand.register(this.dispatcher); - EffectCommands.register(this.dispatcher, commandRegistryAccess); -- EmoteCommands.register(this.dispatcher); -+ //EmoteCommands.register(this.dispatcher); - EnchantCommand.register(this.dispatcher, commandRegistryAccess); -- ExperienceCommand.register(this.dispatcher); -- FillCommand.register(this.dispatcher, commandRegistryAccess); -+ //ExperienceCommand.register(this.dispatcher); -+ //FillCommand.register(this.dispatcher, commandRegistryAccess); - FillBiomeCommand.register(this.dispatcher, commandRegistryAccess); -- ForceLoadCommand.register(this.dispatcher); -- FunctionCommand.register(this.dispatcher); -+ //ForceLoadCommand.register(this.dispatcher); -+ //FunctionCommand.register(this.dispatcher); - GameModeCommand.register(this.dispatcher); - GameRuleCommand.register(this.dispatcher); - GiveCommand.register(this.dispatcher, commandRegistryAccess); -- HelpCommand.register(this.dispatcher); -- ItemCommands.register(this.dispatcher, commandRegistryAccess); -+ //HelpCommand.register(this.dispatcher); -+ //ItemCommands.register(this.dispatcher, commandRegistryAccess); - KickCommand.register(this.dispatcher); - KillCommand.register(this.dispatcher); -- ListPlayersCommand.register(this.dispatcher); -- LocateCommand.register(this.dispatcher, commandRegistryAccess); -- LootCommand.register(this.dispatcher, commandRegistryAccess); -- MsgCommand.register(this.dispatcher); -- ParticleCommand.register(this.dispatcher, commandRegistryAccess); -- PlaceCommand.register(this.dispatcher); -- PlaySoundCommand.register(this.dispatcher); -- RandomCommand.register(this.dispatcher); -- ReloadCommand.register(this.dispatcher); -- RecipeCommand.register(this.dispatcher); -- ReturnCommand.register(this.dispatcher); -- RideCommand.register(this.dispatcher); -- SayCommand.register(this.dispatcher); -- ScheduleCommand.register(this.dispatcher); -- ScoreboardCommand.register(this.dispatcher, commandRegistryAccess); -- SeedCommand.register(this.dispatcher, environment != Commands.CommandSelection.INTEGRATED); -- SetBlockCommand.register(this.dispatcher, commandRegistryAccess); -- SetSpawnCommand.register(this.dispatcher); -+ ListPlayersCommand.register(this.dispatcher); //LocateCommand.register(this.dispatcher, commandRegistryAccess); -+ //LootCommand.register(this.dispatcher, commandRegistryAccess); -+ //MsgCommand.register(this.dispatcher); -+ //ParticleCommand.register(this.dispatcher, commandRegistryAccess); -+ //PlaceCommand.register(this.dispatcher); -+ //PlaySoundCommand.register(this.dispatcher); -+ //ReloadCommand.register(this.dispatcher); -+ //RecipeCommand.register(this.dispatcher); -+ //ReturnCommand.register(this.dispatcher); -+ //RideCommand.register(this.dispatcher); -+ //SayCommand.register(this.dispatcher); -+ //ScheduleCommand.register(this.dispatcher); -+ //ScoreboardCommand.register(this.dispatcher); -+ //SeedCommand.register(this.dispatcher, environment != Commands.CommandSelection.INTEGRATED); -+ //SetBlockCommand.register(this.dispatcher, commandRegistryAccess); -+ //SetSpawnCommand.register(this.dispatcher); - SetWorldSpawnCommand.register(this.dispatcher); - SpectateCommand.register(this.dispatcher); -- SpreadPlayersCommand.register(this.dispatcher); -- StopSoundCommand.register(this.dispatcher); -+ //SpreadPlayersCommand.register(this.dispatcher); -+ //StopSoundCommand.register(this.dispatcher); - SummonCommand.register(this.dispatcher, commandRegistryAccess); -- TagCommand.register(this.dispatcher); -- TeamCommand.register(this.dispatcher, commandRegistryAccess); -- TeamMsgCommand.register(this.dispatcher); -+ //TagCommand.register(this.dispatcher); -+ //TeamCommand.register(this.dispatcher, commandRegistryAccess); -+ //TeamMsgCommand.register(this.dispatcher); - TeleportCommand.register(this.dispatcher); -- TellRawCommand.register(this.dispatcher, commandRegistryAccess); -+ //TellRawCommand.register(this.dispatcher, commandRegistryAccess); - TickCommand.register(this.dispatcher); - TimeCommand.register(this.dispatcher); -- TitleCommand.register(this.dispatcher, commandRegistryAccess); -- TriggerCommand.register(this.dispatcher); -+ //TitleCommand.register(this.dispatcher, commandRegistryAccess); -+ //TriggerCommand.register(this.dispatcher); - WeatherCommand.register(this.dispatcher); - WorldBorderCommand.register(this.dispatcher); - if (JvmProfiler.INSTANCE.isAvailable()) { -@@ -235,18 +233,18 @@ public class Commands { - } - - if (environment.includeDedicated) { -- BanIpCommands.register(this.dispatcher); -- BanListCommands.register(this.dispatcher); -- BanPlayerCommands.register(this.dispatcher); -- DeOpCommands.register(this.dispatcher); -- OpCommand.register(this.dispatcher); -- PardonCommand.register(this.dispatcher); -- PardonIpCommand.register(this.dispatcher); -- PerfCommand.register(this.dispatcher); -+ //BanIpCommands.register(this.dispatcher); -+ //BanListCommands.register(this.dispatcher); -+ //BanPlayerCommands.register(this.dispatcher); -+ //DeOpCommands.register(this.dispatcher); -+ //OpCommand.register(this.dispatcher); -+ //PardonCommand.register(this.dispatcher); -+ //PardonIpCommand.register(this.dispatcher); -+ //PerfCommand.register(this.dispatcher); - SaveAllCommand.register(this.dispatcher); - SaveOffCommand.register(this.dispatcher); - SaveOnCommand.register(this.dispatcher); -- SetPlayerIdleTimeoutCommand.register(this.dispatcher); -+ //SetPlayerIdleTimeoutCommand.register(this.dispatcher); - StopCommand.register(this.dispatcher); - TransferCommand.register(this.dispatcher); - WhitelistCommand.register(this.dispatcher); -diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index dd56c8e041116ef3602a9f89c998c8208ab89b51..d3dbc896d611f0f719bb257c01789e1fdae751b0 100644 ---- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -18,6 +18,7 @@ import java.util.Collections; - import java.util.List; - import java.util.Locale; - import java.util.Optional; -+import java.util.concurrent.ExecutionException; - import java.util.function.BooleanSupplier; - import javax.annotation.Nullable; - import net.minecraft.DefaultUncaughtExceptionHandler; -@@ -223,6 +224,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - // Spigot end - io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc. - // Paper start - initialize global and world-defaults configuration -+ try { -+ Main.paperConfig.get(); -+ } catch (InterruptedException e) { -+ Thread.currentThread().interrupt(); -+ } catch (ExecutionException e) { -+ throw new IOException(e); -+ } - this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); - this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); - // Paper end - initialize global and world-defaults configuration -diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java -index c038da20b76c0b7b1c18471b20be01e849d29f3a..f5611bf250aaa2851ca8873291c7f4b6c3771281 100644 ---- a/src/main/java/net/minecraft/server/players/StoredUserList.java -+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java -@@ -9,10 +9,8 @@ import com.google.gson.JsonArray; - import com.google.gson.JsonElement; - import com.google.gson.JsonObject; - import com.mojang.logging.LogUtils; --import java.io.BufferedReader; --import java.io.BufferedWriter; --import java.io.File; --import java.io.IOException; -+ -+import java.io.*; - import java.nio.charset.StandardCharsets; - import java.util.Collection; - import java.util.Iterator; -@@ -114,7 +112,12 @@ public abstract class StoredUserList> { - - Objects.requireNonNull(jsonarray); - stream.forEach(jsonarray::add); -- BufferedWriter bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8); -+ BufferedWriter bufferedwriter; -+ try { -+ bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8); -+ } catch (FileNotFoundException e) { -+ return; -+ } - - try { - StoredUserList.GSON.toJson(jsonarray, StoredUserList.GSON.newJsonWriter(bufferedwriter)); -diff --git a/src/main/java/net/minecraft/world/level/biome/Climate.java b/src/main/java/net/minecraft/world/level/biome/Climate.java -index f06a35024af284addf41dfe160849e8e5e15e822..466e4d8f2ce9ce672c498d5e4080ea099995721b 100644 ---- a/src/main/java/net/minecraft/world/level/biome/Climate.java -+++ b/src/main/java/net/minecraft/world/level/biome/Climate.java -@@ -258,7 +258,15 @@ public class Climate { - this.root = firstNode; - } - -+ private static final List>> cache = new ArrayList<>(4); -+ - public static Climate.RTree create(List> entries) { -+ for(Pair> value : cache) { -+ if(value.getFirst().equals(entries)) -+ return (RTree) value.getSecond(); -+ } -+ //System.out.println("Entries " + entries.size() + " " + entries.hashCode()); -+ - if (entries.isEmpty()) { - throw new IllegalArgumentException("Need at least one value to build the search tree."); - } else { -@@ -266,10 +274,10 @@ public class Climate { - if (i != 7) { - throw new IllegalStateException("Expecting parameter space to be 7, got " + i); - } else { -- List> list = entries.stream() -- .map(entry -> new Climate.RTree.Leaf(entry.getFirst(), entry.getSecond())) -- .collect(Collectors.toCollection(ArrayList::new)); -- return new Climate.RTree<>(build(i, list)); -+ List> list = entries.stream().map(entry -> new Leaf<>(entry.getFirst(), entry.getSecond())).collect(Collectors.toCollection(ArrayList::new)); -+ RTree tree = new RTree<>(build(i, list)); -+ cache.add(Pair.of(entries, tree)); -+ return tree; - } - } - } -diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java -index 223259e7a09ada681b6181c898f6857888594f85..475cd0583e99495ca0df665da19cc382a8d5e7ea 100644 ---- a/src/main/java/net/minecraft/world/level/block/Blocks.java -+++ b/src/main/java/net/minecraft/world/level/block/Blocks.java -@@ -1,7 +1,9 @@ - package net.minecraft.world.level.block; - -+import java.util.concurrent.ExecutorService; - import java.util.function.Function; - import java.util.function.ToIntFunction; -+import net.minecraft.Util; - import javax.annotation.Nullable; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; -@@ -7797,7 +7799,8 @@ public class Blocks { - } - - public static void rebuildCache() { -- Block.BLOCK_STATE_REGISTRY.forEach(BlockBehaviour.BlockStateBase::initCache); -+ ExecutorService executor = Util.backgroundExecutor(); -+ Block.BLOCK_STATE_REGISTRY.forEach(b -> executor.submit(b::initCache)); - } - - static { -diff --git a/src/main/java/net/minecraft/world/level/block/WallBlock.java b/src/main/java/net/minecraft/world/level/block/WallBlock.java -index 83956032bef4d34eddb9899f0a2847e66bfd83f4..24eb3b5c805a5df9b029b4a2a98f2a3720065e5e 100644 ---- a/src/main/java/net/minecraft/world/level/block/WallBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/WallBlock.java -@@ -35,8 +35,14 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { - public static final EnumProperty SOUTH_WALL = BlockStateProperties.SOUTH_WALL; - public static final EnumProperty WEST_WALL = BlockStateProperties.WEST_WALL; - public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; -- private final Map shapeByIndex; -- private final Map collisionShapeByIndex; -+ private static final Map, Comparable>, VoxelShape> shapeByIndex; -+ private static final Map, Comparable>, VoxelShape> collisionShapeByIndex; -+ -+ static { -+ shapeByIndex = makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 14.0F, 16.0F); -+ collisionShapeByIndex = makeShapes(4.0F, 3.0F, 24.0F, 0.0F, 24.0F, 24.0F); -+ } -+ - private static final int WALL_WIDTH = 3; - private static final int WALL_HEIGHT = 14; - private static final int POST_WIDTH = 4; -@@ -78,7 +84,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { - } - } - -- private Map makeShapes(float f, float g, float h, float i, float j, float k) { -+ private static Map, Comparable>, VoxelShape> makeShapes(float f, float g, float h, float i, float j, float k) { - float l = 8.0F - f; - float m = 8.0F + f; - float n = 8.0F - g; -@@ -92,7 +98,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { - VoxelShape voxelShape7 = Block.box((double)n, (double)i, (double)n, (double)o, (double)k, 16.0); - VoxelShape voxelShape8 = Block.box(0.0, (double)i, (double)n, (double)o, (double)k, (double)o); - VoxelShape voxelShape9 = Block.box((double)n, (double)i, (double)n, 16.0, (double)k, (double)o); -- Builder builder = ImmutableMap.builder(); -+ Builder, Comparable>, VoxelShape> builder = ImmutableMap.builder(); - - for (Boolean boolean_ : UP.getPossibleValues()) { - for (WallSide wallSide : EAST_WALL.getPossibleValues()) { -@@ -114,8 +120,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { - .setValue(WEST_WALL, wallSide3) - .setValue(NORTH_WALL, wallSide2) - .setValue(SOUTH_WALL, wallSide4); -- builder.put(blockState.setValue(WATERLOGGED, Boolean.valueOf(false)), voxelShape10); -- builder.put(blockState.setValue(WATERLOGGED, Boolean.valueOf(true)), voxelShape10); -+ builder.put(ImmutableMap.of(UP, boolean_, EAST_WALL, wallSide, WEST_WALL, wallSide3, NORTH_WALL, wallSide2, SOUTH_WALL, wallSide4, WATERLOGGED, Boolean.FALSE), voxelShape10); -+ builder.put(ImmutableMap.of(UP, boolean_, EAST_WALL, wallSide, WEST_WALL, wallSide3, NORTH_WALL, wallSide2, SOUTH_WALL, wallSide4, WATERLOGGED, Boolean.TRUE), voxelShape10); - } - } - } -@@ -127,12 +133,12 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { - - @Override - protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { -- return this.shapeByIndex.get(state); -+ return shapeByIndex.get(state.getValues()); - } - - @Override - protected VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { -- return this.collisionShapeByIndex.get(state); -+ return collisionShapeByIndex.get(state.getValues()); - } - - @Override -diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index ded6d148110fe3fbb6272ce44582a28472dd49a6..16fe0554f38665cd652eef8fe693371c5de4542a 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -77,6 +77,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; - import net.minecraft.world.phys.AABB; - import net.minecraft.world.phys.BlockHitResult; - import net.minecraft.world.phys.Vec3; -+import net.minecraft.world.phys.shapes.BooleanOp; - import net.minecraft.world.phys.shapes.CollisionContext; - import net.minecraft.world.phys.shapes.Shapes; - import net.minecraft.world.phys.shapes.VoxelShape; -@@ -1435,7 +1436,7 @@ public abstract class BlockBehaviour implements FeatureElement { - } - } - -- this.isCollisionShapeFullBlock = Block.isShapeFullBlock(state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); -+ this.isCollisionShapeFullBlock = !Shapes.joinIsNotEmpty(Shapes.block(), state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO), BooleanOp.NOT_SAME); //Block.isShapeFullBlock(state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); - } - } - -diff --git a/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java b/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java -index 46af72761c0bfbc10c14d78c855255969e2cf8a3..0df8011cd0809045986179e49ef7e2f459168f07 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java -+++ b/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java -@@ -11,10 +11,8 @@ import com.mojang.serialization.Decoder; - import com.mojang.serialization.Encoder; - import com.mojang.serialization.MapCodec; - import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; --import java.util.Collection; --import java.util.Collections; --import java.util.List; --import java.util.Map; -+ -+import java.util.*; - import java.util.Map.Entry; - import java.util.function.Function; - import java.util.function.Supplier; -@@ -22,7 +20,8 @@ import java.util.regex.Pattern; - import java.util.stream.Collectors; - import java.util.stream.Stream; - import javax.annotation.Nullable; --import net.minecraft.world.level.block.state.properties.Property; -+ -+import net.minecraft.world.level.block.state.properties.*; - - public class StateDefinition> { - static final Pattern NAME_PATTERN = Pattern.compile("^[a-z0-9_]+$"); -@@ -41,7 +40,6 @@ public class StateDefinition> { - } - - MapCodec mapCodec2 = mapCodec; -- Map, Comparable>, S> map = Maps.newLinkedHashMap(); - List list = Lists.newArrayList(); - Stream, Comparable>>> stream = Stream.of(Collections.emptyList()); - -@@ -53,6 +51,7 @@ public class StateDefinition> { - })); - } - -+ NeighbourTable table = new NeighbourTable<>(propertiesMap); - stream.forEach(list2 -> { - Reference2ObjectArrayMap, Comparable> reference2ObjectArrayMap = new Reference2ObjectArrayMap<>(list2.size()); - -@@ -61,13 +60,10 @@ public class StateDefinition> { - } - - S stateHolderx = factory.create(owner, reference2ObjectArrayMap, mapCodec2); -- map.put(reference2ObjectArrayMap, stateHolderx); - list.add(stateHolderx); -- }); - -- for (S stateHolder : list) { -- stateHolder.populateNeighbours(map); -- } -+ stateHolder.populateNeighbours(table, table.put(immutableMap, stateHolder)); -+ }); - - this.states = ImmutableList.copyOf(list); - } -@@ -157,4 +153,60 @@ public class StateDefinition> { - public interface Factory { - S create(O owner, Reference2ObjectArrayMap, Comparable> propertyMap, MapCodec codec); - } -+ -+ public static class NeighbourTable { -+ private final Map, Pair> offsetMasks; -+ private final Object[] array; -+ -+ public NeighbourTable(Map> propertiesMap) { -+ offsetMasks = new IdentityHashMap<>(propertiesMap.size()); -+ int offset = 0; -+ for(Property property : propertiesMap.values()) { -+ int bits = Integer.SIZE - Integer.numberOfLeadingZeros((property instanceof EnumProperty ? property.getValueClass().getEnumConstants().length : property.getPossibleValues().size()) - 1); -+ offsetMasks.put(property, Pair.of(offset, ~(((1<, Comparable> key, S value) { -+ int index = 0; -+ for(Map.Entry, Comparable> k : key.entrySet()) { -+ index = setIndex(index, k.getKey(), k.getValue()); -+ } -+ array[index] = value; -+ return index; -+ } -+ -+ private int setIndex(int index, Property property, Comparable value) { -+ Pair offsetMask = offsetMasks.get(property); -+ if(property instanceof BooleanProperty) { -+ return index | (((Boolean)value) ? 1 : 0) << offsetMask.getFirst(); -+ } else if(property instanceof EnumProperty) { -+ return index | ((Enum)value).ordinal() << offsetMask.getFirst(); -+ } else if(property instanceof IntegerProperty intProperty) { -+ return index | (((Integer)value) - intProperty.min) << offsetMask.getFirst(); -+ } else { -+ throw new IllegalArgumentException("Unknown property type " + property.getClass().getName()); -+ } -+ } -+ -+ public S getNeighbour(int index, Property property, Comparable value) { -+ return (S)array[modIndex(index, property, value)]; -+ } -+ -+ private int modIndex(int index, Property property, Comparable value) { -+ Pair offsetMask = offsetMasks.get(property); -+ if(property instanceof BooleanProperty) { -+ return (index & offsetMask.getSecond()) | (((Boolean)value) ? 1 : 0) << offsetMask.getFirst(); -+ } else if(property instanceof EnumProperty) { -+ return (index & offsetMask.getSecond()) | ((Enum)value).ordinal() << offsetMask.getFirst(); -+ } else if(property instanceof IntegerProperty intProperty) { -+ return (index & offsetMask.getSecond()) | (((Integer)value) - intProperty.min) << offsetMask.getFirst(); -+ } else { -+ throw new IllegalArgumentException("Unknown property type " + property.getClass().getName()); -+ } -+ } -+ } - } -diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -index 45744d86e9582a93a0cec26009deea091080fbbe..7e2ecb0457150dedc665f05c6c8ad068c00e3642 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -+++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -@@ -37,15 +37,14 @@ public abstract class StateHolder { - }; - protected final O owner; - private final Reference2ObjectArrayMap, Comparable> values; -- private Table, Comparable, S> neighbours; - protected final MapCodec propertiesCodec; -- protected final io.papermc.paper.util.table.ZeroCollidingReferenceStateTable optimisedTable; // Paper - optimise state lookup -+ private StateDefinition.NeighbourTable neighbourTable; -+ private int neighbourIndex; - - protected StateHolder(O owner, Reference2ObjectArrayMap, Comparable> propertyMap, MapCodec codec) { - this.owner = owner; - this.values = propertyMap; - this.propertiesCodec = codec; -- this.optimisedTable = new io.papermc.paper.util.table.ZeroCollidingReferenceStateTable(this, propertyMap); // Paper - optimise state lookup - } - - public > S cycle(Property property) { -@@ -86,11 +85,11 @@ public abstract class StateHolder { - } - - public > boolean hasProperty(Property property) { -- return this.optimisedTable.get(property) != null; // Paper - optimise state lookup -+ return this.values.containsKey(property); - } - - public > T getValue(Property property) { -- Comparable comparable = this.optimisedTable.get(property); // Paper - optimise state lookup -+ Comparable comparable = this.values.get(property); - if (comparable == null) { - throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner); - } else { -@@ -99,52 +98,26 @@ public abstract class StateHolder { - } - - public > Optional getOptionalValue(Property property) { -- Comparable comparable = this.optimisedTable.get(property); // Paper - optimise state lookup -+ Comparable comparable = this.values.get(property); - return comparable == null ? Optional.empty() : Optional.of(property.getValueClass().cast(comparable)); - } - - public , V extends T> S setValue(Property property, V value) { -- // Paper start - optimise state lookup -- final S ret = (S)this.optimisedTable.get(property, value); -- if (ret == null) { -- throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); -- } -- return ret; -- // Paper end - optimise state lookup -+ return this.neighbourTable.getNeighbour(this.neighbourIndex, property, value); - } - - public , V extends T> S trySetValue(Property property, V value) { - Comparable comparable = this.values.get(property); - if (comparable != null && !comparable.equals(value)) { -- S object = this.neighbours.get(property, value); -- if (object == null) { -- throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); -- } else { -- return object; -- } -+ return this.neighbourTable.getNeighbour(this.neighbourIndex, property, value); - } else { - return (S)this; - } - } - -- public void populateNeighbours(Map, Comparable>, S> states) { -- if (this.neighbours != null) { -- throw new IllegalStateException(); -- } else { -- Table, Comparable, S> table = HashBasedTable.create(); -- -- for (Entry, Comparable> entry : this.values.entrySet()) { -- Property property = entry.getKey(); -- -- for (Comparable comparable : property.getPossibleValues()) { -- if (!comparable.equals(entry.getValue())) { -- table.put(property, comparable, states.get(this.makeNeighbourValues(property, comparable))); -- } -- } -- } -- -- this.neighbours = (Table, Comparable, S>)(table.isEmpty() ? table : ArrayTable.create(table)); this.optimisedTable.loadInTable((Table)this.neighbours, this.values); // Paper - optimise state lookup -- } -+ public void populateNeighbours(StateDefinition.NeighbourTable states, int ownIndex) { -+ this.neighbourTable = states; -+ this.neighbourIndex = ownIndex; - } - - private Map, Comparable> makeNeighbourValues(Property property, Comparable value) { -diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java -index 427ee4d6f12a7abd8da0c65e0b9081b25824df40..4c2ad01150972940688cb8301fc84a210844c48f 100644 ---- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java -+++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java -@@ -507,7 +507,6 @@ public class LevelStorageSource { - - public class LevelStorageAccess implements AutoCloseable { - -- final DirectoryLock lock; - public final LevelStorageSource.LevelDirectory levelDirectory; - private final String levelId; - private final Map resources = Maps.newHashMap(); -@@ -519,7 +518,6 @@ public class LevelStorageSource { - // CraftBukkit end - this.levelId = s; - this.levelDirectory = new LevelStorageSource.LevelDirectory(path); -- this.lock = DirectoryLock.create(path); - } - - public long estimateDiskSpace() { -@@ -568,9 +566,7 @@ public class LevelStorageSource { - } - - private void checkLock() { -- if (!this.lock.isValid()) { -- throw new IllegalStateException("Lock is no longer valid"); -- } -+ //nope - } - - public PlayerDataStorage createPlayerStorage() { -@@ -626,7 +622,7 @@ public class LevelStorageSource { - } - - public Optional getIconFile() { -- return !this.lock.isValid() ? Optional.empty() : Optional.of(this.levelDirectory.iconFile()); -+ return Optional.of(this.levelDirectory.iconFile()); - } - - public void deleteLevel() throws IOException { -@@ -655,7 +651,6 @@ public class LevelStorageSource { - throw ioexception; - } else { - if (path1.equals(LevelStorageAccess.this.levelDirectory.path())) { -- LevelStorageAccess.this.lock.close(); - Files.deleteIfExists(path); - } - -@@ -757,7 +752,7 @@ public class LevelStorageSource { - } - - public void close() throws IOException { -- this.lock.close(); -+ //ignored - } - - public boolean restoreLevelDataFromOld() { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c8b82bc41f2042bb4b067f06265a3a22e51f7629..e7f63e2f9271b05748db152be43ce9dfad6ff3a5 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -502,7 +502,7 @@ public final class CraftServer implements Server { - try { - this.configuration.save(this.getConfigFile()); - } catch (IOException ex) { -- Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getConfigFile(), ex); -+ //Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getConfigFile(), ex); - } - } - -@@ -510,7 +510,7 @@ public final class CraftServer implements Server { - try { - this.commandsConfiguration.save(this.getCommandsConfigFile()); - } catch (IOException ex) { -- Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getCommandsConfigFile(), ex); -+ //Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getCommandsConfigFile(), ex); - } - } - -@@ -600,7 +600,7 @@ public final class CraftServer implements Server { - DefaultPermissions.registerCorePermissions(); - CraftDefaultPermissions.registerCorePermissions(); - if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper -- this.helpMap.initializeCommands(); -+ //this.helpMap.initializeCommands(); - this.syncCommands(); - } - } -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 4dbb109d0526afee99b9190fc256585121aac9b5..3e819b143f62506d733ca88f585ba016c6765045 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -126,7 +126,7 @@ public class SpigotConfig - SpigotConfig.config.save( SpigotConfig.CONFIG_FILE ); - } catch ( IOException ex ) - { -- Bukkit.getLogger().log( Level.SEVERE, "Could not save " + SpigotConfig.CONFIG_FILE, ex ); -+ //Bukkit.getLogger().log( Level.SEVERE, "Could not save " + SpigotConfig.CONFIG_FILE, ex ); - } - } - diff --git a/patches/server/1048-Initialisation-improvements-II.patch b/patches/server/1047-SW-Patches.patch similarity index 96% rename from patches/server/1048-Initialisation-improvements-II.patch rename to patches/server/1047-SW-Patches.patch index 40bc9148e7..9ff30851ab 100644 --- a/patches/server/1048-Initialisation-improvements-II.patch +++ b/patches/server/1047-SW-Patches.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chaoscaot -Date: Fri, 23 Jun 2023 15:56:45 +0200 -Subject: [PATCH] Initialisation improvements II +From: Lixfel +Date: Wed, 1 Feb 2023 21:36:57 +0100 +Subject: [PATCH] SW Patches diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/helpers/HelperBlockFlatteningV1450.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/helpers/HelperBlockFlatteningV1450.java @@ -95,24 +95,234 @@ index 4f4f4cb6037c2a46ffcf427f5812164bbb98b8b7..eef5249db9a5808216397dd03b882dcb return ret == null ? FLATTENED_BY_ID[0] : ret; } -diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index d3dbc896d611f0f719bb257c01789e1fdae751b0..800c04b5cb13e12280ad40ae105f959b06d5cea0 100644 ---- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -224,13 +224,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - // Spigot end - io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc. - // Paper start - initialize global and world-defaults configuration -- try { -- Main.paperConfig.get(); -- } catch (InterruptedException e) { -- Thread.currentThread().interrupt(); -- } catch (ExecutionException e) { -- throw new IOException(e); +diff --git a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java +index 660b2ec6b63a4ceffee44ab11f54dfa7c0d0996f..81902d28ac96cebb98d66bf5a4ff4237bf00d181 100644 +--- a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java ++++ b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java +@@ -92,7 +92,7 @@ public enum VersionHistoryManager { + )) { + gson.toJson(currentData, writer); + } catch (final IOException e) { +- logger.log(Level.SEVERE, "Failed to write to version history file", e); ++ //logger.log(Level.SEVERE, "Failed to write to version history file", e); + } + } + +diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java +index 87e5f614ba988547a827486740db217e28585773..c83eae306debfe34fb6383cb83a3dad0f74431a4 100644 +--- a/src/main/java/io/papermc/paper/configuration/Configurations.java ++++ b/src/main/java/io/papermc/paper/configuration/Configurations.java +@@ -114,7 +114,7 @@ public abstract class Configurations { + loader.save(node); + } catch (ConfigurateException ex) { + if (ex.getCause() instanceof AccessDeniedException) { +- LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex); ++ //LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex); + } else throw ex; + } + } +diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +index 783eac6e458c6f1a0584301fb84a2fe341868f34..ec2194d292f79ea66a2b85835189f270cb727f9f 100644 +--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java ++++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +@@ -459,8 +459,6 @@ public class PaperConfigurations extends Configurations mappingsByMojangName; + + ObfHelper() { +- final @Nullable Set maps = loadMappingsIfPresent(); ++ final @Nullable Set maps = null; + if (maps != null) { + this.mappingsByObfName = maps.stream().collect(Collectors.toUnmodifiableMap(ClassMapping::obfName, map -> map)); + this.mappingsByMojangName = maps.stream().collect(Collectors.toUnmodifiableMap(ClassMapping::mojangName, map -> map)); +diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java +index 1d1e76de60e40224f5cb81893f9ee50fe987badb..c2367bcc8dafb71877259dfb46accb42a743d0ee 100644 +--- a/src/main/java/net/minecraft/commands/Commands.java ++++ b/src/main/java/net/minecraft/commands/Commands.java +@@ -156,65 +156,64 @@ public class Commands { + + public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) { + // Paper +- AdvancementCommands.register(this.dispatcher); +- AttributeCommand.register(this.dispatcher, commandRegistryAccess); +- ExecuteCommand.register(this.dispatcher, commandRegistryAccess); +- BossBarCommands.register(this.dispatcher, commandRegistryAccess); ++ //AdvancementCommands.register(this.dispatcher); ++ //AttributeCommand.register(this.dispatcher, commandRegistryAccess); ++ //ExecuteCommand.register(this.dispatcher, commandRegistryAccess); ++ //BossBarCommands.register(this.dispatcher, commandRegistryAccess); + ClearInventoryCommands.register(this.dispatcher, commandRegistryAccess); +- CloneCommands.register(this.dispatcher, commandRegistryAccess); +- DamageCommand.register(this.dispatcher, commandRegistryAccess); +- DataCommands.register(this.dispatcher); +- DataPackCommand.register(this.dispatcher); +- DebugCommand.register(this.dispatcher); +- DefaultGameModeCommands.register(this.dispatcher); +- DifficultyCommand.register(this.dispatcher); ++ //CloneCommands.register(this.dispatcher, commandRegistryAccess); ++ //DamageCommand.register(this.dispatcher, commandRegistryAccess); ++ //DataCommands.register(this.dispatcher); ++ //DataPackCommand.register(this.dispatcher); ++ //DebugCommand.register(this.dispatcher); ++ //DefaultGameModeCommands.register(this.dispatcher); ++ //DifficultyCommand.register(this.dispatcher); + EffectCommands.register(this.dispatcher, commandRegistryAccess); +- EmoteCommands.register(this.dispatcher); ++ //EmoteCommands.register(this.dispatcher); + EnchantCommand.register(this.dispatcher, commandRegistryAccess); +- ExperienceCommand.register(this.dispatcher); +- FillCommand.register(this.dispatcher, commandRegistryAccess); ++ //ExperienceCommand.register(this.dispatcher); ++ //FillCommand.register(this.dispatcher, commandRegistryAccess); + FillBiomeCommand.register(this.dispatcher, commandRegistryAccess); +- ForceLoadCommand.register(this.dispatcher); +- FunctionCommand.register(this.dispatcher); ++ //ForceLoadCommand.register(this.dispatcher); ++ //FunctionCommand.register(this.dispatcher); + GameModeCommand.register(this.dispatcher); + GameRuleCommand.register(this.dispatcher); + GiveCommand.register(this.dispatcher, commandRegistryAccess); +- HelpCommand.register(this.dispatcher); +- ItemCommands.register(this.dispatcher, commandRegistryAccess); ++ //HelpCommand.register(this.dispatcher); ++ //ItemCommands.register(this.dispatcher, commandRegistryAccess); + KickCommand.register(this.dispatcher); + KillCommand.register(this.dispatcher); +- ListPlayersCommand.register(this.dispatcher); +- LocateCommand.register(this.dispatcher, commandRegistryAccess); +- LootCommand.register(this.dispatcher, commandRegistryAccess); +- MsgCommand.register(this.dispatcher); +- ParticleCommand.register(this.dispatcher, commandRegistryAccess); +- PlaceCommand.register(this.dispatcher); +- PlaySoundCommand.register(this.dispatcher); +- RandomCommand.register(this.dispatcher); +- ReloadCommand.register(this.dispatcher); +- RecipeCommand.register(this.dispatcher); +- ReturnCommand.register(this.dispatcher); +- RideCommand.register(this.dispatcher); +- SayCommand.register(this.dispatcher); +- ScheduleCommand.register(this.dispatcher); +- ScoreboardCommand.register(this.dispatcher, commandRegistryAccess); +- SeedCommand.register(this.dispatcher, environment != Commands.CommandSelection.INTEGRATED); +- SetBlockCommand.register(this.dispatcher, commandRegistryAccess); +- SetSpawnCommand.register(this.dispatcher); ++ //ListPlayersCommand.register(this.dispatcher); ++ //LocateCommand.register(this.dispatcher, commandRegistryAccess); ++ //LootCommand.register(this.dispatcher, commandRegistryAccess); ++ //MsgCommand.register(this.dispatcher); ++ //ParticleCommand.register(this.dispatcher, commandRegistryAccess); ++ //PlaceCommand.register(this.dispatcher); ++ //PlaySoundCommand.register(this.dispatcher); ++ //ReloadCommand.register(this.dispatcher); ++ //RecipeCommand.register(this.dispatcher); ++ //ReturnCommand.register(this.dispatcher); ++ //RideCommand.register(this.dispatcher); ++ //SayCommand.register(this.dispatcher); ++ //ScheduleCommand.register(this.dispatcher); ++ //ScoreboardCommand.register(this.dispatcher); ++ //SeedCommand.register(this.dispatcher, environment != Commands.CommandSelection.INTEGRATED); ++ //SetBlockCommand.register(this.dispatcher, commandRegistryAccess); ++ //SetSpawnCommand.register(this.dispatcher); + SetWorldSpawnCommand.register(this.dispatcher); + SpectateCommand.register(this.dispatcher); +- SpreadPlayersCommand.register(this.dispatcher); +- StopSoundCommand.register(this.dispatcher); ++ //SpreadPlayersCommand.register(this.dispatcher); ++ //StopSoundCommand.register(this.dispatcher); + SummonCommand.register(this.dispatcher, commandRegistryAccess); +- TagCommand.register(this.dispatcher); +- TeamCommand.register(this.dispatcher, commandRegistryAccess); +- TeamMsgCommand.register(this.dispatcher); ++ //TagCommand.register(this.dispatcher); ++ //TeamCommand.register(this.dispatcher, commandRegistryAccess); ++ //TeamMsgCommand.register(this.dispatcher); + TeleportCommand.register(this.dispatcher); +- TellRawCommand.register(this.dispatcher, commandRegistryAccess); ++ //TellRawCommand.register(this.dispatcher, commandRegistryAccess); + TickCommand.register(this.dispatcher); + TimeCommand.register(this.dispatcher); +- TitleCommand.register(this.dispatcher, commandRegistryAccess); +- TriggerCommand.register(this.dispatcher); ++ //TitleCommand.register(this.dispatcher, commandRegistryAccess); ++ //TriggerCommand.register(this.dispatcher); + WeatherCommand.register(this.dispatcher); + WorldBorderCommand.register(this.dispatcher); + if (JvmProfiler.INSTANCE.isAvailable()) { +@@ -235,20 +234,20 @@ public class Commands { + } + + if (environment.includeDedicated) { +- BanIpCommands.register(this.dispatcher); +- BanListCommands.register(this.dispatcher); +- BanPlayerCommands.register(this.dispatcher); +- DeOpCommands.register(this.dispatcher); +- OpCommand.register(this.dispatcher); +- PardonCommand.register(this.dispatcher); +- PardonIpCommand.register(this.dispatcher); +- PerfCommand.register(this.dispatcher); ++ //BanIpCommands.register(this.dispatcher); ++ //BanListCommands.register(this.dispatcher); ++ //BanPlayerCommands.register(this.dispatcher); ++ //DeOpCommands.register(this.dispatcher); ++ //OpCommand.register(this.dispatcher); ++ //PardonCommand.register(this.dispatcher); ++ //PardonIpCommand.register(this.dispatcher); ++ //PerfCommand.register(this.dispatcher); + SaveAllCommand.register(this.dispatcher); + SaveOffCommand.register(this.dispatcher); + SaveOnCommand.register(this.dispatcher); +- SetPlayerIdleTimeoutCommand.register(this.dispatcher); ++ //SetPlayerIdleTimeoutCommand.register(this.dispatcher); + StopCommand.register(this.dispatcher); +- TransferCommand.register(this.dispatcher); ++ //TransferCommand.register(this.dispatcher); + WhitelistCommand.register(this.dispatcher); + } + +diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java +index c038da20b76c0b7b1c18471b20be01e849d29f3a..f5611bf250aaa2851ca8873291c7f4b6c3771281 100644 +--- a/src/main/java/net/minecraft/server/players/StoredUserList.java ++++ b/src/main/java/net/minecraft/server/players/StoredUserList.java +@@ -9,10 +9,8 @@ import com.google.gson.JsonArray; + import com.google.gson.JsonElement; + import com.google.gson.JsonObject; + import com.mojang.logging.LogUtils; +-import java.io.BufferedReader; +-import java.io.BufferedWriter; +-import java.io.File; +-import java.io.IOException; ++ ++import java.io.*; + import java.nio.charset.StandardCharsets; + import java.util.Collection; + import java.util.Iterator; +@@ -114,7 +112,12 @@ public abstract class StoredUserList> { + + Objects.requireNonNull(jsonarray); + stream.forEach(jsonarray::add); +- BufferedWriter bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8); ++ BufferedWriter bufferedwriter; ++ try { ++ bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8); ++ } catch (FileNotFoundException e) { ++ return; ++ } + + try { + StoredUserList.GSON.toJson(jsonarray, StoredUserList.GSON.newJsonWriter(bufferedwriter)); diff --git a/src/main/java/net/minecraft/util/datafix/fixes/BlockStateData.java b/src/main/java/net/minecraft/util/datafix/fixes/BlockStateData.java index 6b1af6df2427a6c2f7954c89935bf33279d58204..51f32a847c954846fb0c18e802287a26d507ee9f 100644 --- a/src/main/java/net/minecraft/util/datafix/fixes/BlockStateData.java @@ -9748,11 +9958,64 @@ index 6b1af6df2427a6c2f7954c89935bf33279d58204..51f32a847c954846fb0c18e802287a26 + return new Dynamic<>(NbtOps.INSTANCE, HelperBlockFlatteningV1450.getNBTForId(stateId).getTag()); } } +diff --git a/src/main/java/net/minecraft/world/level/biome/Climate.java b/src/main/java/net/minecraft/world/level/biome/Climate.java +index f06a35024af284addf41dfe160849e8e5e15e822..ca945f615cc9699660809afd0fd96092bc4dad3c 100644 +--- a/src/main/java/net/minecraft/world/level/biome/Climate.java ++++ b/src/main/java/net/minecraft/world/level/biome/Climate.java +@@ -258,7 +258,14 @@ public class Climate { + this.root = firstNode; + } + ++ private static final List>> cache = new ArrayList<>(4); ++ + public static Climate.RTree create(List> entries) { ++ for(Pair> value : cache) { ++ if(value.getFirst().equals(entries)) ++ return (RTree) value.getSecond(); ++ } ++ + if (entries.isEmpty()) { + throw new IllegalArgumentException("Need at least one value to build the search tree."); + } else { +@@ -266,10 +273,10 @@ public class Climate { + if (i != 7) { + throw new IllegalStateException("Expecting parameter space to be 7, got " + i); + } else { +- List> list = entries.stream() +- .map(entry -> new Climate.RTree.Leaf(entry.getFirst(), entry.getSecond())) +- .collect(Collectors.toCollection(ArrayList::new)); +- return new Climate.RTree<>(build(i, list)); ++ List> list = entries.stream().map(entry -> new Leaf<>(entry.getFirst(), entry.getSecond())).collect(Collectors.toCollection(ArrayList::new)); ++ RTree tree = new RTree<>(build(i, list)); ++ cache.add(Pair.of(entries, tree)); ++ return tree; + } + } + } diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java -index 475cd0583e99495ca0df665da19cc382a8d5e7ea..3f31a3115c69fd976ccb1e396018d94bba0f3557 100644 +index 223259e7a09ada681b6181c898f6857888594f85..3f31a3115c69fd976ccb1e396018d94bba0f3557 100644 --- a/src/main/java/net/minecraft/world/level/block/Blocks.java +++ b/src/main/java/net/minecraft/world/level/block/Blocks.java -@@ -7807,10 +7807,10 @@ public class Blocks { +@@ -1,7 +1,9 @@ + package net.minecraft.world.level.block; + ++import java.util.concurrent.ExecutorService; + import java.util.function.Function; + import java.util.function.ToIntFunction; ++import net.minecraft.Util; + import javax.annotation.Nullable; + import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; +@@ -7797,17 +7799,18 @@ public class Blocks { + } + + public static void rebuildCache() { +- Block.BLOCK_STATE_REGISTRY.forEach(BlockBehaviour.BlockStateBase::initCache); ++ ExecutorService executor = Util.backgroundExecutor(); ++ Block.BLOCK_STATE_REGISTRY.forEach(b -> executor.submit(b::initCache)); + } + + static { for (Block block : BuiltInRegistries.BLOCK) { for (BlockState blockState : block.getStateDefinition().getPossibleStates()) { Block.BLOCK_STATE_REGISTRY.add(blockState); @@ -9766,7 +10029,7 @@ index 475cd0583e99495ca0df665da19cc382a8d5e7ea..3f31a3115c69fd976ccb1e396018d94b } } diff --git a/src/main/java/net/minecraft/world/level/block/WallBlock.java b/src/main/java/net/minecraft/world/level/block/WallBlock.java -index 24eb3b5c805a5df9b029b4a2a98f2a3720065e5e..bea1d8a72d5528335b755aeda6168764778b924f 100644 +index 83956032bef4d34eddb9899f0a2847e66bfd83f4..bea1d8a72d5528335b755aeda6168764778b924f 100644 --- a/src/main/java/net/minecraft/world/level/block/WallBlock.java +++ b/src/main/java/net/minecraft/world/level/block/WallBlock.java @@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap; @@ -9777,18 +10040,24 @@ index 24eb3b5c805a5df9b029b4a2a98f2a3720065e5e..bea1d8a72d5528335b755aeda6168764 import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.tags.BlockTags; -@@ -35,8 +36,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { +@@ -35,8 +36,14 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { public static final EnumProperty SOUTH_WALL = BlockStateProperties.SOUTH_WALL; public static final EnumProperty WEST_WALL = BlockStateProperties.WEST_WALL; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; -- private static final Map, Comparable>, VoxelShape> shapeByIndex; -- private static final Map, Comparable>, VoxelShape> collisionShapeByIndex; +- private final Map shapeByIndex; +- private final Map collisionShapeByIndex; + private static final Map shapeByIndex; + private static final Map collisionShapeByIndex; - - static { - shapeByIndex = makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 14.0F, 16.0F); -@@ -72,8 +73,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { ++ ++ static { ++ shapeByIndex = makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 14.0F, 16.0F); ++ collisionShapeByIndex = makeShapes(4.0F, 3.0F, 24.0F, 0.0F, 24.0F, 24.0F); ++ } ++ + private static final int WALL_WIDTH = 3; + private static final int WALL_HEIGHT = 14; + private static final int POST_WIDTH = 4; +@@ -66,8 +73,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { .setValue(WEST_WALL, WallSide.NONE) .setValue(WATERLOGGED, Boolean.valueOf(false)) ); @@ -9797,25 +10066,25 @@ index 24eb3b5c805a5df9b029b4a2a98f2a3720065e5e..bea1d8a72d5528335b755aeda6168764 } private static VoxelShape applyWallShape(VoxelShape base, WallSide wallShape, VoxelShape tall, VoxelShape low) { -@@ -84,7 +83,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { +@@ -78,7 +83,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { } } -- private static Map, Comparable>, VoxelShape> makeShapes(float f, float g, float h, float i, float j, float k) { +- private Map makeShapes(float f, float g, float h, float i, float j, float k) { + private static Map makeShapes(float f, float g, float h, float i, float j, float k) { float l = 8.0F - f; float m = 8.0F + f; float n = 8.0F - g; -@@ -98,7 +97,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { +@@ -92,7 +97,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { VoxelShape voxelShape7 = Block.box((double)n, (double)i, (double)n, (double)o, (double)k, 16.0); VoxelShape voxelShape8 = Block.box(0.0, (double)i, (double)n, (double)o, (double)k, (double)o); VoxelShape voxelShape9 = Block.box((double)n, (double)i, (double)n, 16.0, (double)k, (double)o); -- Builder, Comparable>, VoxelShape> builder = ImmutableMap.builder(); +- Builder builder = ImmutableMap.builder(); + Builder builder = ImmutableMap.builder(); for (Boolean boolean_ : UP.getPossibleValues()) { for (WallSide wallSide : EAST_WALL.getPossibleValues()) { -@@ -114,14 +113,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { +@@ -108,14 +113,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { voxelShape10 = Shapes.or(voxelShape10, voxelShape); } @@ -9825,14 +10094,14 @@ index 24eb3b5c805a5df9b029b4a2a98f2a3720065e5e..bea1d8a72d5528335b755aeda6168764 - .setValue(WEST_WALL, wallSide3) - .setValue(NORTH_WALL, wallSide2) - .setValue(SOUTH_WALL, wallSide4); -- builder.put(ImmutableMap.of(UP, boolean_, EAST_WALL, wallSide, WEST_WALL, wallSide3, NORTH_WALL, wallSide2, SOUTH_WALL, wallSide4, WATERLOGGED, Boolean.FALSE), voxelShape10); -- builder.put(ImmutableMap.of(UP, boolean_, EAST_WALL, wallSide, WEST_WALL, wallSide3, NORTH_WALL, wallSide2, SOUTH_WALL, wallSide4, WATERLOGGED, Boolean.TRUE), voxelShape10); +- builder.put(blockState.setValue(WATERLOGGED, Boolean.valueOf(false)), voxelShape10); +- builder.put(blockState.setValue(WATERLOGGED, Boolean.valueOf(true)), voxelShape10); + builder.put(hashWallState(wallSide, wallSide2, wallSide4, boolean_, Boolean.FALSE, wallSide3), voxelShape10); + builder.put(hashWallState(wallSide, wallSide2, wallSide4, boolean_, Boolean.TRUE , wallSide3), voxelShape10); } } } -@@ -131,14 +124,36 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { +@@ -125,14 +124,36 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock { return builder.build(); } @@ -9860,29 +10129,353 @@ index 24eb3b5c805a5df9b029b4a2a98f2a3720065e5e..bea1d8a72d5528335b755aeda6168764 + @Override protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { -- return shapeByIndex.get(state.getValues()); +- return this.shapeByIndex.get(state); + return shapeByIndex.get(mapHashCode(state.getValues())); } @Override protected VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { -- return collisionShapeByIndex.get(state.getValues()); +- return this.collisionShapeByIndex.get(state); + return collisionShapeByIndex.get(mapHashCode(state.getValues())); } @Override +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +index ded6d148110fe3fbb6272ce44582a28472dd49a6..16fe0554f38665cd652eef8fe693371c5de4542a 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +@@ -77,6 +77,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; + import net.minecraft.world.phys.AABB; + import net.minecraft.world.phys.BlockHitResult; + import net.minecraft.world.phys.Vec3; ++import net.minecraft.world.phys.shapes.BooleanOp; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.Shapes; + import net.minecraft.world.phys.shapes.VoxelShape; +@@ -1435,7 +1436,7 @@ public abstract class BlockBehaviour implements FeatureElement { + } + } + +- this.isCollisionShapeFullBlock = Block.isShapeFullBlock(state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); ++ this.isCollisionShapeFullBlock = !Shapes.joinIsNotEmpty(Shapes.block(), state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO), BooleanOp.NOT_SAME); //Block.isShapeFullBlock(state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)); + } + } + diff --git a/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java b/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java -index 0df8011cd0809045986179e49ef7e2f459168f07..3a449e13951ea183b9ae7910a424b51e841608da 100644 +index 46af72761c0bfbc10c14d78c855255969e2cf8a3..3a449e13951ea183b9ae7910a424b51e841608da 100644 --- a/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java +++ b/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java -@@ -62,7 +62,9 @@ public class StateDefinition> { - S stateHolderx = factory.create(owner, reference2ObjectArrayMap, mapCodec2); - list.add(stateHolderx); +@@ -11,10 +11,8 @@ import com.mojang.serialization.Decoder; + import com.mojang.serialization.Encoder; + import com.mojang.serialization.MapCodec; + import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; +-import java.util.Collection; +-import java.util.Collections; +-import java.util.List; +-import java.util.Map; ++ ++import java.util.*; + import java.util.Map.Entry; + import java.util.function.Function; + import java.util.function.Supplier; +@@ -22,7 +20,8 @@ import java.util.regex.Pattern; + import java.util.stream.Collectors; + import java.util.stream.Stream; + import javax.annotation.Nullable; +-import net.minecraft.world.level.block.state.properties.Property; ++ ++import net.minecraft.world.level.block.state.properties.*; -- stateHolder.populateNeighbours(table, table.put(immutableMap, stateHolder)); + public class StateDefinition> { + static final Pattern NAME_PATTERN = Pattern.compile("^[a-z0-9_]+$"); +@@ -41,7 +40,6 @@ public class StateDefinition> { + } + + MapCodec mapCodec2 = mapCodec; +- Map, Comparable>, S> map = Maps.newLinkedHashMap(); + List list = Lists.newArrayList(); + Stream, Comparable>>> stream = Stream.of(Collections.emptyList()); + +@@ -53,6 +51,7 @@ public class StateDefinition> { + })); + } + ++ NeighbourTable table = new NeighbourTable<>(propertiesMap); + stream.forEach(list2 -> { + Reference2ObjectArrayMap, Comparable> reference2ObjectArrayMap = new Reference2ObjectArrayMap<>(list2.size()); + +@@ -61,13 +60,12 @@ public class StateDefinition> { + } + + S stateHolderx = factory.create(owner, reference2ObjectArrayMap, mapCodec2); +- map.put(reference2ObjectArrayMap, stateHolderx); + list.add(stateHolderx); +- }); + +- for (S stateHolder : list) { +- stateHolder.populateNeighbours(map); +- } + int index = table.put(reference2ObjectArrayMap, stateHolderx); + + stateHolderx.populateNeighbours(table, index); - }); ++ }); this.states = ImmutableList.copyOf(list); + } +@@ -157,4 +155,60 @@ public class StateDefinition> { + public interface Factory { + S create(O owner, Reference2ObjectArrayMap, Comparable> propertyMap, MapCodec codec); + } ++ ++ public static class NeighbourTable { ++ private final Map, Pair> offsetMasks; ++ private final Object[] array; ++ ++ public NeighbourTable(Map> propertiesMap) { ++ offsetMasks = new IdentityHashMap<>(propertiesMap.size()); ++ int offset = 0; ++ for(Property property : propertiesMap.values()) { ++ int bits = Integer.SIZE - Integer.numberOfLeadingZeros((property instanceof EnumProperty ? property.getValueClass().getEnumConstants().length : property.getPossibleValues().size()) - 1); ++ offsetMasks.put(property, Pair.of(offset, ~(((1<, Comparable> key, S value) { ++ int index = 0; ++ for(Map.Entry, Comparable> k : key.entrySet()) { ++ index = setIndex(index, k.getKey(), k.getValue()); ++ } ++ array[index] = value; ++ return index; ++ } ++ ++ private int setIndex(int index, Property property, Comparable value) { ++ Pair offsetMask = offsetMasks.get(property); ++ if(property instanceof BooleanProperty) { ++ return index | (((Boolean)value) ? 1 : 0) << offsetMask.getFirst(); ++ } else if(property instanceof EnumProperty) { ++ return index | ((Enum)value).ordinal() << offsetMask.getFirst(); ++ } else if(property instanceof IntegerProperty intProperty) { ++ return index | (((Integer)value) - intProperty.min) << offsetMask.getFirst(); ++ } else { ++ throw new IllegalArgumentException("Unknown property type " + property.getClass().getName()); ++ } ++ } ++ ++ public S getNeighbour(int index, Property property, Comparable value) { ++ return (S)array[modIndex(index, property, value)]; ++ } ++ ++ private int modIndex(int index, Property property, Comparable value) { ++ Pair offsetMask = offsetMasks.get(property); ++ if(property instanceof BooleanProperty) { ++ return (index & offsetMask.getSecond()) | (((Boolean)value) ? 1 : 0) << offsetMask.getFirst(); ++ } else if(property instanceof EnumProperty) { ++ return (index & offsetMask.getSecond()) | ((Enum)value).ordinal() << offsetMask.getFirst(); ++ } else if(property instanceof IntegerProperty intProperty) { ++ return (index & offsetMask.getSecond()) | (((Integer)value) - intProperty.min) << offsetMask.getFirst(); ++ } else { ++ throw new IllegalArgumentException("Unknown property type " + property.getClass().getName()); ++ } ++ } ++ } + } +diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java +index 45744d86e9582a93a0cec26009deea091080fbbe..7e2ecb0457150dedc665f05c6c8ad068c00e3642 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java ++++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java +@@ -37,15 +37,14 @@ public abstract class StateHolder { + }; + protected final O owner; + private final Reference2ObjectArrayMap, Comparable> values; +- private Table, Comparable, S> neighbours; + protected final MapCodec propertiesCodec; +- protected final io.papermc.paper.util.table.ZeroCollidingReferenceStateTable optimisedTable; // Paper - optimise state lookup ++ private StateDefinition.NeighbourTable neighbourTable; ++ private int neighbourIndex; + + protected StateHolder(O owner, Reference2ObjectArrayMap, Comparable> propertyMap, MapCodec codec) { + this.owner = owner; + this.values = propertyMap; + this.propertiesCodec = codec; +- this.optimisedTable = new io.papermc.paper.util.table.ZeroCollidingReferenceStateTable(this, propertyMap); // Paper - optimise state lookup + } + + public > S cycle(Property property) { +@@ -86,11 +85,11 @@ public abstract class StateHolder { + } + + public > boolean hasProperty(Property property) { +- return this.optimisedTable.get(property) != null; // Paper - optimise state lookup ++ return this.values.containsKey(property); + } + + public > T getValue(Property property) { +- Comparable comparable = this.optimisedTable.get(property); // Paper - optimise state lookup ++ Comparable comparable = this.values.get(property); + if (comparable == null) { + throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner); + } else { +@@ -99,52 +98,26 @@ public abstract class StateHolder { + } + + public > Optional getOptionalValue(Property property) { +- Comparable comparable = this.optimisedTable.get(property); // Paper - optimise state lookup ++ Comparable comparable = this.values.get(property); + return comparable == null ? Optional.empty() : Optional.of(property.getValueClass().cast(comparable)); + } + + public , V extends T> S setValue(Property property, V value) { +- // Paper start - optimise state lookup +- final S ret = (S)this.optimisedTable.get(property, value); +- if (ret == null) { +- throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); +- } +- return ret; +- // Paper end - optimise state lookup ++ return this.neighbourTable.getNeighbour(this.neighbourIndex, property, value); + } + + public , V extends T> S trySetValue(Property property, V value) { + Comparable comparable = this.values.get(property); + if (comparable != null && !comparable.equals(value)) { +- S object = this.neighbours.get(property, value); +- if (object == null) { +- throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); +- } else { +- return object; +- } ++ return this.neighbourTable.getNeighbour(this.neighbourIndex, property, value); + } else { + return (S)this; + } + } + +- public void populateNeighbours(Map, Comparable>, S> states) { +- if (this.neighbours != null) { +- throw new IllegalStateException(); +- } else { +- Table, Comparable, S> table = HashBasedTable.create(); +- +- for (Entry, Comparable> entry : this.values.entrySet()) { +- Property property = entry.getKey(); +- +- for (Comparable comparable : property.getPossibleValues()) { +- if (!comparable.equals(entry.getValue())) { +- table.put(property, comparable, states.get(this.makeNeighbourValues(property, comparable))); +- } +- } +- } +- +- this.neighbours = (Table, Comparable, S>)(table.isEmpty() ? table : ArrayTable.create(table)); this.optimisedTable.loadInTable((Table)this.neighbours, this.values); // Paper - optimise state lookup +- } ++ public void populateNeighbours(StateDefinition.NeighbourTable states, int ownIndex) { ++ this.neighbourTable = states; ++ this.neighbourIndex = ownIndex; + } + + private Map, Comparable> makeNeighbourValues(Property property, Comparable value) { +diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java +index 427ee4d6f12a7abd8da0c65e0b9081b25824df40..4c2ad01150972940688cb8301fc84a210844c48f 100644 +--- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java ++++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java +@@ -507,7 +507,6 @@ public class LevelStorageSource { + + public class LevelStorageAccess implements AutoCloseable { + +- final DirectoryLock lock; + public final LevelStorageSource.LevelDirectory levelDirectory; + private final String levelId; + private final Map resources = Maps.newHashMap(); +@@ -519,7 +518,6 @@ public class LevelStorageSource { + // CraftBukkit end + this.levelId = s; + this.levelDirectory = new LevelStorageSource.LevelDirectory(path); +- this.lock = DirectoryLock.create(path); + } + + public long estimateDiskSpace() { +@@ -568,9 +566,7 @@ public class LevelStorageSource { + } + + private void checkLock() { +- if (!this.lock.isValid()) { +- throw new IllegalStateException("Lock is no longer valid"); +- } ++ //nope + } + + public PlayerDataStorage createPlayerStorage() { +@@ -626,7 +622,7 @@ public class LevelStorageSource { + } + + public Optional getIconFile() { +- return !this.lock.isValid() ? Optional.empty() : Optional.of(this.levelDirectory.iconFile()); ++ return Optional.of(this.levelDirectory.iconFile()); + } + + public void deleteLevel() throws IOException { +@@ -655,7 +651,6 @@ public class LevelStorageSource { + throw ioexception; + } else { + if (path1.equals(LevelStorageAccess.this.levelDirectory.path())) { +- LevelStorageAccess.this.lock.close(); + Files.deleteIfExists(path); + } + +@@ -757,7 +752,7 @@ public class LevelStorageSource { + } + + public void close() throws IOException { +- this.lock.close(); ++ //ignored + } + + public boolean restoreLevelDataFromOld() { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index c8b82bc41f2042bb4b067f06265a3a22e51f7629..e7f63e2f9271b05748db152be43ce9dfad6ff3a5 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -502,7 +502,7 @@ public final class CraftServer implements Server { + try { + this.configuration.save(this.getConfigFile()); + } catch (IOException ex) { +- Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getConfigFile(), ex); ++ //Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getConfigFile(), ex); + } + } + +@@ -510,7 +510,7 @@ public final class CraftServer implements Server { + try { + this.commandsConfiguration.save(this.getCommandsConfigFile()); + } catch (IOException ex) { +- Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getCommandsConfigFile(), ex); ++ //Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, "Could not save " + this.getCommandsConfigFile(), ex); + } + } + +@@ -600,7 +600,7 @@ public final class CraftServer implements Server { + DefaultPermissions.registerCorePermissions(); + CraftDefaultPermissions.registerCorePermissions(); + if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper +- this.helpMap.initializeCommands(); ++ //this.helpMap.initializeCommands(); + this.syncCommands(); + } + } +diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java +index 4dbb109d0526afee99b9190fc256585121aac9b5..3e819b143f62506d733ca88f585ba016c6765045 100644 +--- a/src/main/java/org/spigotmc/SpigotConfig.java ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -126,7 +126,7 @@ public class SpigotConfig + SpigotConfig.config.save( SpigotConfig.CONFIG_FILE ); + } catch ( IOException ex ) + { +- Bukkit.getLogger().log( Level.SEVERE, "Could not save " + SpigotConfig.CONFIG_FILE, ex ); ++ //Bukkit.getLogger().log( Level.SEVERE, "Could not save " + SpigotConfig.CONFIG_FILE, ex ); + } + } +