- Updated to 1.19 - Added mangrove vertical slabs It has one launch crash that will need to be fixed
35 lines
1.3 KiB
Java
35 lines
1.3 KiB
Java
package tech.nevets.vplus.blocks;
|
|
|
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.BlockState;
|
|
import net.minecraft.block.Material;
|
|
import net.minecraft.enchantment.EnchantmentHelper;
|
|
import net.minecraft.enchantment.Enchantments;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.server.world.ServerWorld;
|
|
import net.minecraft.sound.BlockSoundGroup;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.MathHelper;
|
|
|
|
import java.util.Random;
|
|
|
|
public class RubyOre extends Block {
|
|
public RubyOre() {
|
|
super(FabricBlockSettings.of(Material.STONE).requiresTool().sounds(BlockSoundGroup.STONE).strength(3, 1500f));
|
|
}
|
|
protected int getExperienceWhenMined(Random random) {
|
|
return MathHelper.nextInt((net.minecraft.util.math.random.Random) random, 3, 7);
|
|
}
|
|
|
|
public void onStacksDropped(BlockState state, ServerWorld world, BlockPos pos, ItemStack stack) {
|
|
super.onStacksDropped(state, world, pos, stack, true);
|
|
if (EnchantmentHelper.get(stack).containsKey(Enchantments.SILK_TOUCH)) {
|
|
int i = this.getExperienceWhenMined((Random) world.random);
|
|
if (i > 0) {
|
|
this.dropExperience(world, pos, i);
|
|
}
|
|
}
|
|
}
|
|
}
|