Class PlacementHandlers
java.lang.Object
com.ldtteam.structurize.placement.handlers.placement.PlacementHandlers
Class containing all placement handler implementations.
We suppress warning squid:S2972 which handles the max size of internal classes. This doesn't apply here since it wouldn't make sense extracting all of those in separate classes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classmojang abusing lazyupdates, this modification always happens, but we need it now, not laterstatic classstatic class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidadd(IPlacementHandler handler) Adds a handler to the start of the handlers list, effectively overriding existing ones with similar 'canHandle' functions because this one will evaluate before themstatic voidadd(IPlacementHandler handler, Class<?> override) Allows for adding new handlers without having to clear the list in other mods just to override onestatic List<net.minecraft.world.item.ItemStack>getItemsFromTileEntity(net.minecraft.nbt.CompoundTag tileEntityData, net.minecraft.world.level.block.state.BlockState blockState) Gets the list of items from a possible tileEntity.static List<net.minecraft.world.item.ItemStack>getRequiredItemsForState(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag data, boolean complete) Get the required items for this state.static voidhandleTileEntityPlacement(net.minecraft.nbt.CompoundTag tileEntityData, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, RotationMirror settings) Handles tileEntity placement.
-
Field Details
-
handlers
-
-
Method Details
-
add
Allows for adding new handlers without having to clear the list in other mods just to override one- Parameters:
handler- the new handler to addoverride- the class to override if it can be found
-
add
Adds a handler to the start of the handlers list, effectively overriding existing ones with similar 'canHandle' functions because this one will evaluate before them- Parameters:
handler-
-
handleTileEntityPlacement
public static void handleTileEntityPlacement(net.minecraft.nbt.CompoundTag tileEntityData, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, RotationMirror settings) Handles tileEntity placement.- Parameters:
tileEntityData- the data of the tile entity.world- the world.pos- the position.settings- the placement settings.
-
getRequiredItemsForState
public static List<net.minecraft.world.item.ItemStack> getRequiredItemsForState(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag data, boolean complete) Get the required items for this state.- Parameters:
world- the world it will be placed in.pos- the pos to place it at.state- the state to place.data- its TE data.complete- if complete.- Returns:
- the required items.
-
getItemsFromTileEntity
public static List<net.minecraft.world.item.ItemStack> getItemsFromTileEntity(net.minecraft.nbt.CompoundTag tileEntityData, net.minecraft.world.level.block.state.BlockState blockState) Gets the list of items from a possible tileEntity.- Parameters:
tileEntityData- the data.blockState- the block.- Returns:
- the required list.
-