diff --git a/src/main/java/dev/agatharose/asbestos/Asbestos.java b/src/main/java/dev/agatharose/asbestos/Asbestos.java index 9281cc5..7a17ee5 100644 --- a/src/main/java/dev/agatharose/asbestos/Asbestos.java +++ b/src/main/java/dev/agatharose/asbestos/Asbestos.java @@ -11,8 +11,11 @@ import dev.onyxstudios.cca.api.v3.entity.EntityComponentFactoryRegistry; import dev.onyxstudios.cca.api.v3.entity.EntityComponentInitializer; import nerdhub.cardinal.components.api.util.RespawnCopyStrategy; import net.fabricmc.api.ModInitializer; +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.Block; import net.minecraft.block.Material; import net.minecraft.entity.damage.DamageSource; @@ -26,8 +29,17 @@ 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.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; +import net.minecraft.world.gen.GenerationStep; +@SuppressWarnings("deprecation") public class Asbestos implements ModInitializer, EntityComponentInitializer { // mesothelioma player component key @@ -43,6 +55,9 @@ public class Asbestos implements ModInitializer, EntityComponentInitializer { public static final Block ASBESTOS_BLOCK = new Block( FabricBlockSettings.of(Material.WOOL).hardness(1.0f).sounds(BlockSoundGroup.WOOL)); + public static final Block SERPENTINITE_BLOCK = new Block( + FabricBlockSettings.of(Material.STONE).hardness(2.0f).breakByTool(FabricToolTags.PICKAXES).requiresTool()); + public static ToolItem IRON_SCRAPER = new ScraperItem(ScraperToolMaterial.INSTANCE, 0.0f, -3.0f, new Item.Settings().group(ItemGroup.TOOLS)); @@ -50,6 +65,11 @@ public class Asbestos implements ModInitializer, EntityComponentInitializer { public static final DamageSource MESOTHELIOMA_DAMAGE = new MesotheliomaDamageSource(); + 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); + @Override public void onInitialize() { // asbestos fibers item @@ -60,6 +80,20 @@ public class Asbestos implements ModInitializer, EntityComponentInitializer { 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))); + + // serpentinite worldgen + RegistryKey> 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); diff --git a/src/main/java/dev/agatharose/asbestos/item/ScraperItem.java b/src/main/java/dev/agatharose/asbestos/item/ScraperItem.java index bb1b6c1..86fd317 100644 --- a/src/main/java/dev/agatharose/asbestos/item/ScraperItem.java +++ b/src/main/java/dev/agatharose/asbestos/item/ScraperItem.java @@ -9,7 +9,6 @@ import net.minecraft.item.ToolMaterial; public class ScraperItem extends MiningToolItem { public ScraperItem(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) { - super(attackDamage, attackSpeed, material, Set.of(Asbestos.ASBESTOS_BLOCK /* TODO add other blocks here */), - settings); + super(attackDamage, attackSpeed, material, Set.of(Asbestos.ASBESTOS_BLOCK), settings); } } \ No newline at end of file diff --git a/src/main/resources/assets/asbestos/blockstates/serpentinite_block.json b/src/main/resources/assets/asbestos/blockstates/serpentinite_block.json new file mode 100644 index 0000000..2a6deb7 --- /dev/null +++ b/src/main/resources/assets/asbestos/blockstates/serpentinite_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "asbestos:block/serpentinite_block" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/asbestos/lang/en_us.json b/src/main/resources/assets/asbestos/lang/en_us.json index f3e58c8..a922599 100644 --- a/src/main/resources/assets/asbestos/lang/en_us.json +++ b/src/main/resources/assets/asbestos/lang/en_us.json @@ -1,5 +1,6 @@ { "block.asbestos.asbestos_block": "Asbestos Block", + "block.asbestos.serpentinite_block": "Serpentinite", "item.asbestos.asbestos_fibers": "Asbests Fibers", "item.asbestos.iron_scraper": "Asbestos Scraper", "effect.asbestos.mesothelioma": "Mesothelioma", diff --git a/src/main/resources/assets/asbestos/models/block/serpentinite_block.json b/src/main/resources/assets/asbestos/models/block/serpentinite_block.json new file mode 100644 index 0000000..c2560a0 --- /dev/null +++ b/src/main/resources/assets/asbestos/models/block/serpentinite_block.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "asbestos:block/serpentinite_block" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/asbestos/models/item/serpentinite_block.json b/src/main/resources/assets/asbestos/models/item/serpentinite_block.json new file mode 100644 index 0000000..7883f0c --- /dev/null +++ b/src/main/resources/assets/asbestos/models/item/serpentinite_block.json @@ -0,0 +1,3 @@ +{ + "parent": "asbestos:block/serpentinite_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/asbestos/textures/block/serpentinite_block.png b/src/main/resources/assets/asbestos/textures/block/serpentinite_block.png new file mode 100644 index 0000000..b341c62 Binary files /dev/null and b/src/main/resources/assets/asbestos/textures/block/serpentinite_block.png differ diff --git a/src/main/resources/data/asbestos/loot_tables/blocks/serpentinite_block.json b/src/main/resources/data/asbestos/loot_tables/blocks/serpentinite_block.json new file mode 100644 index 0000000..2176bbc --- /dev/null +++ b/src/main/resources/data/asbestos/loot_tables/blocks/serpentinite_block.json @@ -0,0 +1,29 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "asbestos:asbestos_fibers", + "weight": 1, + "functions": [ + { + "function": "set_count", + "count": { + "min": 2, + "max": 6 + } + } + ] + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file