geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Ursprung
be922367c3
Commit
ab00a73799
118
patches/server/1047-SW-WallBlock-Cache-Improvements.patch
Normale Datei
118
patches/server/1047-SW-WallBlock-Cache-Improvements.patch
Normale Datei
@ -0,0 +1,118 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Tue, 13 Aug 2024 11:40:37 +0200
|
||||
Subject: [PATCH] SW WallBlock Cache Improvements
|
||||
|
||||
|
||||
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..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;
|
||||
import com.google.common.collect.ImmutableMap.Builder;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import java.util.Map;
|
||||
+import java.util.Objects;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
@@ -35,8 +36,14 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
public static final EnumProperty<WallSide> SOUTH_WALL = BlockStateProperties.SOUTH_WALL;
|
||||
public static final EnumProperty<WallSide> WEST_WALL = BlockStateProperties.WEST_WALL;
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
- private final Map<BlockState, VoxelShape> shapeByIndex;
|
||||
- private final Map<BlockState, VoxelShape> collisionShapeByIndex;
|
||||
+ private static final Map<Integer, VoxelShape> shapeByIndex;
|
||||
+ private static final Map<Integer, 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;
|
||||
@@ -66,8 +73,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
.setValue(WEST_WALL, WallSide.NONE)
|
||||
.setValue(WATERLOGGED, Boolean.valueOf(false))
|
||||
);
|
||||
- this.shapeByIndex = this.makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 14.0F, 16.0F);
|
||||
- this.collisionShapeByIndex = this.makeShapes(4.0F, 3.0F, 24.0F, 0.0F, 24.0F, 24.0F);
|
||||
}
|
||||
|
||||
private static VoxelShape applyWallShape(VoxelShape base, WallSide wallShape, VoxelShape tall, VoxelShape low) {
|
||||
@@ -78,7 +83,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
}
|
||||
}
|
||||
|
||||
- private Map<BlockState, VoxelShape> makeShapes(float f, float g, float h, float i, float j, float k) {
|
||||
+ private static Map<Integer, 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 +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<BlockState, VoxelShape> builder = ImmutableMap.builder();
|
||||
+ Builder<Integer, VoxelShape> builder = ImmutableMap.builder();
|
||||
|
||||
for (Boolean boolean_ : UP.getPossibleValues()) {
|
||||
for (WallSide wallSide : EAST_WALL.getPossibleValues()) {
|
||||
@@ -108,14 +113,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
voxelShape10 = Shapes.or(voxelShape10, voxelShape);
|
||||
}
|
||||
|
||||
- BlockState blockState = this.defaultBlockState()
|
||||
- .setValue(UP, boolean_)
|
||||
- .setValue(EAST_WALL, wallSide)
|
||||
- .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(hashWallState(wallSide, wallSide2, wallSide4, boolean_, Boolean.FALSE, wallSide3), voxelShape10);
|
||||
+ builder.put(hashWallState(wallSide, wallSide2, wallSide4, boolean_, Boolean.TRUE , wallSide3), voxelShape10);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,14 +124,36 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
+ private static int mapHashCode(Map<Property<?>, Comparable<?>> values) {
|
||||
+ return hashWallState(
|
||||
+ (WallSide) values.get(EAST_WALL),
|
||||
+ (WallSide) values.get(NORTH_WALL),
|
||||
+ (WallSide) values.get(SOUTH_WALL),
|
||||
+ (Boolean) values.get(UP),
|
||||
+ (Boolean) values.get(WATERLOGGED),
|
||||
+ (WallSide) values.get(WEST_WALL)
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ private static int hashWallState(WallSide east, WallSide north, WallSide south, boolean up, boolean waterlogged, WallSide west) {
|
||||
+ int hash = 7;
|
||||
+ hash = 31 * hash + east.hashCode();
|
||||
+ hash = 31 * hash + north.hashCode();
|
||||
+ hash = 31 * hash + south.hashCode();
|
||||
+ hash = 31 * hash + Objects.hashCode(up);
|
||||
+ hash = 31 * hash + Objects.hashCode(waterlogged);
|
||||
+ hash = 31 * hash + west.hashCode();
|
||||
+ return hash;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
- return this.shapeByIndex.get(state);
|
||||
+ return shapeByIndex.get(mapHashCode(state.getValues()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
- return this.collisionShapeByIndex.get(state);
|
||||
+ return collisionShapeByIndex.get(mapHashCode(state.getValues()));
|
||||
}
|
||||
|
||||
@Override
|
121
patches/server/1048-SW-Remove-Debug-Messages.patch
Normale Datei
121
patches/server/1048-SW-Remove-Debug-Messages.patch
Normale Datei
@ -0,0 +1,121 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Tue, 13 Aug 2024 11:42:59 +0200
|
||||
Subject: [PATCH] SW Remove Debug Messages
|
||||
|
||||
|
||||
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<G, W> {
|
||||
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<GlobalConfiguration, Wor
|
||||
|
||||
// Symlinks are not correctly checked in createDirectories
|
||||
static void createDirectoriesSymlinkAware(Path path) throws IOException {
|
||||
- if (!Files.isDirectory(path)) {
|
||||
- Files.createDirectories(path);
|
||||
- }
|
||||
+ // do nothing
|
||||
}
|
||||
}
|
||||
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<K, V extends StoredUserEntry<K>> {
|
||||
|
||||
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/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 );
|
||||
}
|
||||
}
|
||||
|
223
patches/server/1049-SW-Use-optimized-NeighbourTable.patch
Normale Datei
223
patches/server/1049-SW-Use-optimized-NeighbourTable.patch
Normale Datei
@ -0,0 +1,223 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Tue, 13 Aug 2024 11:44:11 +0200
|
||||
Subject: [PATCH] SW Use optimized NeighbourTable
|
||||
|
||||
|
||||
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..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
|
||||
@@ -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<O, S extends StateHolder<O, S>> {
|
||||
static final Pattern NAME_PATTERN = Pattern.compile("^[a-z0-9_]+$");
|
||||
@@ -41,7 +40,6 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
|
||||
}
|
||||
|
||||
MapCodec<S> mapCodec2 = mapCodec;
|
||||
- Map<Map<Property<?>, Comparable<?>>, S> map = Maps.newLinkedHashMap();
|
||||
List<S> list = Lists.newArrayList();
|
||||
Stream<List<Pair<Property<?>, Comparable<?>>>> stream = Stream.of(Collections.emptyList());
|
||||
|
||||
@@ -53,6 +51,7 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
|
||||
}));
|
||||
}
|
||||
|
||||
+ NeighbourTable<S> table = new NeighbourTable<>(propertiesMap);
|
||||
stream.forEach(list2 -> {
|
||||
Reference2ObjectArrayMap<Property<?>, Comparable<?>> reference2ObjectArrayMap = new Reference2ObjectArrayMap<>(list2.size());
|
||||
|
||||
@@ -61,13 +60,12 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
|
||||
}
|
||||
|
||||
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<O, S extends StateHolder<O, S>> {
|
||||
public interface Factory<O, S> {
|
||||
S create(O owner, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<S> codec);
|
||||
}
|
||||
+
|
||||
+ public static class NeighbourTable<S> {
|
||||
+ private final Map<Property<?>, Pair<Integer, Integer>> offsetMasks;
|
||||
+ private final Object[] array;
|
||||
+
|
||||
+ public NeighbourTable(Map<String, Property<?>> 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<<bits)-1) << offset)));
|
||||
+ offset += bits;
|
||||
+ }
|
||||
+
|
||||
+ array = new Object[1 << offset];
|
||||
+ }
|
||||
+
|
||||
+ public int put(Map<Property<?>, Comparable<?>> key, S value) {
|
||||
+ int index = 0;
|
||||
+ for(Map.Entry<Property<?>, 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<Integer, Integer> 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<Integer, Integer> 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<O, S> {
|
||||
};
|
||||
protected final O owner;
|
||||
private final Reference2ObjectArrayMap<Property<?>, Comparable<?>> values;
|
||||
- private Table<Property<?>, Comparable<?>, S> neighbours;
|
||||
protected final MapCodec<S> propertiesCodec;
|
||||
- protected final io.papermc.paper.util.table.ZeroCollidingReferenceStateTable optimisedTable; // Paper - optimise state lookup
|
||||
+ private StateDefinition.NeighbourTable<S> neighbourTable;
|
||||
+ private int neighbourIndex;
|
||||
|
||||
protected StateHolder(O owner, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<S> 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 <T extends Comparable<T>> S cycle(Property<T> property) {
|
||||
@@ -86,11 +85,11 @@ public abstract class StateHolder<O, S> {
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> boolean hasProperty(Property<T> property) {
|
||||
- return this.optimisedTable.get(property) != null; // Paper - optimise state lookup
|
||||
+ return this.values.containsKey(property);
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> T getValue(Property<T> 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<O, S> {
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> Optional<T> getOptionalValue(Property<T> 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 <T extends Comparable<T>, V extends T> S setValue(Property<T> 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 <T extends Comparable<T>, V extends T> S trySetValue(Property<T> 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<Map<Property<?>, Comparable<?>>, S> states) {
|
||||
- if (this.neighbours != null) {
|
||||
- throw new IllegalStateException();
|
||||
- } else {
|
||||
- Table<Property<?>, Comparable<?>, S> table = HashBasedTable.create();
|
||||
-
|
||||
- for (Entry<Property<?>, 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<Property<?>, 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<S> states, int ownIndex) {
|
||||
+ this.neighbourTable = states;
|
||||
+ this.neighbourIndex = ownIndex;
|
||||
}
|
||||
|
||||
private Map<Property<?>, Comparable<?>> makeNeighbourValues(Property<?> property, Comparable<?> value) {
|
42
patches/server/1050-SW-optimized-Blocks-cache.patch
Normale Datei
42
patches/server/1050-SW-optimized-Blocks-cache.patch
Normale Datei
@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Tue, 13 Aug 2024 11:45:21 +0200
|
||||
Subject: [PATCH] SW optimized Blocks cache
|
||||
|
||||
|
||||
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..3f31a3115c69fd976ccb1e396018d94bba0f3557 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,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);
|
||||
- blockState.initCache();
|
||||
+ //blockState.initCache();
|
||||
}
|
||||
|
||||
- block.getLootTable();
|
||||
+ //block.getLootTable();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lixfel <agga-games@gmx.de>
|
||||
Date: Wed, 1 Feb 2023 21:36:57 +0100
|
||||
Subject: [PATCH] SW Patches
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Tue, 13 Aug 2024 11:45:59 +0200
|
||||
Subject: [PATCH] SW Remove or Optimize Caches
|
||||
|
||||
|
||||
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,46 +95,6 @@ index 4f4f4cb6037c2a46ffcf427f5812164bbb98b8b7..eef5249db9a5808216397dd03b882dcb
|
||||
return ret == null ? FLATTENED_BY_ID[0] : ret;
|
||||
}
|
||||
|
||||
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<G, W> {
|
||||
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<GlobalConfiguration, Wor
|
||||
|
||||
// Symlinks are not correctly checked in createDirectories
|
||||
static void createDirectoriesSymlinkAware(Path path) throws IOException {
|
||||
- if (!Files.isDirectory(path)) {
|
||||
- Files.createDirectories(path);
|
||||
- }
|
||||
+ // do nothing
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/util/ObfHelper.java b/src/main/java/io/papermc/paper/util/ObfHelper.java
|
||||
index 6067be951c4c52c4b1da51efc01436b2c90ea3bf..da32dbdb0e78a30e812c87065ebdc74a6623d81e 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/ObfHelper.java
|
||||
@ -148,181 +108,6 @@ index 6067be951c4c52c4b1da51efc01436b2c90ea3bf..da32dbdb0e78a30e812c87065ebdc74a
|
||||
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<K, V extends StoredUserEntry<K>> {
|
||||
|
||||
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
|
||||
@ -9992,490 +9777,3 @@ index f06a35024af284addf41dfe160849e8e5e15e822..ca945f615cc9699660809afd0fd96092
|
||||
}
|
||||
}
|
||||
}
|
||||
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..3f31a3115c69fd976ccb1e396018d94bba0f3557 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,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);
|
||||
- blockState.initCache();
|
||||
+ //blockState.initCache();
|
||||
}
|
||||
|
||||
- block.getLootTable();
|
||||
+ //block.getLootTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
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..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;
|
||||
import com.google.common.collect.ImmutableMap.Builder;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import java.util.Map;
|
||||
+import java.util.Objects;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
@@ -35,8 +36,14 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
public static final EnumProperty<WallSide> SOUTH_WALL = BlockStateProperties.SOUTH_WALL;
|
||||
public static final EnumProperty<WallSide> WEST_WALL = BlockStateProperties.WEST_WALL;
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
- private final Map<BlockState, VoxelShape> shapeByIndex;
|
||||
- private final Map<BlockState, VoxelShape> collisionShapeByIndex;
|
||||
+ private static final Map<Integer, VoxelShape> shapeByIndex;
|
||||
+ private static final Map<Integer, 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;
|
||||
@@ -66,8 +73,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
.setValue(WEST_WALL, WallSide.NONE)
|
||||
.setValue(WATERLOGGED, Boolean.valueOf(false))
|
||||
);
|
||||
- this.shapeByIndex = this.makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 14.0F, 16.0F);
|
||||
- this.collisionShapeByIndex = this.makeShapes(4.0F, 3.0F, 24.0F, 0.0F, 24.0F, 24.0F);
|
||||
}
|
||||
|
||||
private static VoxelShape applyWallShape(VoxelShape base, WallSide wallShape, VoxelShape tall, VoxelShape low) {
|
||||
@@ -78,7 +83,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
}
|
||||
}
|
||||
|
||||
- private Map<BlockState, VoxelShape> makeShapes(float f, float g, float h, float i, float j, float k) {
|
||||
+ private static Map<Integer, 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 +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<BlockState, VoxelShape> builder = ImmutableMap.builder();
|
||||
+ Builder<Integer, VoxelShape> builder = ImmutableMap.builder();
|
||||
|
||||
for (Boolean boolean_ : UP.getPossibleValues()) {
|
||||
for (WallSide wallSide : EAST_WALL.getPossibleValues()) {
|
||||
@@ -108,14 +113,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
voxelShape10 = Shapes.or(voxelShape10, voxelShape);
|
||||
}
|
||||
|
||||
- BlockState blockState = this.defaultBlockState()
|
||||
- .setValue(UP, boolean_)
|
||||
- .setValue(EAST_WALL, wallSide)
|
||||
- .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(hashWallState(wallSide, wallSide2, wallSide4, boolean_, Boolean.FALSE, wallSide3), voxelShape10);
|
||||
+ builder.put(hashWallState(wallSide, wallSide2, wallSide4, boolean_, Boolean.TRUE , wallSide3), voxelShape10);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,14 +124,36 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
+ private static int mapHashCode(Map<Property<?>, Comparable<?>> values) {
|
||||
+ return hashWallState(
|
||||
+ (WallSide) values.get(EAST_WALL),
|
||||
+ (WallSide) values.get(NORTH_WALL),
|
||||
+ (WallSide) values.get(SOUTH_WALL),
|
||||
+ (Boolean) values.get(UP),
|
||||
+ (Boolean) values.get(WATERLOGGED),
|
||||
+ (WallSide) values.get(WEST_WALL)
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ private static int hashWallState(WallSide east, WallSide north, WallSide south, boolean up, boolean waterlogged, WallSide west) {
|
||||
+ int hash = 7;
|
||||
+ hash = 31 * hash + east.hashCode();
|
||||
+ hash = 31 * hash + north.hashCode();
|
||||
+ hash = 31 * hash + south.hashCode();
|
||||
+ hash = 31 * hash + Objects.hashCode(up);
|
||||
+ hash = 31 * hash + Objects.hashCode(waterlogged);
|
||||
+ hash = 31 * hash + west.hashCode();
|
||||
+ return hash;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
- return this.shapeByIndex.get(state);
|
||||
+ return shapeByIndex.get(mapHashCode(state.getValues()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
- 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 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
|
||||
@@ -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<O, S extends StateHolder<O, S>> {
|
||||
static final Pattern NAME_PATTERN = Pattern.compile("^[a-z0-9_]+$");
|
||||
@@ -41,7 +40,6 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
|
||||
}
|
||||
|
||||
MapCodec<S> mapCodec2 = mapCodec;
|
||||
- Map<Map<Property<?>, Comparable<?>>, S> map = Maps.newLinkedHashMap();
|
||||
List<S> list = Lists.newArrayList();
|
||||
Stream<List<Pair<Property<?>, Comparable<?>>>> stream = Stream.of(Collections.emptyList());
|
||||
|
||||
@@ -53,6 +51,7 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
|
||||
}));
|
||||
}
|
||||
|
||||
+ NeighbourTable<S> table = new NeighbourTable<>(propertiesMap);
|
||||
stream.forEach(list2 -> {
|
||||
Reference2ObjectArrayMap<Property<?>, Comparable<?>> reference2ObjectArrayMap = new Reference2ObjectArrayMap<>(list2.size());
|
||||
|
||||
@@ -61,13 +60,12 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
|
||||
}
|
||||
|
||||
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<O, S extends StateHolder<O, S>> {
|
||||
public interface Factory<O, S> {
|
||||
S create(O owner, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<S> codec);
|
||||
}
|
||||
+
|
||||
+ public static class NeighbourTable<S> {
|
||||
+ private final Map<Property<?>, Pair<Integer, Integer>> offsetMasks;
|
||||
+ private final Object[] array;
|
||||
+
|
||||
+ public NeighbourTable(Map<String, Property<?>> 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<<bits)-1) << offset)));
|
||||
+ offset += bits;
|
||||
+ }
|
||||
+
|
||||
+ array = new Object[1 << offset];
|
||||
+ }
|
||||
+
|
||||
+ public int put(Map<Property<?>, Comparable<?>> key, S value) {
|
||||
+ int index = 0;
|
||||
+ for(Map.Entry<Property<?>, 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<Integer, Integer> 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<Integer, Integer> 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<O, S> {
|
||||
};
|
||||
protected final O owner;
|
||||
private final Reference2ObjectArrayMap<Property<?>, Comparable<?>> values;
|
||||
- private Table<Property<?>, Comparable<?>, S> neighbours;
|
||||
protected final MapCodec<S> propertiesCodec;
|
||||
- protected final io.papermc.paper.util.table.ZeroCollidingReferenceStateTable optimisedTable; // Paper - optimise state lookup
|
||||
+ private StateDefinition.NeighbourTable<S> neighbourTable;
|
||||
+ private int neighbourIndex;
|
||||
|
||||
protected StateHolder(O owner, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<S> 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 <T extends Comparable<T>> S cycle(Property<T> property) {
|
||||
@@ -86,11 +85,11 @@ public abstract class StateHolder<O, S> {
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> boolean hasProperty(Property<T> property) {
|
||||
- return this.optimisedTable.get(property) != null; // Paper - optimise state lookup
|
||||
+ return this.values.containsKey(property);
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> T getValue(Property<T> 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<O, S> {
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> Optional<T> getOptionalValue(Property<T> 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 <T extends Comparable<T>, V extends T> S setValue(Property<T> 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 <T extends Comparable<T>, V extends T> S trySetValue(Property<T> 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<Map<Property<?>, Comparable<?>>, S> states) {
|
||||
- if (this.neighbours != null) {
|
||||
- throw new IllegalStateException();
|
||||
- } else {
|
||||
- Table<Property<?>, Comparable<?>, S> table = HashBasedTable.create();
|
||||
-
|
||||
- for (Entry<Property<?>, 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<Property<?>, 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<S> states, int ownIndex) {
|
||||
+ this.neighbourTable = states;
|
||||
+ this.neighbourIndex = ownIndex;
|
||||
}
|
||||
|
||||
private Map<Property<?>, 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<LevelResource, Path> 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<Path> 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 );
|
||||
}
|
||||
}
|
||||
|
150
patches/server/1052-SW-Disable-Commands.patch
Normale Datei
150
patches/server/1052-SW-Disable-Commands.patch
Normale Datei
@ -0,0 +1,150 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Tue, 13 Aug 2024 11:46:11 +0200
|
||||
Subject: [PATCH] SW Disable Commands
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
84
patches/server/1053-SW-Some-Util-Stuff.patch
Normale Datei
84
patches/server/1053-SW-Some-Util-Stuff.patch
Normale Datei
@ -0,0 +1,84 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chaoscaot <chaos@chaoscaot.de>
|
||||
Date: Tue, 13 Aug 2024 11:46:27 +0200
|
||||
Subject: [PATCH] SW Some Util Stuff
|
||||
|
||||
|
||||
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/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<LevelResource, Path> 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<Path> 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() {
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren