Dieser Commit ist enthalten in:
Ursprung
302edbb874
Commit
50cd3e49a4
@ -1,223 +0,0 @@
|
|||||||
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) {
|
|
@ -5,7 +5,7 @@ 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
|
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
|
index 727fe0cd3d9d64812c66dde3429fb2839b145426..a31c004bc4800bc6adb437eaf0c3ac543562129a 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/WallBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/WallBlock.java
|
||||||
+++ b/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;
|
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
@ -16,7 +16,7 @@ index 83956032bef4d34eddb9899f0a2847e66bfd83f4..bea1d8a72d5528335b755aeda6168764
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
@@ -35,8 +36,14 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
@@ -36,8 +37,14 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||||
public static final EnumProperty<WallSide> SOUTH_WALL = BlockStateProperties.SOUTH_WALL;
|
public static final EnumProperty<WallSide> SOUTH_WALL = BlockStateProperties.SOUTH_WALL;
|
||||||
public static final EnumProperty<WallSide> WEST_WALL = BlockStateProperties.WEST_WALL;
|
public static final EnumProperty<WallSide> WEST_WALL = BlockStateProperties.WEST_WALL;
|
||||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||||
@ -33,7 +33,7 @@ index 83956032bef4d34eddb9899f0a2847e66bfd83f4..bea1d8a72d5528335b755aeda6168764
|
|||||||
private static final int WALL_WIDTH = 3;
|
private static final int WALL_WIDTH = 3;
|
||||||
private static final int WALL_HEIGHT = 14;
|
private static final int WALL_HEIGHT = 14;
|
||||||
private static final int POST_WIDTH = 4;
|
private static final int POST_WIDTH = 4;
|
||||||
@@ -66,8 +73,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
@@ -67,8 +74,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||||
.setValue(WEST_WALL, WallSide.NONE)
|
.setValue(WEST_WALL, WallSide.NONE)
|
||||||
.setValue(WATERLOGGED, Boolean.valueOf(false))
|
.setValue(WATERLOGGED, Boolean.valueOf(false))
|
||||||
);
|
);
|
||||||
@ -42,7 +42,7 @@ index 83956032bef4d34eddb9899f0a2847e66bfd83f4..bea1d8a72d5528335b755aeda6168764
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static VoxelShape applyWallShape(VoxelShape base, WallSide wallShape, VoxelShape tall, VoxelShape low) {
|
private static VoxelShape applyWallShape(VoxelShape base, WallSide wallShape, VoxelShape tall, VoxelShape low) {
|
||||||
@@ -78,7 +83,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
@@ -79,7 +84,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ index 83956032bef4d34eddb9899f0a2847e66bfd83f4..bea1d8a72d5528335b755aeda6168764
|
|||||||
float l = 8.0F - f;
|
float l = 8.0F - f;
|
||||||
float m = 8.0F + f;
|
float m = 8.0F + f;
|
||||||
float n = 8.0F - g;
|
float n = 8.0F - g;
|
||||||
@@ -92,7 +97,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
@@ -93,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 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 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);
|
VoxelShape voxelShape9 = Block.box((double)n, (double)i, (double)n, 16.0, (double)k, (double)o);
|
||||||
@ -60,7 +60,7 @@ index 83956032bef4d34eddb9899f0a2847e66bfd83f4..bea1d8a72d5528335b755aeda6168764
|
|||||||
|
|
||||||
for (Boolean boolean_ : UP.getPossibleValues()) {
|
for (Boolean boolean_ : UP.getPossibleValues()) {
|
||||||
for (WallSide wallSide : EAST_WALL.getPossibleValues()) {
|
for (WallSide wallSide : EAST_WALL.getPossibleValues()) {
|
||||||
@@ -108,14 +113,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
@@ -109,14 +114,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||||
voxelShape10 = Shapes.or(voxelShape10, voxelShape);
|
voxelShape10 = Shapes.or(voxelShape10, voxelShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ index 83956032bef4d34eddb9899f0a2847e66bfd83f4..bea1d8a72d5528335b755aeda6168764
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,14 +124,36 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
@@ -126,14 +125,36 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
@ -31,10 +31,10 @@ index 87e5f614ba988547a827486740db217e28585773..c83eae306debfe34fb6383cb83a3dad0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
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
|
index 1029b6de6f36b08bf634b4056ef5701383f6f258..de339141e8d7f321ccdec1811d5a25bd1a23842c 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
+++ b/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
|
@@ -460,8 +460,6 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
|
|
||||||
// Symlinks are not correctly checked in createDirectories
|
// Symlinks are not correctly checked in createDirectories
|
||||||
static void createDirectoriesSymlinkAware(Path path) throws IOException {
|
static void createDirectoriesSymlinkAware(Path path) throws IOException {
|
||||||
@ -76,10 +76,10 @@ index c038da20b76c0b7b1c18471b20be01e849d29f3a..f5611bf250aaa2851ca8873291c7f4b6
|
|||||||
try {
|
try {
|
||||||
StoredUserList.GSON.toJson(jsonarray, StoredUserList.GSON.newJsonWriter(bufferedwriter));
|
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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index f6de1c6e8fd9086b7bd725f75ee2606583591d6a..18e552458b29e79e01e4372cd8ccd2d0556de99e 100644
|
index dfddcfb1fe1679adaecf75375757dca720e76ce1..710f9dbe3e031a7938c49bc443ec05a5c6214702 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/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 {
|
@@ -505,7 +505,7 @@ public final class CraftServer implements Server {
|
||||||
try {
|
try {
|
||||||
this.configuration.save(this.getConfigFile());
|
this.configuration.save(this.getConfigFile());
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
@ -88,7 +88,7 @@ index f6de1c6e8fd9086b7bd725f75ee2606583591d6a..18e552458b29e79e01e4372cd8ccd2d0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,7 +510,7 @@ public final class CraftServer implements Server {
|
@@ -513,7 +513,7 @@ public final class CraftServer implements Server {
|
||||||
try {
|
try {
|
||||||
this.commandsConfiguration.save(this.getCommandsConfigFile());
|
this.commandsConfiguration.save(this.getCommandsConfigFile());
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
@ -97,7 +97,7 @@ index f6de1c6e8fd9086b7bd725f75ee2606583591d6a..18e552458b29e79e01e4372cd8ccd2d0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,7 +600,7 @@ public final class CraftServer implements Server {
|
@@ -603,7 +603,7 @@ public final class CraftServer implements Server {
|
||||||
DefaultPermissions.registerCorePermissions();
|
DefaultPermissions.registerCorePermissions();
|
||||||
CraftDefaultPermissions.registerCorePermissions();
|
CraftDefaultPermissions.registerCorePermissions();
|
||||||
if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper
|
if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper
|
@ -5,46 +5,37 @@ 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
|
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
|
index 66a07f7cbf1c1d6ecbe055cbf4f63eb07d93e90c..7c575af374aff20e7fc4ca2aaf2bdf25dbd4526b 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java
|
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java
|
||||||
+++ b/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 @@
|
@@ -1,7 +1,10 @@
|
||||||
package net.minecraft.world.level.block;
|
package net.minecraft.world.level.block;
|
||||||
|
|
||||||
+import java.util.concurrent.ExecutorService;
|
+import java.util.concurrent.ExecutorService;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.ToIntFunction;
|
import java.util.function.ToIntFunction;
|
||||||
+import net.minecraft.Util;
|
+import net.minecraft.Util;
|
||||||
import javax.annotation.Nullable;
|
+import javax.annotation.Nullable;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
@@ -7797,17 +7799,18 @@ public class Blocks {
|
import net.minecraft.core.Registry;
|
||||||
}
|
@@ -6897,8 +6900,10 @@ 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 (Block block : BuiltInRegistries.BLOCK) {
|
||||||
for (BlockState blockState : block.getStateDefinition().getPossibleStates()) {
|
for (BlockState blockState : block.getStateDefinition().getPossibleStates()) {
|
||||||
Block.BLOCK_STATE_REGISTRY.add(blockState);
|
Block.BLOCK_STATE_REGISTRY.add(blockState);
|
||||||
- blockState.initCache();
|
- blockState.initCache();
|
||||||
+ //blockState.initCache();
|
+ //blockState.initCache();
|
||||||
}
|
}
|
||||||
|
+
|
||||||
- block.getLootTable();
|
|
||||||
+ //block.getLootTable();
|
+ //block.getLootTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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
|
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 d0109633e8bdf109cfc9178963d7b6cf92f8b189..ea142873eaeb6cd0ebf4eb65a7ed582cfe80c709 100644
|
index 99fd67a78539133adf78d65e2c520ff3dd260301..0f077ce5b3ce5a5c9fa149a9bce6035070eb98dd 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||||
@@ -78,6 +78,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
@@ -81,6 +81,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
@ -52,7 +43,7 @@ index d0109633e8bdf109cfc9178963d7b6cf92f8b189..ea142873eaeb6cd0ebf4eb65a7ed582c
|
|||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.Shapes;
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
@@ -1436,7 +1437,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
@@ -1469,7 +1470,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -9744,7 +9744,7 @@ index 6b1af6df2427a6c2f7954c89935bf33279d58204..51f32a847c954846fb0c18e802287a26
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/biome/Climate.java b/src/main/java/net/minecraft/world/level/biome/Climate.java
|
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
|
index 58133c5984f72b531277dbaf27f971a11791b7ce..14c6eeeafadf317011795e53395a14db599beda9 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/biome/Climate.java
|
--- a/src/main/java/net/minecraft/world/level/biome/Climate.java
|
||||||
+++ b/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 {
|
@@ -258,7 +258,14 @@ public class Climate {
|
@ -5,10 +5,10 @@ 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
|
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||||
index 1d1e76de60e40224f5cb81893f9ee50fe987badb..c2367bcc8dafb71877259dfb46accb42a743d0ee 100644
|
index 260350422fc724ba5cd5769cbb387b6007f36a84..c6e6203053b5f693f20417864a1dce33cbf8352d 100644
|
||||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||||
@@ -156,65 +156,64 @@ public class Commands {
|
@@ -160,66 +160,66 @@ public class Commands {
|
||||||
|
|
||||||
public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) {
|
public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) {
|
||||||
// Paper
|
// Paper
|
||||||
@ -49,7 +49,7 @@ index 1d1e76de60e40224f5cb81893f9ee50fe987badb..c2367bcc8dafb71877259dfb46accb42
|
|||||||
+ //ForceLoadCommand.register(this.dispatcher);
|
+ //ForceLoadCommand.register(this.dispatcher);
|
||||||
+ //FunctionCommand.register(this.dispatcher);
|
+ //FunctionCommand.register(this.dispatcher);
|
||||||
GameModeCommand.register(this.dispatcher);
|
GameModeCommand.register(this.dispatcher);
|
||||||
GameRuleCommand.register(this.dispatcher);
|
GameRuleCommand.register(this.dispatcher, commandRegistryAccess);
|
||||||
GiveCommand.register(this.dispatcher, commandRegistryAccess);
|
GiveCommand.register(this.dispatcher, commandRegistryAccess);
|
||||||
- HelpCommand.register(this.dispatcher);
|
- HelpCommand.register(this.dispatcher);
|
||||||
- ItemCommands.register(this.dispatcher, commandRegistryAccess);
|
- ItemCommands.register(this.dispatcher, commandRegistryAccess);
|
||||||
@ -69,12 +69,6 @@ index 1d1e76de60e40224f5cb81893f9ee50fe987badb..c2367bcc8dafb71877259dfb46accb42
|
|||||||
- RecipeCommand.register(this.dispatcher);
|
- RecipeCommand.register(this.dispatcher);
|
||||||
- ReturnCommand.register(this.dispatcher);
|
- ReturnCommand.register(this.dispatcher);
|
||||||
- RideCommand.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);
|
+ //ListPlayersCommand.register(this.dispatcher);
|
||||||
+ //LocateCommand.register(this.dispatcher, commandRegistryAccess);
|
+ //LocateCommand.register(this.dispatcher, commandRegistryAccess);
|
||||||
+ //LootCommand.register(this.dispatcher, commandRegistryAccess);
|
+ //LootCommand.register(this.dispatcher, commandRegistryAccess);
|
||||||
@ -82,13 +76,21 @@ index 1d1e76de60e40224f5cb81893f9ee50fe987badb..c2367bcc8dafb71877259dfb46accb42
|
|||||||
+ //ParticleCommand.register(this.dispatcher, commandRegistryAccess);
|
+ //ParticleCommand.register(this.dispatcher, commandRegistryAccess);
|
||||||
+ //PlaceCommand.register(this.dispatcher);
|
+ //PlaceCommand.register(this.dispatcher);
|
||||||
+ //PlaySoundCommand.register(this.dispatcher);
|
+ //PlaySoundCommand.register(this.dispatcher);
|
||||||
|
+ //RandomCommand.register(this.dispatcher);
|
||||||
+ //ReloadCommand.register(this.dispatcher);
|
+ //ReloadCommand.register(this.dispatcher);
|
||||||
+ //RecipeCommand.register(this.dispatcher);
|
+ //RecipeCommand.register(this.dispatcher);
|
||||||
+ //ReturnCommand.register(this.dispatcher);
|
+ //ReturnCommand.register(this.dispatcher);
|
||||||
+ //RideCommand.register(this.dispatcher);
|
+ //RideCommand.register(this.dispatcher);
|
||||||
|
RotateCommand.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);
|
||||||
+ //SayCommand.register(this.dispatcher);
|
+ //SayCommand.register(this.dispatcher);
|
||||||
+ //ScheduleCommand.register(this.dispatcher);
|
+ //ScheduleCommand.register(this.dispatcher);
|
||||||
+ //ScoreboardCommand.register(this.dispatcher);
|
+ //ScoreboardCommand.register(this.dispatcher, commandRegistryAccess);
|
||||||
+ //SeedCommand.register(this.dispatcher, environment != Commands.CommandSelection.INTEGRATED);
|
+ //SeedCommand.register(this.dispatcher, environment != Commands.CommandSelection.INTEGRATED);
|
||||||
+ //SetBlockCommand.register(this.dispatcher, commandRegistryAccess);
|
+ //SetBlockCommand.register(this.dispatcher, commandRegistryAccess);
|
||||||
+ //SetSpawnCommand.register(this.dispatcher);
|
+ //SetSpawnCommand.register(this.dispatcher);
|
||||||
@ -117,7 +119,7 @@ index 1d1e76de60e40224f5cb81893f9ee50fe987badb..c2367bcc8dafb71877259dfb46accb42
|
|||||||
WeatherCommand.register(this.dispatcher);
|
WeatherCommand.register(this.dispatcher);
|
||||||
WorldBorderCommand.register(this.dispatcher);
|
WorldBorderCommand.register(this.dispatcher);
|
||||||
if (JvmProfiler.INSTANCE.isAvailable()) {
|
if (JvmProfiler.INSTANCE.isAvailable()) {
|
||||||
@@ -235,20 +234,20 @@ public class Commands {
|
@@ -240,20 +240,20 @@ public class Commands {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment.includeDedicated) {
|
if (environment.includeDedicated) {
|
@ -5,7 +5,7 @@ Subject: [PATCH] SW Remove World Lock
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
|
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
|
index cdca5ae69991cc068bfbc0686b5defb3604a5440..7cbfc8c4fc3fd4deecacb7a4243ec90efaf40809 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
|
--- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
|
||||||
+++ b/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 {
|
@@ -507,7 +507,6 @@ public class LevelStorageSource {
|
@ -4,8 +4,8 @@ build:
|
|||||||
- "JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ./gradlew --stop"
|
- "JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ./gradlew --stop"
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
"/binarys/paper-1.21.jar": "build/libs/paper-bundler-1.21.1-R0.1-SNAPSHOT-reobf.jar"
|
"/binarys/paper-1.21.jar": "build/libs/paper-bundler-1.21.3-R0.1-SNAPSHOT-reobf.jar"
|
||||||
"/binarys/spigot-1.21-inner.jar": "Paper-Server/build/libs/paper-server-1.21.1-R0.1-SNAPSHOT-reobf.jar"
|
"/binarys/spigot-1.21-inner.jar": "Paper-Server/build/libs/paper-server-1.21.3-R0.1-SNAPSHOT-reobf.jar"
|
||||||
|
|
||||||
release:
|
release:
|
||||||
- "mvn deploy:deploy-file -DgroupId=de.steamwar -DartifactId=spigot -Dversion=1.21 -Dpackaging=jar -Dfile=Paper-Server/build/libs/paper-server-1.21.1-R0.1-SNAPSHOT-reobf.jar -Durl=file:///var/www/html/maven/"
|
- "mvn deploy:deploy-file -DgroupId=de.steamwar -DartifactId=spigot -Dversion=1.21 -Dpackaging=jar -Dfile=Paper-Server/build/libs/paper-server-1.21.1-R0.1-SNAPSHOT-reobf.jar -Durl=file:///var/www/html/maven/"
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren