Package top.girlkisser.lazuli.api.world
Class FakePlayerHelpers
java.lang.Object
top.girlkisser.lazuli.api.world.FakePlayerHelpers
Provides helpers for NeoForge
FakePlayers.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ArgLazy<net.neoforged.neoforge.common.util.FakePlayer, net.minecraft.server.level.ServerLevel> A fake player to use. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<net.minecraft.world.item.ItemStack> breakBlockAndGetDrops(net.minecraft.server.level.ServerLevel serverLevel, net.minecraft.core.BlockPos pos) Breaks a block and gets the drops from it.static List<net.minecraft.world.item.ItemStack> breakBlockAndGetDrops(net.minecraft.server.level.ServerLevel serverLevel, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.core.BlockPos pos) Breaks a block and gets the drops from it.static net.minecraft.world.item.context.UseOnContextgetUseOnContext(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack, net.minecraft.core.BlockPos pos) Creates aUseOnContext.static voidplaceBlockItem(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.item.ItemStack blockItemStack, net.minecraft.core.Direction direction) Places a block item.
-
Field Details
-
FAKE_PLAYER
public static final ArgLazy<net.neoforged.neoforge.common.util.FakePlayer,net.minecraft.server.level.ServerLevel> FAKE_PLAYERA fake player to use.
-
-
Method Details
-
breakBlockAndGetDrops
public static List<net.minecraft.world.item.ItemStack> breakBlockAndGetDrops(net.minecraft.server.level.ServerLevel serverLevel, net.minecraft.world.level.block.state.BlockState blockState, net.minecraft.core.BlockPos pos) Breaks a block and gets the drops from it. The drops are not added in the world.- Parameters:
serverLevel- The level.blockState- The block state to break.pos- The block's position.- Returns:
- The block's drops.
-
breakBlockAndGetDrops
public static List<net.minecraft.world.item.ItemStack> breakBlockAndGetDrops(net.minecraft.server.level.ServerLevel serverLevel, net.minecraft.core.BlockPos pos) Breaks a block and gets the drops from it. The drops are not added in the world.- Parameters:
serverLevel- The level.pos- The block's position.- Returns:
- The block's drops.
-
placeBlockItem
public static void placeBlockItem(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.item.ItemStack blockItemStack, @Nullable net.minecraft.core.Direction direction) Places a block item.- Parameters:
level- The level.pos- Where to place the block.blockItemStack- The item stack. This must be aBlockItemor an error will be thrown.direction- The direction that the block is being placed in. This will not impact the location of the placed block typically, The block will always be placed atpos.
-
getUseOnContext
public static net.minecraft.world.item.context.UseOnContext getUseOnContext(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack, net.minecraft.core.BlockPos pos) Creates aUseOnContext.- Parameters:
level- The level.stack- The held item stack.pos- The block position.- Returns:
- The context.
-