geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Ursprung
9b92b0b328
Commit
b3c5a9b5bb
@ -9766,10 +9766,29 @@ index 475cd0583e99495ca0df665da19cc382a8d5e7ea..3f31a3115c69fd976ccb1e396018d94b
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/WallBlock.java b/src/main/java/net/minecraft/world/level/block/WallBlock.java
|
||||
index 24eb3b5c805a5df9b029b4a2a98f2a3720065e5e..355f48538ca84d383034e3cdef46b964d986b292 100644
|
||||
index 24eb3b5c805a5df9b029b4a2a98f2a3720065e5e..bea1d8a72d5528335b755aeda6168764778b924f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/WallBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/WallBlock.java
|
||||
@@ -72,8 +72,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
@@ -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,8 @@ 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 static final Map<ImmutableMap<Property<?>, Comparable<?>>, VoxelShape> shapeByIndex;
|
||||
- private static final Map<ImmutableMap<Property<?>, Comparable<?>>, 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);
|
||||
@@ -72,8 +73,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
.setValue(WEST_WALL, WallSide.NONE)
|
||||
.setValue(WATERLOGGED, Boolean.valueOf(false))
|
||||
);
|
||||
@ -9778,7 +9797,25 @@ index 24eb3b5c805a5df9b029b4a2a98f2a3720065e5e..355f48538ca84d383034e3cdef46b964
|
||||
}
|
||||
|
||||
private static VoxelShape applyWallShape(VoxelShape base, WallSide wallShape, VoxelShape tall, VoxelShape low) {
|
||||
@@ -114,12 +112,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
@@ -84,7 +83,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
}
|
||||
}
|
||||
|
||||
- private static Map<ImmutableMap<Property<?>, Comparable<?>>, 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;
|
||||
@@ -98,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<ImmutableMap<Property<?>, Comparable<?>>, VoxelShape> builder = ImmutableMap.builder();
|
||||
+ Builder<Integer, VoxelShape> builder = ImmutableMap.builder();
|
||||
|
||||
for (Boolean boolean_ : UP.getPossibleValues()) {
|
||||
for (WallSide wallSide : EAST_WALL.getPossibleValues()) {
|
||||
@@ -114,14 +113,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
voxelShape10 = Shapes.or(voxelShape10, voxelShape);
|
||||
}
|
||||
|
||||
@ -9788,9 +9825,52 @@ index 24eb3b5c805a5df9b029b4a2a98f2a3720065e5e..355f48538ca84d383034e3cdef46b964
|
||||
- .setValue(WEST_WALL, wallSide3)
|
||||
- .setValue(NORTH_WALL, wallSide2)
|
||||
- .setValue(SOUTH_WALL, wallSide4);
|
||||
builder.put(ImmutableMap.of(UP, boolean_, EAST_WALL, wallSide, WEST_WALL, wallSide3, NORTH_WALL, wallSide2, SOUTH_WALL, wallSide4, WATERLOGGED, Boolean.FALSE), voxelShape10);
|
||||
builder.put(ImmutableMap.of(UP, boolean_, EAST_WALL, wallSide, WEST_WALL, wallSide3, NORTH_WALL, wallSide2, SOUTH_WALL, wallSide4, WATERLOGGED, Boolean.TRUE), voxelShape10);
|
||||
- builder.put(ImmutableMap.of(UP, boolean_, EAST_WALL, wallSide, WEST_WALL, wallSide3, NORTH_WALL, wallSide2, SOUTH_WALL, wallSide4, WATERLOGGED, Boolean.FALSE), voxelShape10);
|
||||
- builder.put(ImmutableMap.of(UP, boolean_, EAST_WALL, wallSide, WEST_WALL, wallSide3, NORTH_WALL, wallSide2, SOUTH_WALL, wallSide4, WATERLOGGED, Boolean.TRUE), voxelShape10);
|
||||
+ builder.put(hashWallState(wallSide, wallSide2, wallSide4, boolean_, Boolean.FALSE, wallSide3), voxelShape10);
|
||||
+ builder.put(hashWallState(wallSide, wallSide2, wallSide4, boolean_, Boolean.TRUE , wallSide3), voxelShape10);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,14 +124,36 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
|
||||
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 shapeByIndex.get(state.getValues());
|
||||
+ return shapeByIndex.get(mapHashCode(state.getValues()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
- return collisionShapeByIndex.get(state.getValues());
|
||||
+ return collisionShapeByIndex.get(mapHashCode(state.getValues()));
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java b/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java
|
||||
index 0df8011cd0809045986179e49ef7e2f459168f07..3a449e13951ea183b9ae7910a424b51e841608da 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren