LootTable related changes

This commit is contained in:
Frank 2023-05-17 14:45:44 +02:00
parent 4a74a44422
commit 40ab94d4fe
39 changed files with 88 additions and 88 deletions

View file

@ -23,7 +23,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.fabricmc.api.EnvType;
@ -102,7 +102,7 @@ public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelPro
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
int destruction = state.getValue(DESTRUCTION);
int durability = state.getValue(getDurabilityProp());
int value = destruction * getMaxDurability() + durability;

View file

@ -29,7 +29,7 @@ import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.BlockHitResult;
import net.fabricmc.api.EnvType;
@ -56,7 +56,7 @@ public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider {
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
List<ItemStack> drop = super.getDrops(state, builder);
drop.add(new ItemStack(this.asItem()));
return drop;

View file

@ -8,7 +8,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import java.util.Collections;
import java.util.List;
@ -40,7 +40,7 @@ public class BaseBlock extends Block implements BlockModelProvider {
*/
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -5,7 +5,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import java.util.Collections;
import java.util.List;
@ -22,7 +22,7 @@ public class BaseBlockWithEntity extends BaseEntityBlock {
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}
}

View file

@ -13,7 +13,7 @@ import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.fabricmc.api.EnvType;
@ -50,7 +50,7 @@ public class BaseBookshelfBlock extends BaseBlock {
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null) {
int silk = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool);

View file

@ -16,7 +16,7 @@ import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -49,7 +49,7 @@ public abstract class BaseButtonBlock extends ButtonBlock implements BlockModelP
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -17,7 +17,7 @@ import net.minecraft.world.level.block.ChainBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -39,7 +39,7 @@ public class BaseChainBlock extends ChainBlock implements BlockModelProvider, Re
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -15,7 +15,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ChestBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -39,7 +39,7 @@ public class BaseChestBlock extends ChestBlock implements BlockModelProvider {
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
List<ItemStack> drop = super.getDrops(state, builder);
drop.add(new ItemStack(this.asItem()));
return drop;

View file

@ -12,7 +12,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ComposterBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -30,7 +30,7 @@ public class BaseComposterBlock extends ComposterBlock implements BlockModelProv
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this.asItem()));
}

View file

@ -12,7 +12,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.CraftingTableBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -34,7 +34,7 @@ public class BaseCraftingTableBlock extends CraftingTableBlock implements BlockM
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this.asItem()));
}

View file

@ -19,7 +19,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -63,7 +63,7 @@ public class BaseCropBlock extends BasePlantBlock {
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
if (state.getValue(AGE) < 3) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -26,7 +26,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.block.state.properties.DoorHingeSide;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -48,7 +48,7 @@ public class BaseDoorBlock extends DoorBlock implements RenderLayerProvider, Blo
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
if (state.getValue(HALF) == DoubleBlockHalf.LOWER)
return Collections.singletonList(new ItemStack(this.asItem()));
else return Collections.emptyList();

View file

@ -28,7 +28,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
@ -113,7 +113,7 @@ public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements R
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,

View file

@ -14,7 +14,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.FenceBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -35,7 +35,7 @@ public class BaseFenceBlock extends FenceBlock implements BlockModelProvider {
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -26,7 +26,7 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.fabricmc.api.EnvType;
@ -109,7 +109,7 @@ public class BaseFurnaceBlock extends FurnaceBlock implements BlockModelProvider
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
List<ItemStack> drop = Lists.newArrayList(new ItemStack(this));
BlockEntity blockEntity = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
if (blockEntity instanceof BaseFurnaceBlockEntity) {

View file

@ -14,7 +14,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.FenceGateBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -35,7 +35,7 @@ public class BaseGateBlock extends FenceGateBlock implements BlockModelProvider
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -12,7 +12,7 @@ import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.fabricmc.api.EnvType;
@ -28,10 +28,10 @@ public class BaseGlassBlock extends BaseBlockNotFull implements AddMineablePicka
public BaseGlassBlock(Block block, float resistance) {
super(Properties.copy(block)
.explosionResistance(resistance)
.noOcclusion()
.isSuffocating((arg1, arg2, arg3) -> false)
.isViewBlocking((arg1, arg2, arg3) -> false));
.explosionResistance(resistance)
.noOcclusion()
.isSuffocating((arg1, arg2, arg3) -> false)
.isViewBlocking((arg1, arg2, arg3) -> false));
}
@Environment(EnvType.CLIENT)
@ -50,7 +50,7 @@ public class BaseGlassBlock extends BaseBlockNotFull implements AddMineablePicka
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
return Collections.singletonList(new ItemStack(this));

View file

@ -15,7 +15,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.LadderBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -67,7 +67,7 @@ public class BaseLadderBlock extends LadderBlock implements RenderLayerProvider,
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}
}

View file

@ -25,7 +25,7 @@ import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import com.google.common.collect.Lists;
@ -83,14 +83,14 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return BaseLeavesBlock.getLeaveDrops(this, this.sapling, builder, 16, 16);
}
public static List<ItemStack> getLeaveDrops(
ItemLike leaveBlock,
Block sapling,
LootContext.Builder builder,
LootParams.Builder builder,
int fortuneRate,
int dropRate
) {

View file

@ -18,7 +18,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.IronBarsBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -40,7 +40,7 @@ public class BaseMetalBarsBlock extends IronBarsBlock implements BlockModelProvi
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -26,7 +26,7 @@ import net.minecraft.world.level.block.DropExperienceBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import java.util.Collections;
@ -76,7 +76,7 @@ public class BaseOreBlock extends DropExperienceBlock implements BlockModelProvi
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return LootUtil
.getDrops(this, state, builder)
.orElseGet(
@ -99,7 +99,7 @@ public class BaseOreBlock extends DropExperienceBlock implements BlockModelProvi
int minCount,
int miningLevel,
BlockState state,
LootContext.Builder builder
LootParams.Builder builder
) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && tool.isCorrectToolForDrops(state)) {

View file

@ -16,7 +16,7 @@ import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -48,7 +48,7 @@ public class BasePathBlock extends BaseBlockNotFull {
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
return Collections.singletonList(new ItemStack(this));

View file

@ -28,7 +28,7 @@ import net.minecraft.world.level.block.BonemealableBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
@ -154,7 +154,7 @@ public abstract class BasePlantBlock extends BaseBlockNotFull implements RenderL
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,

View file

@ -14,7 +14,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.PressurePlateBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -38,7 +38,7 @@ public class BasePressurePlateBlock extends PressurePlateBlock implements BlockM
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -11,7 +11,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.RotatedPillarBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -33,7 +33,7 @@ public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockM
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -35,7 +35,7 @@ import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -178,7 +178,7 @@ public class BaseSignBlock extends SignBlock implements BlockModelProvider, Cust
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -18,7 +18,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SlabBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.SlabType;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -45,7 +45,7 @@ public class BaseSlabBlock extends SlabBlock implements BlockModelProvider, Cust
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
int count = state.getValue(TYPE) == SlabType.DOUBLE ? 2 : 1;
return Collections.singletonList(new ItemStack(this, count));
}

View file

@ -19,7 +19,7 @@ import net.minecraft.world.level.block.StairBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Half;
import net.minecraft.world.level.block.state.properties.StairsShape;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -46,7 +46,7 @@ public class BaseStairsBlock extends StairBlock implements BlockModelProvider, C
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -32,7 +32,7 @@ import net.minecraft.world.level.block.SnowLayerBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.lighting.LightEngine;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.BlockHitResult;
@ -93,7 +93,7 @@ public class BaseTerrainBlock extends BaseBlock {
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
return Collections.singletonList(new ItemStack(this));

View file

@ -18,7 +18,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.block.state.properties.Half;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -37,7 +37,7 @@ public class BaseTrapdoorBlock extends TrapDoorBlock implements RenderLayerProvi
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -27,7 +27,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
@ -118,7 +118,7 @@ public class BaseVineBlock extends BaseBlockNotFull implements RenderLayerProvid
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,

View file

@ -15,7 +15,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.WallBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.WallSide;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -36,7 +36,7 @@ public class BaseWallBlock extends WallBlock implements BlockModelProvider {
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -14,7 +14,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.WeightedPressurePlateBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -43,7 +43,7 @@ public class BaseWeightedPlateBlock extends WeightedPressurePlateBlock implement
@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -27,7 +27,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -79,7 +79,7 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}

View file

@ -26,7 +26,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
@ -130,7 +130,7 @@ public abstract class UnderwaterPlantBlock extends BaseBlockNotFull implements R
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,

View file

@ -22,7 +22,7 @@ import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -83,7 +83,7 @@ public abstract class UpDownPlantBlock extends BaseBlockNotFull implements Rende
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,

View file

@ -7,7 +7,7 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import com.google.common.collect.Lists;
@ -23,7 +23,7 @@ public abstract class WallMushroomBlock extends BaseWallPlantBlock {
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Lists.newArrayList(new ItemStack(this));
}

View file

@ -3,7 +3,7 @@ package org.betterx.bclib.mixin.common;
import org.betterx.bclib.interfaces.LootPoolAccessor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer;
import net.minecraft.world.level.storage.loot.functions.LootItemFunction;
@ -29,13 +29,13 @@ public class LootPoolMixin implements LootPoolAccessor {
public LootItemCondition[] conditions;
@Shadow
@Final
private Predicate<LootContext> compositeCondition;
private Predicate<LootParams> compositeCondition;
@Shadow
@Final
public LootItemFunction[] functions;
@Shadow
@Final
private BiFunction<ItemStack, LootContext, ItemStack> compositeFunction;
private BiFunction<ItemStack, LootParams, ItemStack> compositeFunction;
@Shadow
@Final
public NumberProvider rolls;

View file

@ -9,7 +9,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer;
@ -25,17 +25,17 @@ public class LootUtil {
public static Optional<List<ItemStack>> getDrops(
BlockBehaviour block,
BlockState state,
LootContext.Builder builder
LootParams.Builder builder
) {
ResourceLocation tableID = block.getLootTable();
if (tableID == BuiltInLootTables.EMPTY) {
return Optional.empty();
}
final LootContext ctx = builder.withParameter(LootContextParams.BLOCK_STATE, state)
.create(LootContextParamSets.BLOCK);
final LootParams ctx = builder.withParameter(LootContextParams.BLOCK_STATE, state)
.create(LootContextParamSets.BLOCK);
final ServerLevel level = ctx.getLevel();
final LootTable table = level.getServer().getLootTables().get(tableID);
final LootTable table = level.getServer().getLootData().getLootTable(tableID);
if (table == LootTable.EMPTY) return Optional.empty();
return Optional.of(table.getRandomItems(ctx));