Class LootCommand
java.lang.Object
net.minecraft.server.commands.LootCommand
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interfaceprivate static interfaceprivate static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final DynamicCommandExceptionTypeprivate static final DynamicCommandExceptionTypeprivate static final DynamicCommandExceptionType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T extends ArgumentBuilder<CommandSourceStack, T>>
TaddTargets(T root, LootCommand.TailProvider tail) private static intblockDistribute(CommandSourceStack source, BlockPos pos, List<ItemStack> drops, LootCommand.Callback callback) private static intblockReplace(CommandSourceStack source, BlockPos pos, int startSlot, int slotCount, List<ItemStack> drops, LootCommand.Callback callback) private static voidcallback(CommandSourceStack source, List<ItemStack> drops) private static voidcallback(CommandSourceStack source, List<ItemStack> drops, ResourceKey<LootTable> location) private static booleancanMergeItems(ItemStack a, ItemStack b) private static booleandistributeToContainer(Container container, ItemStack itemStack) private static intdrop(CommandContext<CommandSourceStack> context, Holder<LootTable> lootTable, LootParams lootParams, LootCommand.DropConsumer output) private static intdropBlockLoot(CommandContext<CommandSourceStack> context, BlockPos pos, ItemInstance tool, LootCommand.DropConsumer output) private static intdropChestLoot(CommandContext<CommandSourceStack> context, Holder<LootTable> lootTable, LootCommand.DropConsumer output) private static intdropFishingLoot(CommandContext<CommandSourceStack> context, Holder<LootTable> lootTable, BlockPos pos, ItemInstance tool, LootCommand.DropConsumer output) private static intdropInWorld(CommandSourceStack source, Vec3 pos, List<ItemStack> drops, LootCommand.Callback callback) private static intdropKillLoot(CommandContext<CommandSourceStack> context, Entity target, LootCommand.DropConsumer output) private static intentityReplace(Collection<? extends Entity> entities, int startSlot, int count, List<ItemStack> drops, LootCommand.Callback callback) private static ContainergetContainer(CommandSourceStack source, BlockPos pos) private static ItemStackgetSourceHandItem(CommandSourceStack source, EquipmentSlot slot) private static intplayerGive(Collection<ServerPlayer> players, List<ItemStack> drops, LootCommand.Callback callback) static voidregister(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext context) private static voidsetSlots(Entity entity, List<ItemStack> itemsToSet, int startSlot, int count, List<ItemStack> usedItems)
-
Field Details
-
ERROR_NO_HELD_ITEMS
-
ERROR_NO_ENTITY_LOOT_TABLE
-
ERROR_NO_BLOCK_LOOT_TABLE
-
-
Constructor Details
-
LootCommand
public LootCommand()
-
-
Method Details
-
register
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext context) -
addTargets
private static <T extends ArgumentBuilder<CommandSourceStack, T>> T addTargets(T root, LootCommand.TailProvider tail) -
getContainer
private static Container getContainer(CommandSourceStack source, BlockPos pos) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
blockDistribute
private static int blockDistribute(CommandSourceStack source, BlockPos pos, List<ItemStack> drops, LootCommand.Callback callback) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
distributeToContainer
-
blockReplace
private static int blockReplace(CommandSourceStack source, BlockPos pos, int startSlot, int slotCount, List<ItemStack> drops, LootCommand.Callback callback) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
canMergeItems
-
playerGive
private static int playerGive(Collection<ServerPlayer> players, List<ItemStack> drops, LootCommand.Callback callback) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
setSlots
-
entityReplace
private static int entityReplace(Collection<? extends Entity> entities, int startSlot, int count, List<ItemStack> drops, LootCommand.Callback callback) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
dropInWorld
private static int dropInWorld(CommandSourceStack source, Vec3 pos, List<ItemStack> drops, LootCommand.Callback callback) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
callback
-
callback
private static void callback(CommandSourceStack source, List<ItemStack> drops, ResourceKey<LootTable> location) -
getSourceHandItem
private static ItemStack getSourceHandItem(CommandSourceStack source, EquipmentSlot slot) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
dropBlockLoot
private static int dropBlockLoot(CommandContext<CommandSourceStack> context, BlockPos pos, ItemInstance tool, LootCommand.DropConsumer output) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
dropKillLoot
private static int dropKillLoot(CommandContext<CommandSourceStack> context, Entity target, LootCommand.DropConsumer output) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
dropChestLoot
private static int dropChestLoot(CommandContext<CommandSourceStack> context, Holder<LootTable> lootTable, LootCommand.DropConsumer output) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
dropFishingLoot
private static int dropFishingLoot(CommandContext<CommandSourceStack> context, Holder<LootTable> lootTable, BlockPos pos, ItemInstance tool, LootCommand.DropConsumer output) throws CommandSyntaxException - Throws:
CommandSyntaxException
-
drop
private static int drop(CommandContext<CommandSourceStack> context, Holder<LootTable> lootTable, LootParams lootParams, LootCommand.DropConsumer output) throws CommandSyntaxException - Throws:
CommandSyntaxException
-