mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
Cache direction values
micro opt
This commit is contained in:
@@ -4,6 +4,7 @@ protected net.minecraft.world.entity.Entity dimensions
|
|||||||
protected net.minecraft.world.entity.ai.goal.RemoveBlockGoal blockToRemove
|
protected net.minecraft.world.entity.ai.goal.RemoveBlockGoal blockToRemove
|
||||||
protected net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal getTargetConditions()Lnet/minecraft/world/entity/ai/targeting/TargetingConditions;
|
protected net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal getTargetConditions()Lnet/minecraft/world/entity/ai/targeting/TargetingConditions;
|
||||||
protected-f net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase$Cache largeCollisionShape
|
protected-f net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase$Cache largeCollisionShape
|
||||||
|
public net.minecraft.core.Direction VALUES
|
||||||
public net.minecraft.server.level.ServerChunkCache fullChunks
|
public net.minecraft.server.level.ServerChunkCache fullChunks
|
||||||
public net.minecraft.server.level.ServerEntity sendDirtyEntityData()V
|
public net.minecraft.server.level.ServerEntity sendDirtyEntityData()V
|
||||||
public net.minecraft.util.Mth SIN
|
public net.minecraft.util.Mth SIN
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Some random optimizations
|
|||||||
|
|
||||||
- Remove Paper's dead code
|
- Remove Paper's dead code
|
||||||
- Only set shuffle random seed if is really used
|
- Only set shuffle random seed if is really used
|
||||||
|
- Cache direction values to skip copy
|
||||||
- Secret patches (WIP)
|
- Secret patches (WIP)
|
||||||
|
|
||||||
diff --git a/net/minecraft/Util.java b/net/minecraft/Util.java
|
diff --git a/net/minecraft/Util.java b/net/minecraft/Util.java
|
||||||
@@ -234,6 +235,248 @@ index 80baa2dff5c1034a72271fc727fdb2acc1b69488..9f581d5bdc3f658694bbd8c80abbce4e
|
|||||||
int floor = Mth.floor(x);
|
int floor = Mth.floor(x);
|
||||||
int floor1 = Mth.floor(y);
|
int floor1 = Mth.floor(y);
|
||||||
int floor2 = Mth.floor(z);
|
int floor2 = Mth.floor(z);
|
||||||
|
diff --git a/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java b/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java
|
||||||
|
index e804ca8d6c9c9b8d9f982a970cc3edddf5c03aa1..0a4ca9f0dba64c5539b99af5d95292159f51b6ba 100644
|
||||||
|
--- a/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java
|
||||||
|
+++ b/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java
|
||||||
|
@@ -43,7 +43,7 @@ public abstract class BaseCoralPlantTypeBlock extends Block implements SimpleWat
|
||||||
|
if (state.getValue(WATERLOGGED)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (level.getFluidState(pos.relative(direction)).is(FluidTags.WATER)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
diff --git a/net/minecraft/world/level/block/BaseFireBlock.java b/net/minecraft/world/level/block/BaseFireBlock.java
|
||||||
|
index 45df9f008b74dd0d6d790c91102e9afe1da45633..baee320ad6f1918cc9009db9f65c28e33a544e19 100644
|
||||||
|
--- a/net/minecraft/world/level/block/BaseFireBlock.java
|
||||||
|
+++ b/net/minecraft/world/level/block/BaseFireBlock.java
|
||||||
|
@@ -204,7 +204,7 @@ public abstract class BaseFireBlock extends Block {
|
||||||
|
BlockPos.MutableBlockPos mutableBlockPos = pos.mutable();
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
|
- for (Direction direction1 : Direction.values()) {
|
||||||
|
+ for (Direction direction1 : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (level.getBlockState(mutableBlockPos.set(pos).move(direction1)).is(Blocks.OBSIDIAN)) {
|
||||||
|
flag = true;
|
||||||
|
break;
|
||||||
|
diff --git a/net/minecraft/world/level/block/FireBlock.java b/net/minecraft/world/level/block/FireBlock.java
|
||||||
|
index 7340c664fdcf991a2549c8f07f6ab093bbe6e4e8..90f1a971888a76ab3f8522d86a9f9f240ef76a53 100644
|
||||||
|
--- a/net/minecraft/world/level/block/FireBlock.java
|
||||||
|
+++ b/net/minecraft/world/level/block/FireBlock.java
|
||||||
|
@@ -159,7 +159,7 @@ public class FireBlock extends BaseFireBlock {
|
||||||
|
if (!this.canBurn(blockState) && !blockState.isFaceSturdy(level, blockPos, Direction.UP)) {
|
||||||
|
BlockState blockState1 = this.defaultBlockState();
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
BooleanProperty booleanProperty = PROPERTY_BY_DIRECTION.get(direction);
|
||||||
|
if (booleanProperty != null) {
|
||||||
|
blockState1 = blockState1.setValue(booleanProperty, Boolean.valueOf(this.canBurn(level.getBlockState(pos.relative(direction)))));
|
||||||
|
@@ -331,7 +331,7 @@ public class FireBlock extends BaseFireBlock {
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidFireLocation(BlockGetter level, BlockPos pos) {
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (this.canBurn(level.getBlockState(pos.relative(direction)))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@@ -346,7 +346,7 @@ public class FireBlock extends BaseFireBlock {
|
||||||
|
} else {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
BlockState blockState = level.getBlockState(pos.relative(direction));
|
||||||
|
i = Math.max(this.getIgniteOdds(blockState), i);
|
||||||
|
}
|
||||||
|
diff --git a/net/minecraft/world/level/block/FrostedIceBlock.java b/net/minecraft/world/level/block/FrostedIceBlock.java
|
||||||
|
index 8eb24bf0477c8d0cf4bfa7f122bbcd20aa2a5d5b..3035455cd9d8c238e33d493935a8498687d6a303 100644
|
||||||
|
--- a/net/minecraft/world/level/block/FrostedIceBlock.java
|
||||||
|
+++ b/net/minecraft/world/level/block/FrostedIceBlock.java
|
||||||
|
@@ -48,7 +48,7 @@ public class FrostedIceBlock extends IceBlock {
|
||||||
|
&& this.slightlyMelt(state, level, pos)) {
|
||||||
|
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
mutableBlockPos.setWithOffset(pos, direction);
|
||||||
|
BlockState blockState = level.getBlockState(mutableBlockPos);
|
||||||
|
if (blockState.is(this) && !this.slightlyMelt(blockState, level, mutableBlockPos)) {
|
||||||
|
@@ -84,7 +84,7 @@ public class FrostedIceBlock extends IceBlock {
|
||||||
|
int i = 0;
|
||||||
|
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
mutableBlockPos.setWithOffset(pos, direction);
|
||||||
|
if (level.getBlockState(mutableBlockPos).is(this)) {
|
||||||
|
if (++i >= neighborsRequired) {
|
||||||
|
diff --git a/net/minecraft/world/level/block/LeavesBlock.java b/net/minecraft/world/level/block/LeavesBlock.java
|
||||||
|
index a97b22e5acb791e959c528ccb330fa5ff92251e4..ca1a1661642a8ddd66d0e180be996a978a150730 100644
|
||||||
|
--- a/net/minecraft/world/level/block/LeavesBlock.java
|
||||||
|
+++ b/net/minecraft/world/level/block/LeavesBlock.java
|
||||||
|
@@ -117,7 +117,7 @@ public class LeavesBlock extends Block implements SimpleWaterloggedBlock {
|
||||||
|
int i = 7;
|
||||||
|
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
mutableBlockPos.setWithOffset(pos, direction);
|
||||||
|
i = Math.min(i, getDistanceAt(level.getBlockState(mutableBlockPos)) + 1);
|
||||||
|
if (i == 1) {
|
||||||
|
diff --git a/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||||
|
index 41802482875bd4d4b505eb758740140de0db415a..8301a6d0fa0eeefc527aa79933a83da29ebaf451 100644
|
||||||
|
--- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||||
|
+++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||||
|
@@ -150,7 +150,7 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getNeighborSignal(SignalGetter signalGetter, BlockPos pos, Direction direction) {
|
||||||
|
- for (Direction direction1 : Direction.values()) {
|
||||||
|
+ for (Direction direction1 : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (direction1 != direction && signalGetter.hasSignal(pos.relative(direction1), direction1)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@@ -161,7 +161,7 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||||
|
} else {
|
||||||
|
BlockPos blockPos = pos.above();
|
||||||
|
|
||||||
|
- for (Direction direction2 : Direction.values()) {
|
||||||
|
+ for (Direction direction2 : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (direction2 != Direction.DOWN && signalGetter.hasSignal(blockPos.relative(direction2), direction2)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
diff --git a/net/minecraft/world/level/block/state/pattern/BlockPattern.java b/net/minecraft/world/level/block/state/pattern/BlockPattern.java
|
||||||
|
index f7bb979f08634a7e1b77c59040f59fb5e11aafa5..9b60bbebd32f045bd0f5b91cd30264396e673d30 100644
|
||||||
|
--- a/net/minecraft/world/level/block/state/pattern/BlockPattern.java
|
||||||
|
+++ b/net/minecraft/world/level/block/state/pattern/BlockPattern.java
|
||||||
|
@@ -79,8 +79,8 @@ public class BlockPattern {
|
||||||
|
int max = Math.max(Math.max(this.width, this.height), this.depth);
|
||||||
|
|
||||||
|
for (BlockPos blockPos : BlockPos.betweenClosed(pos, pos.offset(max - 1, max - 1, max - 1))) {
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
- for (Direction direction1 : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
+ for (Direction direction1 : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (direction1 != direction && direction1 != direction.getOpposite()) {
|
||||||
|
BlockPattern.BlockPatternMatch blockPatternMatch = this.matches(blockPos, direction, direction1, loadingCache);
|
||||||
|
if (blockPatternMatch != null) {
|
||||||
|
diff --git a/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java b/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
|
||||||
|
index 60d34309f6a961448944faedafd242e7496d14d9..e6cceee73b41604d3e034ad2a7edf7e281cf017b 100644
|
||||||
|
--- a/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
|
||||||
|
+++ b/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
|
||||||
|
@@ -256,7 +256,7 @@ public interface VibrationSystem {
|
||||||
|
Vec3 vec3 = new Vec3(Mth.floor(eventPos.x) + 0.5, Mth.floor(eventPos.y) + 0.5, Mth.floor(eventPos.z) + 0.5);
|
||||||
|
Vec3 vec31 = new Vec3(Mth.floor(vibrationUserPos.x) + 0.5, Mth.floor(vibrationUserPos.y) + 0.5, Mth.floor(vibrationUserPos.z) + 0.5);
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
Vec3 vec32 = vec3.relative(direction, 1.0E-5F);
|
||||||
|
if (level.isBlockInLine(new ClipBlockStateContext(vec32, vec31, state -> state.is(BlockTags.OCCLUDES_VIBRATION_SIGNALS))).getType()
|
||||||
|
!= HitResult.Type.BLOCK) {
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/feature/BlueIceFeature.java b/net/minecraft/world/level/levelgen/feature/BlueIceFeature.java
|
||||||
|
index 5bbc9cacd8675c96d99f8b46399742753888d2f7..0c818d43c3d58e1f61e30d63556ba82356d53290 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/feature/BlueIceFeature.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/feature/BlueIceFeature.java
|
||||||
|
@@ -26,7 +26,7 @@ public class BlueIceFeature extends Feature<NoneFeatureConfiguration> {
|
||||||
|
} else {
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (direction != Direction.DOWN && worldGenLevel.getBlockState(blockPos.relative(direction)).is(Blocks.PACKED_ICE)) {
|
||||||
|
flag = true;
|
||||||
|
break;
|
||||||
|
@@ -51,7 +51,7 @@ public class BlueIceFeature extends Feature<NoneFeatureConfiguration> {
|
||||||
|
);
|
||||||
|
BlockState blockState = worldGenLevel.getBlockState(blockPos1);
|
||||||
|
if (blockState.isAir() || blockState.is(Blocks.WATER) || blockState.is(Blocks.PACKED_ICE) || blockState.is(Blocks.ICE)) {
|
||||||
|
- for (Direction direction1 : Direction.values()) {
|
||||||
|
+ for (Direction direction1 : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
BlockState blockState1 = worldGenLevel.getBlockState(blockPos1.relative(direction1));
|
||||||
|
if (blockState1.is(Blocks.BLUE_ICE)) {
|
||||||
|
worldGenLevel.setBlock(blockPos1, Blocks.BLUE_ICE.defaultBlockState(), 2);
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/feature/Feature.java b/net/minecraft/world/level/levelgen/feature/Feature.java
|
||||||
|
index 6d7c2c6f0469f934b9599b59f00580cd1919be58..c868fbf333d59bee5256c07f7878c2dc6462a637 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/feature/Feature.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/feature/Feature.java
|
||||||
|
@@ -205,7 +205,7 @@ public abstract class Feature<FC extends FeatureConfiguration> {
|
||||||
|
public static boolean checkNeighbors(Function<BlockPos, BlockState> adjacentStateAccessor, BlockPos pos, Predicate<BlockState> filter) {
|
||||||
|
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
mutableBlockPos.setWithOffset(pos, direction);
|
||||||
|
if (filter.test(adjacentStateAccessor.apply(mutableBlockPos))) {
|
||||||
|
return true;
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/feature/GlowstoneFeature.java b/net/minecraft/world/level/levelgen/feature/GlowstoneFeature.java
|
||||||
|
index 0062e6ba05ff73ed80c5bc5d3765c8872ef081e0..e002a1ad27bc18a7fc5ac9d1ecae523a9e66886f 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/feature/GlowstoneFeature.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/feature/GlowstoneFeature.java
|
||||||
|
@@ -35,7 +35,7 @@ public class GlowstoneFeature extends Feature<NoneFeatureConfiguration> {
|
||||||
|
if (worldGenLevel.getBlockState(blockPos1).isAir()) {
|
||||||
|
int i1 = 0;
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (worldGenLevel.getBlockState(blockPos1.relative(direction)).is(Blocks.GLOWSTONE)) {
|
||||||
|
i1++;
|
||||||
|
}
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/feature/TreeFeature.java b/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||||
|
index bd17dbe53c82001b60f4cfdd9d2dacb06a98f5ea..59957ddf6b7742c0a8eac53eddb1b9fa0c7a7bec 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||||
|
@@ -203,7 +203,7 @@ public class TreeFeature extends Feature<TreeConfiguration> {
|
||||||
|
|
||||||
|
discreteVoxelShape.fill(blockPos1.getX() - box.minX(), blockPos1.getY() - box.minY(), blockPos1.getZ() - box.minZ());
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
mutableBlockPos.setWithOffset(blockPos1, direction);
|
||||||
|
if (box.isInside(mutableBlockPos)) {
|
||||||
|
int i3 = mutableBlockPos.getX() - box.minX();
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/feature/VinesFeature.java b/net/minecraft/world/level/levelgen/feature/VinesFeature.java
|
||||||
|
index 256e130ff43f826c3eac2a0faa526dc12e5fda0e..c744ea5d2df9692e7e8c53ea96fedc8a2b77c0c9 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/feature/VinesFeature.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/feature/VinesFeature.java
|
||||||
|
@@ -21,7 +21,7 @@ public class VinesFeature extends Feature<NoneFeatureConfiguration> {
|
||||||
|
if (!worldGenLevel.isEmptyBlock(blockPos)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (direction != Direction.DOWN && VineBlock.isAcceptableNeighbour(worldGenLevel, blockPos.relative(direction), direction)) {
|
||||||
|
worldGenLevel.setBlock(
|
||||||
|
blockPos, Blocks.VINE.defaultBlockState().setValue(VineBlock.getPropertyForFace(direction), Boolean.valueOf(true)), 2
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/feature/treedecorators/CreakingHeartDecorator.java b/net/minecraft/world/level/levelgen/feature/treedecorators/CreakingHeartDecorator.java
|
||||||
|
index 75ae614790d46ba01003a13fb9d521299c675c56..ccb5a5d7536d4a3b57e08ff81a06784aed863dc7 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/feature/treedecorators/CreakingHeartDecorator.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/feature/treedecorators/CreakingHeartDecorator.java
|
||||||
|
@@ -37,7 +37,7 @@ public class CreakingHeartDecorator extends TreeDecorator {
|
||||||
|
List<BlockPos> list1 = new ArrayList<>(list);
|
||||||
|
Util.shuffle(list1, randomSource);
|
||||||
|
Optional<BlockPos> optional = list1.stream().filter(pos -> {
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (!context.checkBlock(pos.relative(direction), blockState -> blockState.is(BlockTags.LOGS))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/structure/structures/BuriedTreasurePieces.java b/net/minecraft/world/level/levelgen/structure/structures/BuriedTreasurePieces.java
|
||||||
|
index f515f7c881d597072db226f60cfae2d7ebe89ea4..ed4d719c7dfbce695a8fdc59ded6aae75c273714 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/structure/structures/BuriedTreasurePieces.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/structure/structures/BuriedTreasurePieces.java
|
||||||
|
@@ -54,7 +54,7 @@ public class BuriedTreasurePieces {
|
||||||
|
|| blockState1 == Blocks.DIORITE.defaultBlockState()) {
|
||||||
|
BlockState blockState2 = !blockState.isAir() && !this.isLiquid(blockState) ? blockState : Blocks.SAND.defaultBlockState();
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
BlockPos blockPos = mutableBlockPos.relative(direction);
|
||||||
|
BlockState blockState3 = level.getBlockState(blockPos);
|
||||||
|
if (blockState3.isAir() || this.isLiquid(blockState3)) {
|
||||||
diff --git a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
diff --git a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
||||||
index 03ec2264b19e1794b609fe09d1ceaba4e0c4d669..3f38fe0140d13c7c356340ba06b55469ede0a1ad 100644
|
index 03ec2264b19e1794b609fe09d1ceaba4e0c4d669..3f38fe0140d13c7c356340ba06b55469ede0a1ad 100644
|
||||||
--- a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
--- a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidStructure.java
|
||||||
@@ -247,3 +490,68 @@ index 03ec2264b19e1794b609fe09d1ceaba4e0c4d669..3f38fe0140d13c7c356340ba06b55469
|
|||||||
RandomSource randomSource = RandomSource.create(level.getSeed()).forkPositional().at(pieces.calculateBoundingBox().getCenter());
|
RandomSource randomSource = RandomSource.create(level.getSeed()).forkPositional().at(pieces.calculateBoundingBox().getCenter());
|
||||||
Util.shuffle(list, randomSource);
|
Util.shuffle(list, randomSource);
|
||||||
int min = Math.min(set.size(), randomSource.nextInt(5, 8));
|
int min = Math.min(set.size(), randomSource.nextInt(5, 8));
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
|
||||||
|
index 1acd506f7c0679fa9f69b6ab221002b28d00c3e5..20502112f4e338984efc264109d0c894b1d33d56 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java
|
||||||
|
@@ -565,7 +565,7 @@ public class MineshaftPieces {
|
||||||
|
BlockPos.MutableBlockPos worldPos = this.getWorldPos(x, y, z);
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
worldPos.move(direction);
|
||||||
|
if (box.isInside(worldPos) && level.getBlockState(worldPos).isFaceSturdy(level, worldPos, direction.getOpposite())) {
|
||||||
|
if (++i >= required) {
|
||||||
|
diff --git a/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java b/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java
|
||||||
|
index b70ef62b4e41ee4851b2cdf53e0be1083233d052..f1ac1e1283cb276e5b21330d700cafdb65e60be1 100644
|
||||||
|
--- a/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java
|
||||||
|
+++ b/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java
|
||||||
|
@@ -244,7 +244,7 @@ public class OceanMonumentPieces {
|
||||||
|
for (int i2 = 0; i2 < 3; i2++) {
|
||||||
|
int roomIndex = getRoomIndex(i, i2, i1);
|
||||||
|
if (roomDefinitions[roomIndex] != null) {
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
int i3 = i + direction.getStepX();
|
||||||
|
int i4 = i2 + direction.getStepY();
|
||||||
|
int i5 = i1 + direction.getStepZ();
|
||||||
|
diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java
|
||||||
|
index d66321acb26682a02efa02cf1443b40d2a17f67b..86ed35984760a0a90e92a297d3080378e8b4bf6f 100644
|
||||||
|
--- a/net/minecraft/world/level/material/LavaFluid.java
|
||||||
|
+++ b/net/minecraft/world/level/material/LavaFluid.java
|
||||||
|
@@ -126,7 +126,7 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasFlammableNeighbours(LevelReader level, BlockPos pos) {
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
if (this.isFlammable(level, pos.relative(direction))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
diff --git a/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java b/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java
|
||||||
|
index 33047e446adf252a179cb0220c20a7d83f361482..9c58425f2afdbe5701910d8473fd5b344ffe31dd 100644
|
||||||
|
--- a/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java
|
||||||
|
+++ b/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java
|
||||||
|
@@ -97,7 +97,7 @@ public class AmphibiousNodeEvaluator extends WalkNodeEvaluator {
|
||||||
|
if (pathTypeFromState == PathType.WATER) {
|
||||||
|
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
mutableBlockPos.set(x, y, z).move(direction);
|
||||||
|
PathType pathTypeFromState1 = context.getPathTypeFromState(mutableBlockPos.getX(), mutableBlockPos.getY(), mutableBlockPos.getZ());
|
||||||
|
if (pathTypeFromState1 == PathType.BLOCKED) {
|
||||||
|
diff --git a/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java b/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
|
||||||
|
index b25d3bf3d5c575cd5c9a97a6d5ee7191467fe839..c598d91cd9fb711bc9aaa068fbb806619c0d4fe2 100644
|
||||||
|
--- a/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
|
||||||
|
+++ b/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
|
||||||
|
@@ -51,7 +51,7 @@ public class SwimNodeEvaluator extends NodeEvaluator {
|
||||||
|
int i = 0;
|
||||||
|
Map<Direction, Node> map = Maps.newEnumMap(Direction.class);
|
||||||
|
|
||||||
|
- for (Direction direction : Direction.values()) {
|
||||||
|
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
|
||||||
|
Node node1 = this.findAcceptedNode(node.x + direction.getStepX(), node.y + direction.getStepY(), node.z + direction.getStepZ());
|
||||||
|
map.put(direction, node1);
|
||||||
|
if (this.isNodeValid(node1)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user