Class BlockStateHelper
java.lang.Object
team.lodestar.lodestone.helpers.block.BlockStateHelper
A collection of various helper methods related to blockstates
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.world.level.block.state.BlockStategetBlockStateWithExistingProperties(net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) Copies all properties from oldState to newState, given that an individual property exists on the newState.static <T extends Comparable<T>>
net.minecraft.world.level.block.state.BlockStatenewStateWithOldProperty(net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState, net.minecraft.world.level.block.state.properties.Property<T> property) Copies BlockState properties from a BlockState already in the world, and returns a newState with matching property values.static net.minecraft.world.level.block.state.BlockStatesetBlockStateWithExistingProperties(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState newState, int flags) Copies BlockState properties from a BlockState already in the world, and replaces it with a newState with matching property values.static voidupdateAndNotifyState(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Updates a blockstate at a given position with the client and notifies its neighbours.static voidupdateAndNotifyState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Updates a blockstate at a given position with the client and notifies its neighbours.static voidupdateState(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Updates a blockstate at a given position with the client.static voidupdateState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Updates a blockstate at a given position with the client.
-
Constructor Details
-
BlockStateHelper
public BlockStateHelper()
-
-
Method Details
-
getBlockStateWithExistingProperties
public static net.minecraft.world.level.block.state.BlockState getBlockStateWithExistingProperties(net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) Copies all properties from oldState to newState, given that an individual property exists on the newState.- Parameters:
oldState- - State to copy properties from.newState- - State to apply copied property values to.- Returns:
- - NewState with adjusted properties.
-
setBlockStateWithExistingProperties
public static net.minecraft.world.level.block.state.BlockState setBlockStateWithExistingProperties(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState newState, int flags) Copies BlockState properties from a BlockState already in the world, and replaces it with a newState with matching property values. -
newStateWithOldProperty
public static <T extends Comparable<T>> net.minecraft.world.level.block.state.BlockState newStateWithOldProperty(net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState, net.minecraft.world.level.block.state.properties.Property<T> property) Copies BlockState properties from a BlockState already in the world, and returns a newState with matching property values. -
updateState
public static void updateState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Updates a blockstate at a given position with the client. Also syncs block entities. -
updateState
public static void updateState(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Updates a blockstate at a given position with the client. Also syncs block entities. -
updateAndNotifyState
public static void updateAndNotifyState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Updates a blockstate at a given position with the client and notifies its neighbours. Also syncs block entities. -
updateAndNotifyState
public static void updateAndNotifyState(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Updates a blockstate at a given position with the client and notifies its neighbours. Also syncs block entities.
-