Asbestos/src/main/java/dev/agatharose/asbestos/AsbestosRegistry.java

127 lines
7.3 KiB
Java

package dev.agatharose.asbestos;
import dev.agatharose.asbestos.item.PpeArmorMaterial;
import dev.agatharose.asbestos.item.ScraperItem;
import dev.agatharose.asbestos.item.ScraperToolMaterial;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.Material;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.BlockItem;
import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ToolItem;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
@SuppressWarnings("deprecation")
public class AsbestosRegistry {
// block/item definitions
public static final Item ASBESTOS_FIBERS = new Item(new FabricItemSettings().group(ItemGroup.MATERIALS)
.fireproof()
.food(new FoodComponent.Builder().alwaysEdible().statusEffect(
new StatusEffectInstance(StatusEffects.WITHER, 30 * 20, 4, false, false), 1.0f)
.build()));
public static final CarcinogenicBlock ASBESTOS_BLOCK = new CarcinogenicBlock(
FabricBlockSettings.of(Material.WOOL).hardness(1.0f).sounds(BlockSoundGroup.WOOL), 40);
public static final CarcinogenicBlock SERPENTINITE_BLOCK = new CarcinogenicBlock(FabricBlockSettings
.of(Material.STONE).hardness(3.0f).breakByTool(FabricToolTags.PICKAXES).requiresTool(), 20);
public static final CarcinogenicBlock POPCORN_CEILING_BLOCK = new CarcinogenicBlock(FabricBlockSettings
.of(Material.WOOD).hardness(2.0f).breakByTool(FabricToolTags.AXES).sounds(BlockSoundGroup.WOOD),
20);
public static final CarcinogenicBlock ASBESTOS_TILE_BLOCK = new CarcinogenicBlock(
FabricBlockSettings.of(Material.STONE).hardness(3.0f).sounds(BlockSoundGroup.NETHER_BRICKS),
20);
public static ToolItem IRON_SCRAPER = new ScraperItem(ScraperToolMaterial.INSTANCE, 0.0f, -3.0f,
new Item.Settings().group(ItemGroup.TOOLS));
// asbestos removal ppe
public static final ArmorMaterial PPE_ARMOR_MATERIAL = new PpeArmorMaterial();
public static final Item PPE_HELMET = new ArmorItem(PPE_ARMOR_MATERIAL, EquipmentSlot.HEAD,
new Item.Settings().group(ItemGroup.COMBAT));
public static final Item PPE_CHESTPLATE = new ArmorItem(PPE_ARMOR_MATERIAL, EquipmentSlot.CHEST,
new Item.Settings().group(ItemGroup.COMBAT));
public static final Item PPE_LEGGINGS = new ArmorItem(PPE_ARMOR_MATERIAL, EquipmentSlot.LEGS,
new Item.Settings().group(ItemGroup.COMBAT));
public static final Item PPE_BOOTS = new ArmorItem(PPE_ARMOR_MATERIAL, EquipmentSlot.FEET,
new Item.Settings().group(ItemGroup.COMBAT));
// serpentinite worldgen
private static ConfiguredFeature<?, ?> SERPENTINITE_OVERWORLD = Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
SERPENTINITE_BLOCK.getDefaultState(), 5))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(0, 0, 32))).spreadHorizontally()
.repeat(10);
public static void register() {
// asbestos fibers item
Registry.register(Registry.ITEM, new Identifier("asbestos", "asbestos_fibers"), ASBESTOS_FIBERS);
// asbestos block
Registry.register(Registry.BLOCK, new Identifier("asbestos", "asbestos_block"), ASBESTOS_BLOCK);
Registry.register(Registry.ITEM, new Identifier("asbestos", "asbestos_block"), new BlockItem(
ASBESTOS_BLOCK, new Item.Settings().group(ItemGroup.BUILDING_BLOCKS).fireproof()));
// serpentinite block
Registry.register(Registry.BLOCK, new Identifier("asbestos", "serpentinite_block"), SERPENTINITE_BLOCK);
Registry.register(Registry.ITEM, new Identifier("asbestos", "serpentinite_block"), new BlockItem(
SERPENTINITE_BLOCK, new Item.Settings().group(ItemGroup.BUILDING_BLOCKS)));
// popcorn ceiling block
Registry.register(Registry.BLOCK, new Identifier("asbestos", "popcorn_ceiling_block"),
POPCORN_CEILING_BLOCK);
Registry.register(Registry.ITEM, new Identifier("asbestos", "popcorn_ceiling_block"),
new BlockItem(POPCORN_CEILING_BLOCK,
new Item.Settings().group(ItemGroup.BUILDING_BLOCKS).fireproof()));
// asbestos tile block
Registry.register(Registry.BLOCK, new Identifier("asbestos", "asbestos_tile_block"),
ASBESTOS_TILE_BLOCK);
Registry.register(Registry.ITEM, new Identifier("asbestos", "asbestos_tile_block"), new BlockItem(
ASBESTOS_TILE_BLOCK, new Item.Settings().group(ItemGroup.BUILDING_BLOCKS)));
// serpentinite worldgen
RegistryKey<ConfiguredFeature<?, ?>> serpentiniteOverworld = RegistryKey.of(
Registry.CONFIGURED_FEATURE_WORLDGEN,
new Identifier("asbestos", "serpentinite_overworld"));
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, serpentiniteOverworld.getValue(),
SERPENTINITE_OVERWORLD);
BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(),
GenerationStep.Feature.UNDERGROUND_ORES, serpentiniteOverworld);
// scraper tool
Registry.register(Registry.ITEM, new Identifier("asbestos", "iron_scraper"), IRON_SCRAPER);
// asbestos removal ppe
Registry.register(Registry.ITEM, new Identifier("asbestos", "ppe_helmet"), PPE_HELMET);
Registry.register(Registry.ITEM, new Identifier("asbestos", "ppe_chestplate"), PPE_CHESTPLATE);
Registry.register(Registry.ITEM, new Identifier("asbestos", "ppe_leggings"), PPE_LEGGINGS);
Registry.register(Registry.ITEM, new Identifier("asbestos", "ppe_boots"), PPE_BOOTS);
}
}