Code/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java

31 lines
1.1 KiB
Java
Raw Normal View History

2025-07-01 06:20:03 +00:00
package net.minecraft.world.level.redstone;
import javax.annotation.Nullable;
import net.minecraft.core.Direction;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.level.Level;
public class ExperimentalRedstoneUtils {
@Nullable
public static Orientation initialOrientation(Level p_360797_, @Nullable Direction p_367898_, @Nullable Direction p_368279_) {
if (p_360797_.enabledFeatures().contains(FeatureFlags.REDSTONE_EXPERIMENTS)) {
Orientation orientation = Orientation.random(p_360797_.random).withSideBias(Orientation.SideBias.LEFT);
if (p_368279_ != null) {
orientation = orientation.withUp(p_368279_);
}
if (p_367898_ != null) {
orientation = orientation.withFront(p_367898_);
}
return orientation;
} else {
return null;
}
}
@Nullable
public static Orientation withFront(@Nullable Orientation p_367198_, Direction p_365285_) {
return p_367198_ == null ? null : p_367198_.withFront(p_365285_);
}
}