Interface IPlacementHelper
- All Known Implementing Classes:
CogwheelBlockItem.DiagonalCogHelper,CogwheelBlockItem.IntegratedLargeCogHelper,CogwheelBlockItem.IntegratedSmallCogHelper,GantryShaftBlock.PlacementHelper,PistonExtensionPoleBlock.PlacementHelper,PoleHelper
public interface IPlacementHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.world.level.block.state.BlockStateused as an identifier in SuperGlueHandler to skip blocks placed by helpers -
Method Summary
Modifier and TypeMethodDescriptiondefault voiddisplayGhost(PlacementOffset offset) Predicate<net.minecraft.world.item.ItemStack>getOffset(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level world, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.BlockHitResult ray) default PlacementOffsetgetOffset(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level world, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.BlockHitResult ray, net.minecraft.world.item.ItemStack heldItem) Predicate<net.minecraft.world.level.block.state.BlockState>default booleanmatchesItem(net.minecraft.world.item.ItemStack item) default booleanmatchesState(net.minecraft.world.level.block.state.BlockState state) static List<net.minecraft.core.Direction>orderedByDistance(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit) static List<net.minecraft.core.Direction>orderedByDistance(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, Predicate<net.minecraft.core.Direction> includeDirection) static List<net.minecraft.core.Direction>orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis) static List<net.minecraft.core.Direction>orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis, Predicate<net.minecraft.core.Direction> includeDirection) static List<net.minecraft.core.Direction>orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis first, net.minecraft.core.Direction.Axis second) static List<net.minecraft.core.Direction>orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis first, net.minecraft.core.Direction.Axis second, Predicate<net.minecraft.core.Direction> includeDirection) static List<net.minecraft.core.Direction>orderedByDistanceOnlyAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis) static List<net.minecraft.core.Direction>orderedByDistanceOnlyAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis, Predicate<net.minecraft.core.Direction> includeDirection) static voidrenderArrow(net.minecraft.world.phys.Vec3 center, net.minecraft.world.phys.Vec3 target, net.minecraft.core.Direction arrowPlane) static voidrenderArrow(net.minecraft.world.phys.Vec3 center, net.minecraft.world.phys.Vec3 target, net.minecraft.core.Direction arrowPlane, double distanceFromCenter) default voidrenderAt(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.phys.BlockHitResult ray, PlacementOffset offset) overwrite this method if your placement helper needs a different rendering than the default ghost state
-
Field Details
-
ID
static final net.minecraft.world.level.block.state.BlockState IDused as an identifier in SuperGlueHandler to skip blocks placed by helpers
-
-
Method Details
-
getItemPredicate
Predicate<net.minecraft.world.item.ItemStack> getItemPredicate()- Returns:
- a predicate that gets tested with the items held in the players hands
should return true if this placement helper is active with the given item
-
getStatePredicate
Predicate<net.minecraft.world.level.block.state.BlockState> getStatePredicate()- Returns:
- a predicate that gets tested with the blockstate the player is looking at
should return true if this placement helper is active with the given blockstate
-
getOffset
PlacementOffset getOffset(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level world, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.BlockHitResult ray) - Parameters:
player- the player that activated the placement helperworld- the world that the placement helper got activated instate- the Blockstate of the Block that the player is looking at or clicked onpos- the position of the Block the player is looking at or clicked onray- the exact raytrace result- Returns:
- the PlacementOffset object describing where to place the new block.
UsePlacementOffset.fail()when no new position could be found.
UsePlacementOffset.success(Vector3i)with the new BlockPos to indicate a success and callPlacementOffset.withTransform(Function)if the blocks default state has to be modified before it is placed
-
getOffset
default PlacementOffset getOffset(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level world, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.BlockHitResult ray, net.minecraft.world.item.ItemStack heldItem) -
renderAt
default void renderAt(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.phys.BlockHitResult ray, PlacementOffset offset) overwrite this method if your placement helper needs a different rendering than the default ghost state- Parameters:
pos- the position of the Block the player is looking at or clicked onstate- the Blockstate of the Block that the player is looking at or clicked onray- the exact raytrace resultoffset- the PlacementOffset returned bygetOffset(PlayerEntity, World, BlockState, BlockPos, BlockRayTraceResult)
the offset will always be successful if this method is called
-
renderArrow
static void renderArrow(net.minecraft.world.phys.Vec3 center, net.minecraft.world.phys.Vec3 target, net.minecraft.core.Direction arrowPlane) -
renderArrow
static void renderArrow(net.minecraft.world.phys.Vec3 center, net.minecraft.world.phys.Vec3 target, net.minecraft.core.Direction arrowPlane, double distanceFromCenter) -
displayGhost
-
orderedByDistanceOnlyAxis
static List<net.minecraft.core.Direction> orderedByDistanceOnlyAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis) -
orderedByDistanceOnlyAxis
-
orderedByDistanceExceptAxis
static List<net.minecraft.core.Direction> orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis axis) -
orderedByDistanceExceptAxis
-
orderedByDistanceExceptAxis
static List<net.minecraft.core.Direction> orderedByDistanceExceptAxis(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit, net.minecraft.core.Direction.Axis first, net.minecraft.core.Direction.Axis second) -
orderedByDistanceExceptAxis
-
orderedByDistance
static List<net.minecraft.core.Direction> orderedByDistance(net.minecraft.core.BlockPos pos, net.minecraft.world.phys.Vec3 hit) -
orderedByDistance
-
matchesItem
default boolean matchesItem(net.minecraft.world.item.ItemStack item) -
matchesState
default boolean matchesState(net.minecraft.world.level.block.state.BlockState state)
-