48 lines
1.2 KiB
Java
48 lines
1.2 KiB
Java
package de.jottyfan.quickiemod.block;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
import com.mojang.serialization.MapCodec;
|
|
|
|
import net.minecraft.block.AbstractBlock;
|
|
import net.minecraft.block.BlockState;
|
|
import net.minecraft.block.FallingBlock;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.loot.context.LootWorldContext.Builder;
|
|
import net.minecraft.registry.RegistryKey;
|
|
import net.minecraft.registry.RegistryKeys;
|
|
import net.minecraft.util.Identifier;
|
|
import net.minecraft.world.explosion.Explosion;
|
|
|
|
/**
|
|
*
|
|
* @author jotty
|
|
*
|
|
*/
|
|
public class BlockPowder extends FallingBlock {
|
|
|
|
private final ItemStack[] drops;
|
|
|
|
public BlockPowder(Identifier identifier, ItemStack[] drops) {
|
|
super(AbstractBlock.Settings.create().luminance(state -> 12).registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier)));
|
|
this.drops = drops;
|
|
}
|
|
|
|
@Override
|
|
public List<ItemStack> getDroppedStacks(BlockState state, Builder builder) {
|
|
return Arrays.asList(drops);
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldDropItemsOnExplosion(Explosion explosion) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
protected MapCodec<? extends FallingBlock> getCodec() {
|
|
// TODO Auto-generated method stub
|
|
return null;
|
|
}
|
|
}
|