Code cleanup and refactoring before porting

This commit is contained in:
2023-05-10 21:21:16 +02:00
parent 1dec8d130c
commit 8e72212bf6
134 changed files with 975 additions and 755 deletions

View File

@@ -0,0 +1,22 @@
package com.hypherionmc.craterlib.util;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import java.util.function.ToIntFunction;
/**
* @author HypherionSA
* Helper class to create light levels from BlockState values
*/
public class BlockStateUtils {
public static ToIntFunction<BlockState> lightLevelFromLitBlockState(int litLevel) {
return state -> state.getValue(BlockStateProperties.LIT) ? litLevel : 0;
}
public static ToIntFunction<BlockState> lightLevelFromPoweredBlockState(int litLevel) {
return state -> state.getValue(BlockStateProperties.POWERED) ? litLevel : 0;
}
}