9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-03 22:26:19 +00:00

Pluto: expose Direction$Plane's faces (#491)

* Pluto: expose Direction$Plane's faces

* [ci/skip] Cleanup
This commit is contained in:
hayanesuru
2025-09-06 06:49:48 +09:00
committed by GitHub
parent b1e831c0b7
commit fba4656941
5 changed files with 788 additions and 12 deletions

View File

@@ -28,7 +28,7 @@ index 5c369b3d94e369c3f240821ad90b9d96223f24ca..9803c395fce103cb7bc746f43a017ff9
}
// Paper end - Optional per player mob spawns
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index 3a6c894178829cec8daa08ea9f0294f7f39a8efe..8bf770fd490634787e794efec9f0d6a10d97e42f 100644
index 3a6c894178829cec8daa08ea9f0294f7f39a8efe..2721b999dcfcf1cd5a0919221f2d94da4c93a6e7 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -70,11 +70,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -138,7 +138,7 @@ index 3a6c894178829cec8daa08ea9f0294f7f39a8efe..8bf770fd490634787e794efec9f0d6a1
}
// Paper end - PlayerNaturallySpawnCreaturesEvent
boolean flag = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
@@ -622,16 +633,36 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -622,16 +633,34 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
List<LevelChunk> list = this.spawningChunks;
try {
@@ -148,12 +148,8 @@ index 3a6c894178829cec8daa08ea9f0294f7f39a8efe..8bf770fd490634787e794efec9f0d6a1
+ this.level.natureSpawnChunkMap.build();
+ this.level.natureSpawnChunkMap.collectSpawningChunks(this.level.moonrise$getPlayerTickingChunks(), list);
// Paper start - chunk tick iteration optimisation
- this.shuffleRandom.setSeed(this.level.random.nextLong());
- if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled
+ if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
+ this.shuffleRandom.setSeed(this.level.random.nextLong()); // Leaf - paw optimization - Only set seed if is really used
+ Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled
+ }
this.shuffleRandom.setSeed(this.level.random.nextLong());
if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled
// Paper end - chunk tick iteration optimisation
- for (LevelChunk levelChunk : list) {
@@ -180,7 +176,7 @@ index 3a6c894178829cec8daa08ea9f0294f7f39a8efe..8bf770fd490634787e794efec9f0d6a1
list.clear();
}
@@ -649,7 +680,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -649,7 +678,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
if (!spawnCategories.isEmpty()) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] optimize random tick
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index 8bf770fd490634787e794efec9f0d6a10d97e42f..7e84b94a4602801e8cc713b28d0d93052589fd5e 100644
index 2721b999dcfcf1cd5a0919221f2d94da4c93a6e7..2a1a6a0306b781e9ae5c0e3261cb740f37be4a8c 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -666,7 +666,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -664,7 +664,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
list.clear();
}

View File

@@ -99,6 +99,23 @@ index 4535858701b2bb232b9d2feb2af6551526232ddc..e65c62dbe4c1560ae153e4c4344e9194
- }
- // Paper end - detailed watchdog information
}
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index 2a1a6a0306b781e9ae5c0e3261cb740f37be4a8c..7e84b94a4602801e8cc713b28d0d93052589fd5e 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -638,8 +638,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
this.level.natureSpawnChunkMap.build();
this.level.natureSpawnChunkMap.collectSpawningChunks(this.level.moonrise$getPlayerTickingChunks(), list);
// Paper start - chunk tick iteration optimisation
- this.shuffleRandom.setSeed(this.level.random.nextLong());
- if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled
+ if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
+ this.shuffleRandom.setSeed(this.level.random.nextLong()); // Leaf - paw optimization - Only set seed if is really used
+ Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled
+ }
// Paper end - chunk tick iteration optimisation
if (!org.dreeam.leaf.config.modules.async.AsyncMobSpawning.enabled || _pufferfish_spawnCountsReady.get()) {
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 88a3f390f615275c84237814e10c969bfe3c6a55..0ad594fe2548cf1c00f8d75fe076d62c3c99f393 100644
--- a/net/minecraft/server/level/ServerLevel.java
@@ -132,7 +149,7 @@ index 88a3f390f615275c84237814e10c969bfe3c6a55..0ad594fe2548cf1c00f8d75fe076d62c
private void tickPassenger(Entity ridingEntity, Entity passengerEntity, final boolean isActive) { // Paper - EAR 2
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index b71acd053b38d9b59720e35e664f957df6626b27..2d26a7a0b85c85830694e7947f2c4f29483bb99a 100644
index 78ffbd45413f552042e8ec77df4e8d896ae5bec1..f3c0b29d50a001029f0275319b87b75a3ff0bca5 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1138,16 +1138,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -295,6 +312,28 @@ index 010e9814490ffaa153df5b7865da17e2a84c7e82..d6750aec0f4695a99557beb92fda7a89
mutableBlockPos.setWithOffset(pos, direction);
i = Math.min(i, getDistanceAt(level.getBlockState(mutableBlockPos)) + 1);
if (i == 1) {
diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java
index ccc98d71da3c1150878f96801fbf65bfa1a64472..a4e26381dcc831361c2d6bef6427d1d6eb7cef18 100644
--- a/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -360,7 +360,7 @@ public class RedStoneWireBlock extends Block {
if (level.getBlockState(pos).is(this)) {
level.updateNeighborsAt(pos, this);
- for (Direction direction : Direction.values()) {
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
level.updateNeighborsAt(pos.relative(direction), this);
}
}
@@ -388,7 +388,7 @@ public class RedStoneWireBlock extends Block {
@Override
protected void affectNeighborsAfterRemoval(BlockState state, ServerLevel level, BlockPos pos, boolean movedByPiston) {
if (!movedByPiston) {
- for (Direction direction : Direction.values()) {
+ for (Direction direction : Direction.VALUES) { // Leaf - paw optimization - cache direction values
level.updateNeighborsAt(pos.relative(direction), this);
}
diff --git a/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index 10484ee85482e86be5e0a09d8202df600a32092e..5b530b582d865ec407639c2262823bb7057b92a9 100644
--- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java

View File

@@ -0,0 +1,692 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Yive <6853318+Yive@users.noreply.github.com>
Date: Tue, 6 May 2025 22:14:55 -0700
Subject: [PATCH] Pluto: Expose Direction$Plane's faces
The JMH benchmark of this patch can be found in SunBox's `CachedEnumValuesForLoop`
Original license: GPL-3.0
Original project: https://github.com/Yive/Pluto
diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java
index 8447557b808f420f22c54882bf51a308965063fe..22428e3cdbcc2f6fa15d57010076bed84a9a880b 100644
--- a/net/minecraft/core/Direction.java
+++ b/net/minecraft/core/Direction.java
@@ -627,7 +627,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
HORIZONTAL(new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST}, new Direction.Axis[]{Direction.Axis.X, Direction.Axis.Z}),
VERTICAL(new Direction[]{Direction.UP, Direction.DOWN}, new Direction.Axis[]{Direction.Axis.Y});
- private final Direction[] faces;
+ public final Direction[] faces; // Pluto - Expose Direction$Plane's faces
private final Direction.Axis[] axis;
private Plane(final Direction[] faces, final Direction.Axis[] axis) {
diff --git a/net/minecraft/data/worldgen/features/VegetationFeatures.java b/net/minecraft/data/worldgen/features/VegetationFeatures.java
index 45093451fb25ae3bb1e57d2e53c49a1ae666e31e..c228135032b5f74fd1ec96a2cf52aa3e9cac19cd 100644
--- a/net/minecraft/data/worldgen/features/VegetationFeatures.java
+++ b/net/minecraft/data/worldgen/features/VegetationFeatures.java
@@ -812,7 +812,7 @@ public class VegetationFeatures {
WeightedList.Builder<BlockState> builder = WeightedList.builder();
for (int i = minAmount; i <= maxAmount; i++) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
builder.add(block.defaultBlockState().setValue(amountProperty, i).setValue(directionProperty, direction), 1);
}
}
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index c5fea3948be691c42e9a94ddb0acd04fcc0b4415..7f6eda550ad99dad49aa3d47800213b7ba2d341a 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -1179,7 +1179,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// We only need to check blocks that are taller than the minimum step height
if (org.purpurmc.purpur.PurpurConfig.smoothSnowAccumulationStep > 0 && layersValue >= org.purpurmc.purpur.PurpurConfig.smoothSnowAccumulationStep) {
int layersValueMin = layersValue - org.purpurmc.purpur.PurpurConfig.smoothSnowAccumulationStep;
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPosNeighbor = heightmapPos.relative(direction);
BlockState blockStateNeighbor = this.getBlockState(blockPosNeighbor);
if (blockStateNeighbor.is(Blocks.SNOW)) {
diff --git a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
index dfd39ff8f4a17b42bda60f2bcec5ebc163c25954..e1039aa68f996c94a98f17c89320d4539c022d77 100644
--- a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
+++ b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
@@ -145,7 +145,7 @@ public class PrepareRamNearestTarget<E extends PathfinderMob> extends Behavior<E
List<BlockPos> list = Lists.newArrayList();
BlockPos.MutableBlockPos mutableBlockPos = blockPos.mutable();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
mutableBlockPos.set(blockPos);
for (int i = 0; i < this.maxRamDistance; i++) {
diff --git a/net/minecraft/world/entity/ai/behavior/TryFindLandNearWater.java b/net/minecraft/world/entity/ai/behavior/TryFindLandNearWater.java
index d11840ec223d8429131e797a83e12709e2d8bfe3..c6eddfc59c345507b6e6b57c4ed41e2c6c3bed9f 100644
--- a/net/minecraft/world/entity/ai/behavior/TryFindLandNearWater.java
+++ b/net/minecraft/world/entity/ai/behavior/TryFindLandNearWater.java
@@ -40,7 +40,7 @@ public class TryFindLandNearWater {
&& !level.getBlockState(mutableBlockPos.setWithOffset(blockPos1, Direction.DOWN))
.getCollisionShape(level, blockPos1, collisionContext)
.isEmpty()) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
mutableBlockPos.setWithOffset(blockPos1, direction);
if (level.getBlockState(mutableBlockPos).isAir()
&& level.getBlockState(mutableBlockPos.move(Direction.DOWN)).is(Blocks.WATER)) {
diff --git a/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java b/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
index 011d82078041b51eb32b0b9f6ef3b9c0a95092ae..d149b1114ccace06bdbe608014099ba986503cb6 100644
--- a/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
+++ b/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
@@ -26,7 +26,7 @@ public class TryLaySpawnOnWaterNearLand {
if (!entity.isInWater() && entity.onGround()) {
BlockPos blockPos = entity.blockPosition().below();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos1 = blockPos.relative(direction);
if (level.getBlockState(blockPos1).getCollisionShape(level, blockPos1).getFaceShape(Direction.UP).isEmpty()
&& level.getFluidState(blockPos1).is(Fluids.WATER)) {
diff --git a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
index d26867def6c549c8c909213d4f91895f1168cae6..44e7b63e91d298c6c014ca45f356f82f53561f39 100644
--- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
+++ b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
@@ -57,7 +57,7 @@ public abstract class AbstractThrownPotion extends ThrowableItemProjectile {
this.dowseFire(blockPos1);
this.dowseFire(blockPos1.relative(direction.getOpposite()));
- for (Direction direction1 : Direction.Plane.HORIZONTAL) {
+ for (Direction direction1 : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
this.dowseFire(blockPos1.relative(direction1));
}
}
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 2ec44cbd781426b4c8983f47665fe0aac1b4f214..50a80610645f225ef24cb774feec87d462f80662 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -2065,7 +2065,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
public abstract Scoreboard getScoreboard();
public void updateNeighbourForOutputSignal(BlockPos pos, Block block) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = pos.relative(direction);
if (this.hasChunkAt(blockPos)) {
BlockState blockState = this.getBlockState(blockPos);
diff --git a/net/minecraft/world/level/block/CactusBlock.java b/net/minecraft/world/level/block/CactusBlock.java
index 292260b769956f25c280e4a767382823ba500b58..d6f963f0cf53e0daac7688c0dd2ec4d48b5d52b1 100644
--- a/net/minecraft/world/level/block/CactusBlock.java
+++ b/net/minecraft/world/level/block/CactusBlock.java
@@ -141,7 +141,7 @@ public class CactusBlock extends Block implements BonemealableBlock { // Purpur
}
protected boolean canSurvive(LevelReader level, BlockPos pos) {
// Pluto end - Check if the cactus can even survive being placed
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockState blockState = level.getBlockState(pos.relative(direction));
if ((level.getWorldBorder().world.purpurConfig.cactusBreaksFromSolidNeighbors && blockState.isSolid()) || level.getFluidState(pos.relative(direction)).is(FluidTags.LAVA)) { // Purpur - Cactus breaks from solid neighbors config
return false;
diff --git a/net/minecraft/world/level/block/ChorusFlowerBlock.java b/net/minecraft/world/level/block/ChorusFlowerBlock.java
index 32ba79c568ef9e75639f03cd7cc34be569638742..faf9e7c08f0b49325f78e4dd49e2924d3e518699 100644
--- a/net/minecraft/world/level/block/ChorusFlowerBlock.java
+++ b/net/minecraft/world/level/block/ChorusFlowerBlock.java
@@ -152,7 +152,7 @@ public class ChorusFlowerBlock extends Block {
}
private static boolean allNeighborsEmpty(LevelReader level, BlockPos pos, @Nullable Direction excludingSide) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (direction != excludingSide && !level.isEmptyBlock(pos.relative(direction))) {
return false;
}
@@ -188,7 +188,7 @@ public class ChorusFlowerBlock extends Block {
} else {
boolean flag = false;
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockState blockState1 = level.getBlockState(pos.relative(direction));
if (blockState1.is(this.plant)) {
if (flag) {
diff --git a/net/minecraft/world/level/block/ChorusPlantBlock.java b/net/minecraft/world/level/block/ChorusPlantBlock.java
index 47f3b008b252678105368dc577ed66353ff50eb3..47df6c8bc4b024463011c9cc380b433636458151 100644
--- a/net/minecraft/world/level/block/ChorusPlantBlock.java
+++ b/net/minecraft/world/level/block/ChorusPlantBlock.java
@@ -95,7 +95,7 @@ public class ChorusPlantBlock extends PipeBlock {
BlockState blockState = level.getBlockState(pos.below());
boolean flag = !level.getBlockState(pos.above()).isAir() && !blockState.isAir();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = pos.relative(direction);
BlockState blockState1 = level.getBlockState(blockPos);
if (blockState1.is(this)) {
diff --git a/net/minecraft/world/level/block/MossyCarpetBlock.java b/net/minecraft/world/level/block/MossyCarpetBlock.java
index 8e0e66e1ae6fea2460fdef154bb26af01394b6df..73af154f381c676cc2cc096cdc689d2125ce50e0 100644
--- a/net/minecraft/world/level/block/MossyCarpetBlock.java
+++ b/net/minecraft/world/level/block/MossyCarpetBlock.java
@@ -134,7 +134,7 @@ public class MossyCarpetBlock extends Block implements BonemealableBlock {
BlockState blockState1 = null;
tip |= state.getValue(BASE);
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
EnumProperty<WallSide> propertyForFace = getPropertyForFace(direction);
WallSide wallSide = canSupportAtFace(level, pos, direction) ? (tip ? WallSide.LOW : state.getValue(propertyForFace)) : WallSide.NONE;
if (wallSide == WallSide.LOW) {
@@ -200,7 +200,7 @@ public class MossyCarpetBlock extends Block implements BonemealableBlock {
BlockState blockState1 = Blocks.PALE_MOSS_CARPET.defaultBlockState().setValue(BASE, false);
BlockState updatedState = getUpdatedState(blockState1, level, pos.above(), true);
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
EnumProperty<WallSide> propertyForFace = getPropertyForFace(direction);
if (updatedState.getValue(propertyForFace) != WallSide.NONE && !placeSide.getAsBoolean()) {
updatedState = updatedState.setValue(propertyForFace, WallSide.NONE);
diff --git a/net/minecraft/world/level/block/RailState.java b/net/minecraft/world/level/block/RailState.java
index 3b69f9502c30a69519b7b722aecb9e25da8c55f0..b2c6af1dc9fa8330ee7d525b588725aca71184ca 100644
--- a/net/minecraft/world/level/block/RailState.java
+++ b/net/minecraft/world/level/block/RailState.java
@@ -133,7 +133,7 @@ public class RailState {
protected int countPotentialConnections() {
int i = 0;
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (this.hasRail(this.pos.relative(direction))) {
i++;
}
diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java
index a4e26381dcc831361c2d6bef6427d1d6eb7cef18..0b3d8fdd053ad74f32c33cb17e65aeeedd24d520 100644
--- a/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -160,7 +160,7 @@ public class RedStoneWireBlock extends Block {
private BlockState getMissingConnections(BlockGetter level, BlockState state, BlockPos pos) {
boolean flag = !level.getBlockState(pos.above()).isRedstoneConductor(level, pos);
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (!state.getValue(PROPERTY_BY_DIRECTION.get(direction)).isConnected()) {
RedstoneSide connectingSide = this.getConnectingSide(level, pos, direction, flag);
state = state.setValue(PROPERTY_BY_DIRECTION.get(direction), connectingSide);
@@ -213,7 +213,7 @@ public class RedStoneWireBlock extends Block {
protected void updateIndirectNeighbourShapes(BlockState state, LevelAccessor level, BlockPos pos, int flags, int recursionLeft) {
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
RedstoneSide redstoneSide = state.getValue(PROPERTY_BY_DIRECTION.get(direction));
if (redstoneSide != RedstoneSide.NONE && !level.getBlockState(mutableBlockPos.setWithOffset(pos, direction)).is(this)) {
mutableBlockPos.move(Direction.DOWN);
@@ -377,7 +377,7 @@ public class RedStoneWireBlock extends Block {
}
// Paper end - optimize redstone
- for (Direction direction : Direction.Plane.VERTICAL) {
+ for (Direction direction : Direction.Plane.VERTICAL.faces) { // Pluto - Expose Direction$Plane's faces
level.updateNeighborsAt(pos.relative(direction), this);
}
@@ -404,11 +404,11 @@ public class RedStoneWireBlock extends Block {
}
private void updateNeighborsOfNeighboringWires(Level level, BlockPos pos) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
this.checkCornerChangeAt(level, pos.relative(direction));
}
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = pos.relative(direction);
if (level.getBlockState(blockPos).isRedstoneConductor(level, blockPos)) {
this.checkCornerChangeAt(level, blockPos.above());
@@ -521,7 +521,7 @@ public class RedStoneWireBlock extends Block {
public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) {
int powerValue = state.getValue(POWER);
if (powerValue != 0) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
RedstoneSide redstoneSide = state.getValue(PROPERTY_BY_DIRECTION.get(direction));
switch (redstoneSide) {
case UP:
@@ -600,7 +600,7 @@ public class RedStoneWireBlock extends Block {
private void updatesOnShapeChange(Level level, BlockPos pos, BlockState oldState, BlockState newState) {
Orientation orientation = ExperimentalRedstoneUtils.initialOrientation(level, null, Direction.UP);
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = pos.relative(direction);
if (oldState.getValue(PROPERTY_BY_DIRECTION.get(direction)).isConnected() != newState.getValue(PROPERTY_BY_DIRECTION.get(direction)).isConnected()
&& level.getBlockState(blockPos).isRedstoneConductor(level, blockPos)) {
diff --git a/net/minecraft/world/level/block/ScaffoldingBlock.java b/net/minecraft/world/level/block/ScaffoldingBlock.java
index 1fa344f0a48ce1411fa369fd2f2e7ef3bdb7079e..d8af8eaa654b520d44d742614c13a4c6bab3c855 100644
--- a/net/minecraft/world/level/block/ScaffoldingBlock.java
+++ b/net/minecraft/world/level/block/ScaffoldingBlock.java
@@ -165,7 +165,7 @@ public class ScaffoldingBlock extends Block implements SimpleWaterloggedBlock {
return 0;
}
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(pos, direction));
if (blockState1.is(Blocks.SCAFFOLDING)) {
i = Math.min(i, blockState1.getValue(DISTANCE) + 1);
diff --git a/net/minecraft/world/level/block/SugarCaneBlock.java b/net/minecraft/world/level/block/SugarCaneBlock.java
index baa56c6422c0924bb8b7c5a78db17acf784f28d6..7d5e1e773056bf426b71b0971c23646cfe6daf5a 100644
--- a/net/minecraft/world/level/block/SugarCaneBlock.java
+++ b/net/minecraft/world/level/block/SugarCaneBlock.java
@@ -95,7 +95,7 @@ public class SugarCaneBlock extends Block implements BonemealableBlock { // Purp
if (blockState.is(BlockTags.DIRT) || blockState.is(BlockTags.SAND)) {
BlockPos blockPos = pos.below();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockState blockState1 = level.getBlockState(blockPos.relative(direction));
FluidState fluidState = level.getFluidState(blockPos.relative(direction));
if (fluidState.is(FluidTags.WATER) || blockState1.is(Blocks.FROSTED_ICE)) {
diff --git a/net/minecraft/world/level/block/VineBlock.java b/net/minecraft/world/level/block/VineBlock.java
index 5aed66756201c3f0e75675705f2a67adb554d048..f9d65aabc85a5015871c64399087a817f7f81d38 100644
--- a/net/minecraft/world/level/block/VineBlock.java
+++ b/net/minecraft/world/level/block/VineBlock.java
@@ -125,7 +125,7 @@ public class VineBlock extends Block {
BlockState blockState = null;
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BooleanProperty propertyForFace = getPropertyForFace(direction);
if (state.getValue(propertyForFace)) {
boolean canSupportAtFace = this.canSupportAtFace(level, pos, direction);
@@ -215,7 +215,7 @@ public class VineBlock extends Block {
BlockState blockState1 = state;
- for (Direction clockWise : Direction.Plane.HORIZONTAL) {
+ for (Direction clockWise : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (random.nextBoolean() || !isAcceptableNeighbour(level, blockPos.relative(clockWise), clockWise)) {
blockState1 = blockState1.setValue(getPropertyForFace(clockWise), false);
}
@@ -246,7 +246,7 @@ public class VineBlock extends Block {
}
private BlockState copyRandomFaces(BlockState sourceState, BlockState spreadState, RandomSource random) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (random.nextBoolean()) {
BooleanProperty propertyForFace = getPropertyForFace(direction);
if (sourceState.getValue(propertyForFace)) {
diff --git a/net/minecraft/world/level/block/sounds/AmbientDesertBlockSoundsPlayer.java b/net/minecraft/world/level/block/sounds/AmbientDesertBlockSoundsPlayer.java
index ebb3a5d68e5bf3ad5d2c7d12f82fcce1192c476b..0f43e03723e438ed8211c7cc5ebd02378758248d 100644
--- a/net/minecraft/world/level/block/sounds/AmbientDesertBlockSoundsPlayer.java
+++ b/net/minecraft/world/level/block/sounds/AmbientDesertBlockSoundsPlayer.java
@@ -58,7 +58,7 @@ public class AmbientDesertBlockSoundsPlayer {
int i1 = 0;
BlockPos.MutableBlockPos mutableBlockPos = pos.mutable();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
mutableBlockPos.set(pos).move(direction, 8);
if (columnContainsTriggeringBlock(level, mutableBlockPos) && i++ >= 3) {
return true;
diff --git a/net/minecraft/world/level/dimension/end/EndDragonFight.java b/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 62ffb8e88b76f9765283d40d5ddcd9320063ca55..d4991a3ae015cfde4496e67e228f0bfd43867e54 100644
--- a/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -556,7 +556,7 @@ public class EndDragonFight {
List<EndCrystal> list = Lists.newArrayList();
BlockPos blockPos1 = blockPos.above(1);
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
List<EndCrystal> entitiesOfClass = this.level.getEntitiesOfClass(EndCrystal.class, new AABB(blockPos1.relative(direction, 2)));
if (entitiesOfClass.isEmpty()) {
return false; // CraftBukkit - return value
diff --git a/net/minecraft/world/level/levelgen/blending/Blender.java b/net/minecraft/world/level/levelgen/blending/Blender.java
index 001b3cec50498186ab4f309118776c2ed6cce911..05cd9596a9dcbe967df5a0a1fd5528a0b01c2b70 100644
--- a/net/minecraft/world/level/levelgen/blending/Blender.java
+++ b/net/minecraft/world/level/levelgen/blending/Blender.java
@@ -270,7 +270,7 @@ public class Blender {
}
}
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (region.getChunk(pos.x + direction.getStepX(), pos.z + direction.getStepZ()).isOldNoiseGeneration() != isOldNoiseGeneration) {
int i2 = direction == Direction.EAST ? 15 : 0;
int i3 = direction == Direction.WEST ? 0 : 15;
diff --git a/net/minecraft/world/level/levelgen/feature/BonusChestFeature.java b/net/minecraft/world/level/levelgen/feature/BonusChestFeature.java
index 0b97b575f6f19dae37002e1be12db51331359b1f..e0ca4c2cfd8c27e1d7449f9eee7f29dd6bcbecf8 100644
--- a/net/minecraft/world/level/levelgen/feature/BonusChestFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/BonusChestFeature.java
@@ -40,7 +40,7 @@ public class BonusChestFeature extends Feature<NoneFeatureConfiguration> {
RandomizableContainer.setBlockEntityLootTable(worldGenLevel, randomSource, heightmapPos, BuiltInLootTables.SPAWN_BONUS_CHEST);
BlockState blockState = Blocks.TORCH.defaultBlockState();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = heightmapPos.relative(direction);
if (blockState.canSurvive(worldGenLevel, blockPos)) {
worldGenLevel.setBlock(blockPos, blockState, 2);
diff --git a/net/minecraft/world/level/levelgen/feature/CoralFeature.java b/net/minecraft/world/level/levelgen/feature/CoralFeature.java
index 2569754d96694edbc1fe64e6048d6ec26cbe243e..22463f65084ccbfefc9be94a32a8557433be1667 100644
--- a/net/minecraft/world/level/levelgen/feature/CoralFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/CoralFeature.java
@@ -47,7 +47,7 @@ public abstract class CoralFeature extends Feature<NoneFeatureConfiguration> {
level.setBlock(blockPos, Blocks.SEA_PICKLE.defaultBlockState().setValue(SeaPickleBlock.PICKLES, random.nextInt(4) + 1), 2);
}
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (random.nextFloat() < 0.2F) {
BlockPos blockPos1 = pos.relative(direction);
if (level.getBlockState(blockPos1).is(Blocks.WATER)) {
diff --git a/net/minecraft/world/level/levelgen/feature/DesertWellFeature.java b/net/minecraft/world/level/levelgen/feature/DesertWellFeature.java
index e88df07637c14cf98daa7d00059728f27bcdef49..c1e271311904efa1ec7f4d7577505e3feb1a3273 100644
--- a/net/minecraft/world/level/levelgen/feature/DesertWellFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/DesertWellFeature.java
@@ -56,14 +56,14 @@ public class DesertWellFeature extends Feature<NoneFeatureConfiguration> {
worldGenLevel.setBlock(blockPos, this.water, 2);
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
worldGenLevel.setBlock(blockPos.relative(direction), this.water, 2);
}
BlockPos blockPos1 = blockPos.below();
worldGenLevel.setBlock(blockPos1, this.sand, 2);
- for (Direction direction1 : Direction.Plane.HORIZONTAL) {
+ for (Direction direction1 : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
worldGenLevel.setBlock(blockPos1.relative(direction1), this.sand, 2);
}
diff --git a/net/minecraft/world/level/levelgen/feature/DripstoneClusterFeature.java b/net/minecraft/world/level/levelgen/feature/DripstoneClusterFeature.java
index e41abe1bf5f848ddde604b1b94537650166b7bd0..d0288105519973b74602a81ee877d29746832d5c 100644
--- a/net/minecraft/world/level/levelgen/feature/DripstoneClusterFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/DripstoneClusterFeature.java
@@ -163,7 +163,7 @@ public class DripstoneClusterFeature extends Feature<DripstoneClusterConfigurati
if (level.getBlockState(pos.above()).getFluidState().is(FluidTags.WATER)) {
return false;
} else {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (!this.canBeAdjacentToWater(level, pos.relative(direction))) {
return false;
}
diff --git a/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.java b/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.java
index f80c3c074c9eef742388b2636d11d895b0712876..4372f9abd26922a2381a9f4eb54e5a06c4e97a45 100644
--- a/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/EndPodiumFeature.java
@@ -68,7 +68,7 @@ public class EndPodiumFeature extends Feature<NoneFeatureConfiguration> {
BlockPos blockPos2 = blockPos.above(2);
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
this.setBlock(worldGenLevel, blockPos2.relative(direction), Blocks.WALL_TORCH.defaultBlockState().setValue(WallTorchBlock.FACING, direction));
}
diff --git a/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java b/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java
index 586097d1535113016dfad4ccb096917b9cdbbd2a..36f71c162d7568c92ddce10c8f143bf1cdf7117f 100644
--- a/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java
@@ -100,7 +100,7 @@ public class MonsterRoomFeature extends Feature<NoneFeatureConfiguration> {
if (worldGenLevel.isEmptyBlock(blockPos2)) {
int i14 = 0;
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (worldGenLevel.getBlockState(blockPos2.relative(direction)).isSolid()) {
i14++;
}
diff --git a/net/minecraft/world/level/levelgen/feature/PointedDripstoneFeature.java b/net/minecraft/world/level/levelgen/feature/PointedDripstoneFeature.java
index 900de7123cacf30a1f044616f9707898963b4a5e..2d2509185d31ee3ee8e0e905fcdd8b43f8137453 100644
--- a/net/minecraft/world/level/levelgen/feature/PointedDripstoneFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/PointedDripstoneFeature.java
@@ -49,7 +49,7 @@ public class PointedDripstoneFeature extends Feature<PointedDripstoneConfigurati
private static void createPatchOfDripstoneBlocks(LevelAccessor level, RandomSource random, BlockPos pos, PointedDripstoneConfiguration config) {
DripstoneUtils.placeDripstoneBlockIfPossible(level, pos);
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (!(random.nextFloat() > config.chanceOfDirectionalSpread)) {
BlockPos blockPos = pos.relative(direction);
DripstoneUtils.placeDripstoneBlockIfPossible(level, blockPos);
diff --git a/net/minecraft/world/level/levelgen/feature/UnderwaterMagmaFeature.java b/net/minecraft/world/level/levelgen/feature/UnderwaterMagmaFeature.java
index 5934fb6a6d4ddb7d8bd5d697ce63d655bc07aed6..de5beb0d9b5e8111f399849ee5a49cb949331d27 100644
--- a/net/minecraft/world/level/levelgen/feature/UnderwaterMagmaFeature.java
+++ b/net/minecraft/world/level/levelgen/feature/UnderwaterMagmaFeature.java
@@ -59,7 +59,7 @@ public class UnderwaterMagmaFeature extends Feature<UnderwaterMagmaConfiguration
private boolean isValidPlacement(WorldGenLevel level, BlockPos pos) {
if (!this.isWaterOrAir(level, pos) && !this.isWaterOrAir(level, pos.below())) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (this.isWaterOrAir(level, pos.relative(direction))) {
return false;
}
diff --git a/net/minecraft/world/level/levelgen/feature/configurations/MultifaceGrowthConfiguration.java b/net/minecraft/world/level/levelgen/feature/configurations/MultifaceGrowthConfiguration.java
index 10f0e59029f269278c7511b159f8759e379dd22a..538522c9babec35006f8544a1822b4bea8340939 100644
--- a/net/minecraft/world/level/levelgen/feature/configurations/MultifaceGrowthConfiguration.java
+++ b/net/minecraft/world/level/levelgen/feature/configurations/MultifaceGrowthConfiguration.java
@@ -75,7 +75,7 @@ public class MultifaceGrowthConfiguration implements FeatureConfiguration {
}
if (canPlaceOnWall) {
- Direction.Plane.HORIZONTAL.forEach(this.validDirections::add);
+ this.validDirections.addElements(this.validDirections.size(), Direction.Plane.HORIZONTAL.faces); // Pluto - Expose Direction$Plane's faces
}
}
diff --git a/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacer.java b/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacer.java
index 8c6791796c18bc5906c6d72a07c13d2326476c74..f74dffc26460bf3a853d67f1e76d7f02d5588af7 100644
--- a/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacer.java
+++ b/net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacer.java
@@ -128,7 +128,7 @@ public abstract class FoliagePlacer {
BlockPos blockPos = pos.below();
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
Direction clockWise = direction.getClockWise();
int i1 = clockWise.getAxisDirection() == Direction.AxisDirection.POSITIVE ? range + i : range;
mutableBlockPos.setWithOffset(pos, 0, localY - 1, 0).move(clockWise, i1).move(direction, -range);
diff --git a/net/minecraft/world/level/levelgen/feature/rootplacers/MangroveRootPlacer.java b/net/minecraft/world/level/levelgen/feature/rootplacers/MangroveRootPlacer.java
index 9917a138a92967b079b90e8e1b05bd887e048dfe..14058c16445d26df5d8f546aab6652321036a07b 100644
--- a/net/minecraft/world/level/levelgen/feature/rootplacers/MangroveRootPlacer.java
+++ b/net/minecraft/world/level/levelgen/feature/rootplacers/MangroveRootPlacer.java
@@ -54,7 +54,7 @@ public class MangroveRootPlacer extends RootPlacer {
list.add(trunkOrigin.below());
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = trunkOrigin.relative(direction);
List<BlockPos> list1 = Lists.newArrayList();
if (!this.simulateRoots(level, random, blockPos, direction, trunkOrigin, list1, 0)) {
diff --git a/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java b/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java
index 203e3899be4a86fdeeb4ad4c021a7411b6173c45..103369405a139f992cb09865ae8297b3eeaeeec5 100644
--- a/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java
+++ b/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java
@@ -36,7 +36,7 @@ public class CocoaDecorator extends TreeDecorator {
.filter(pos -> pos.getY() - y <= 2)
.forEach(
blockPos -> {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (randomSource.nextFloat() <= 0.25F) {
Direction opposite = direction.getOpposite();
BlockPos blockPos1 = blockPos.offset(opposite.getStepX(), 0, opposite.getStepZ());
diff --git a/net/minecraft/world/level/levelgen/structure/StructurePiece.java b/net/minecraft/world/level/levelgen/structure/StructurePiece.java
index a41b156f14b7f9ffcaa32f7bcdff57692e6df2cd..58e162396008bdc4696b0dbfb23a1498413230db 100644
--- a/net/minecraft/world/level/levelgen/structure/StructurePiece.java
+++ b/net/minecraft/world/level/levelgen/structure/StructurePiece.java
@@ -419,7 +419,7 @@ public abstract class StructurePiece {
public static BlockState reorient(BlockGetter level, BlockPos pos, BlockState state) {
Direction direction = null;
- for (Direction direction1 : Direction.Plane.HORIZONTAL) {
+ for (Direction direction1 : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = pos.relative(direction1);
BlockState blockState = level.getBlockState(blockPos);
if (blockState.is(Blocks.CHEST)) {
diff --git a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java
index 0d2451a9ade43650dbbcbab69ce0f6e8f69b5aee..25884acf1f322575b97ee9c1e743508a4366db98 100644
--- a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java
+++ b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java
@@ -286,7 +286,7 @@ public class DesertPyramidPiece extends ScatteredFeaturePiece {
this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), 10, -10, 13, box);
this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 10, -11, 13, box);
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (!this.hasPlacedChest[direction.get2DDataValue()]) {
int i4 = direction.getStepX() * 2;
int i5 = direction.getStepZ() * 2;
diff --git a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java
index 750162571a2277966fcddd01053f38b81e9f636f..b7b21fa8ee6824e8d646133c8a0eb269f74a08c6 100644
--- a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java
+++ b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java
@@ -168,7 +168,7 @@ public class WoodlandMansionPieces {
@Nullable
public Direction get1x2RoomDirection(WoodlandMansionPieces.SimpleGrid layout, int x, int y, int floor, int roomId) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (this.isRoomId(layout, x + direction.getStepX(), y + direction.getStepZ(), floor, roomId)) {
return direction;
}
@@ -284,7 +284,7 @@ public class WoodlandMansionPieces {
List<Direction> list1 = Lists.newArrayList();
- for (Direction direction1 : Direction.Plane.HORIZONTAL) {
+ for (Direction direction1 : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (this.thirdFloorGrid.get(i3 + direction1.getStepX(), i4 + direction1.getStepZ()) == 0) {
list1.add(direction1);
}
@@ -537,7 +537,7 @@ public class WoodlandMansionPieces {
flag1 = flag1 && (i8 & 8388608) == 8388608;
list.clear();
if ((i8 & 2097152) == 2097152) {
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (simpleGrid3.get(i7 + direction.getStepX(), i6 + direction.getStepZ()) == 1) {
list.add(direction);
}
diff --git a/net/minecraft/world/level/material/FlowingFluid.java b/net/minecraft/world/level/material/FlowingFluid.java
index bcda72fbd920a087ea7d10171da933b13adc1813..69aba8d4d83608685acb7facfb19fcf97f2500db 100644
--- a/net/minecraft/world/level/material/FlowingFluid.java
+++ b/net/minecraft/world/level/material/FlowingFluid.java
@@ -98,7 +98,7 @@ public abstract class FlowingFluid extends Fluid {
double d1 = 0.0;
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
mutableBlockPos.setWithOffset(pos, direction);
FluidState fluidState1 = blockReader.getFluidState(mutableBlockPos);
if (this.affectsFlow(fluidState1)) {
@@ -128,7 +128,7 @@ public abstract class FlowingFluid extends Fluid {
Vec3 vec3 = new Vec3(d, 0.0, d1);
if (fluidState.getValue(FALLING)) {
- for (Direction direction1 : Direction.Plane.HORIZONTAL) {
+ for (Direction direction1 : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
mutableBlockPos.setWithOffset(pos, direction1);
if (this.isSolidFace(blockReader, mutableBlockPos, direction1) || this.isSolidFace(blockReader, mutableBlockPos.above(), direction1)) {
vec3 = vec3.normalize().add(0.0, -6.0, 0.0);
@@ -218,7 +218,7 @@ public abstract class FlowingFluid extends Fluid {
int i1 = 0;
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = mutableBlockPos.setWithOffset(pos, direction);
BlockState blockState = level.getBlockStateIfLoaded(blockPos); // Paper - Prevent chunk loading from fluid flowing
if (blockState == null) continue; // Paper - Prevent chunk loading from fluid flowing
@@ -349,7 +349,7 @@ public abstract class FlowingFluid extends Fluid {
visited.clear();
queue.clear();
- for (Direction dir : Direction.Plane.HORIZONTAL) {
+ for (Direction dir : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (dir == excludedDirection) continue;
BlockPos neighborPos = startPos.relative(dir); // immutable
@@ -379,7 +379,7 @@ public abstract class FlowingFluid extends Fluid {
if (current.depth >= slopeFindDistance) continue;
- for (Direction dir : Direction.Plane.HORIZONTAL) {
+ for (Direction dir : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
if (dir == current.excludedDir) continue;
BlockPos nextPos = current.pos.relative(dir); // immutable
@@ -490,7 +490,7 @@ public abstract class FlowingFluid extends Fluid {
private int sourceNeighborCount(LevelReader level, BlockPos pos) {
int i = 0;
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = pos.relative(direction);
FluidState fluidState = level.getFluidState(blockPos);
if (this.isSourceBlockOfThisType(fluidState)) {
@@ -506,7 +506,7 @@ public abstract class FlowingFluid extends Fluid {
Map<Direction, FluidState> map = Maps.newEnumMap(Direction.class);
FlowingFluid.SpreadContext spreadContext = null;
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = pos.relative(direction);
BlockState blockState = level.getBlockStateIfLoaded(blockPos); // Paper - Prevent chunk loading from fluid flowing
if (blockState == null) continue; // Paper - Prevent chunk loading from fluid flowing
diff --git a/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java b/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
index c598d91cd9fb711bc9aaa068fbb806619c0d4fe2..da19fcb30c00b29140763605333badc3069aa11f 100644
--- a/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
+++ b/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
@@ -59,7 +59,7 @@ public class SwimNodeEvaluator extends NodeEvaluator {
}
}
- for (Direction direction1 : Direction.Plane.HORIZONTAL) {
+ for (Direction direction1 : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
Direction clockWise = direction1.getClockWise();
if (hasMalus(map.get(direction1)) && hasMalus(map.get(clockWise))) {
Node node2 = this.findAcceptedNode(
diff --git a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
index 7eb7a8a4b4c000d543d2a6bc181421493164df34..be0ed27b13b5d7e5a71e6c9bdd48891f0d267e4b 100644
--- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -129,7 +129,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
double floorLevel = this.getFloorLevel(new BlockPos(node.x, node.y, node.z));
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
Node node1 = this.findAcceptedNode(node.x + direction.getStepX(), node.y, node.z + direction.getStepZ(), i1, floorLevel, direction, cachedPathType1);
this.reusableNeighbors[direction.get2DDataValue()] = node1;
if (this.isNeighborValid(node1, node)) {
@@ -137,7 +137,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
}
}
- for (Direction directionx : Direction.Plane.HORIZONTAL) {
+ for (Direction directionx : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
Direction clockWise = directionx.getClockWise();
if (this.isDiagonalValid(node, this.reusableNeighbors[directionx.get2DDataValue()], this.reusableNeighbors[clockWise.get2DDataValue()])) {
Node node2 = this.findAcceptedNode(
diff --git a/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java b/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java
index 865da6563ec6ec04d255d0b14aea75ebd95a671b..c5ed04d28ee9e33bfbf62be01965b8595a4eec78 100644
--- a/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java
+++ b/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java
@@ -27,7 +27,7 @@ public abstract class RedstoneWireEvaluator {
protected int getIncomingWireSignal(Level level, BlockPos pos) {
int i = 0;
- for (Direction direction : Direction.Plane.HORIZONTAL) {
+ for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces
BlockPos blockPos = pos.relative(direction);
BlockState blockState = level.getBlockState(blockPos);
i = Math.max(i, this.getWireSignal(blockPos, blockState));

View File

@@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Yive <6853318+Yive@users.noreply.github.com>
Date: Tue, 6 May 2025 10:12:32 -0700
Subject: [PATCH] Pluto: reduce allocation
Original license: GPL-3.0
Original project: https://github.com/Yive/Pluto
diff --git a/alternate/current/wire/WireHandler.java b/alternate/current/wire/WireHandler.java
index 259b301b2c8b64cb7974a235afb260e0e991af54..2c3dcd7e21f5e79ec12c9ffff3cd3c7f9da28b73 100644
--- a/alternate/current/wire/WireHandler.java
+++ b/alternate/current/wire/WireHandler.java
@@ -136,6 +136,8 @@ import net.minecraft.world.level.redstone.Redstone;
*/
public class WireHandler {
+ private static final UpdateOrder[] UPDATE_ORDERS = UpdateOrder.values(); // Pluto - reduce allocation
+
public static class Directions {
public static final Direction[] ALL = { Direction.WEST, Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.DOWN, Direction.UP };
@@ -489,7 +491,7 @@ public class WireHandler {
}
}
- updateOrder = UpdateOrder.values()[level.paperConfig().misc.alternateCurrentUpdateOrder.ordinal()];
+ updateOrder = UPDATE_ORDERS[level.paperConfig().misc.alternateCurrentUpdateOrder.ordinal()]; // Pluto - reduce allocation
}
/**
diff --git a/net/minecraft/world/entity/SpawnPlacementTypes.java b/net/minecraft/world/entity/SpawnPlacementTypes.java
index a18f4c2f6b8ab6fdcafc9345a1c3ba80d5114124..0a19c8bde1aba16ad9a63f18e071c9b0eabe313b 100644
--- a/net/minecraft/world/entity/SpawnPlacementTypes.java
+++ b/net/minecraft/world/entity/SpawnPlacementTypes.java
@@ -25,12 +25,12 @@ public interface SpawnPlacementTypes {
@Override
public boolean isSpawnPositionOk(LevelReader level, BlockPos pos, @Nullable EntityType<?> entityType) {
if (entityType != null && level.getWorldBorder().isWithinBounds(pos)) {
- BlockPos blockPos = pos.above();
+ // BlockPos blockPos = pos.above(); // Pluto - reduce allocation
BlockPos blockPos1 = pos.below();
BlockState blockState = level.getBlockState(blockPos1);
return blockState.isValidSpawn(level, blockPos1, entityType)
&& this.isValidEmptySpawnBlock(level, pos, entityType)
- && this.isValidEmptySpawnBlock(level, blockPos, entityType);
+ && this.isValidEmptySpawnBlock(level, pos.above(), entityType); // Pluto - reduce allocation
} else {
return false;
}