Class BlockStateHelper

java.lang.Object
team.lodestar.lodestone.helpers.block.BlockStateHelper

public class BlockStateHelper extends Object
A collection of various helper methods related to blockstates
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    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.
    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.
    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.
    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.
    static void
    updateState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
    Updates a blockstate at a given position with the client.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.