Class FakePlayerHelpers

java.lang.Object
top.girlkisser.lazuli.api.world.FakePlayerHelpers

public final class FakePlayerHelpers extends Object
Provides helpers for NeoForge FakePlayers.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ArgLazy<net.neoforged.neoforge.common.util.FakePlayer,net.minecraft.server.level.ServerLevel>
    A fake player to use.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.UseOnContext
    getUseOnContext(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack, net.minecraft.core.BlockPos pos)
    Creates a UseOnContext.
    static void
    placeBlockItem(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FAKE_PLAYER

      public static final ArgLazy<net.neoforged.neoforge.common.util.FakePlayer,net.minecraft.server.level.ServerLevel> FAKE_PLAYER
      A 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 a BlockItem or 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 at pos.
    • 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 a UseOnContext.
      Parameters:
      level - The level.
      stack - The held item stack.
      pos - The block position.
      Returns:
      The context.