Add serpentinite

This commit is contained in:
Agatha Lovelace 2020-12-22 18:41:24 +02:00
parent 4bd378f42b
commit 677f928296
No known key found for this signature in database
GPG Key ID: 2DB18BA2E0A80BC3
8 changed files with 81 additions and 2 deletions

View File

@ -11,8 +11,11 @@ import dev.onyxstudios.cca.api.v3.entity.EntityComponentFactoryRegistry;
import dev.onyxstudios.cca.api.v3.entity.EntityComponentInitializer; import dev.onyxstudios.cca.api.v3.entity.EntityComponentInitializer;
import nerdhub.cardinal.components.api.util.RespawnCopyStrategy; import nerdhub.cardinal.components.api.util.RespawnCopyStrategy;
import net.fabricmc.api.ModInitializer; 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.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; 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.Block;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
@ -26,8 +29,17 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ToolItem; import net.minecraft.item.ToolItem;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry; 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 { public class Asbestos implements ModInitializer, EntityComponentInitializer {
// mesothelioma player component key // mesothelioma player component key
@ -43,6 +55,9 @@ public class Asbestos implements ModInitializer, EntityComponentInitializer {
public static final Block ASBESTOS_BLOCK = new Block( public static final Block ASBESTOS_BLOCK = new Block(
FabricBlockSettings.of(Material.WOOL).hardness(1.0f).sounds(BlockSoundGroup.WOOL)); 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, public static ToolItem IRON_SCRAPER = new ScraperItem(ScraperToolMaterial.INSTANCE, 0.0f, -3.0f,
new Item.Settings().group(ItemGroup.TOOLS)); new Item.Settings().group(ItemGroup.TOOLS));
@ -50,6 +65,11 @@ public class Asbestos implements ModInitializer, EntityComponentInitializer {
public static final DamageSource MESOTHELIOMA_DAMAGE = new MesotheliomaDamageSource(); 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 @Override
public void onInitialize() { public void onInitialize() {
// asbestos fibers item // asbestos fibers item
@ -60,6 +80,20 @@ public class Asbestos implements ModInitializer, EntityComponentInitializer {
Registry.register(Registry.ITEM, new Identifier("asbestos", "asbestos_block"), Registry.register(Registry.ITEM, new Identifier("asbestos", "asbestos_block"),
new BlockItem(ASBESTOS_BLOCK, new Item.Settings().group(ItemGroup.BUILDING_BLOCKS).fireproof())); 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<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 // scraper tool
Registry.register(Registry.ITEM, new Identifier("asbestos", "iron_scraper"), IRON_SCRAPER); Registry.register(Registry.ITEM, new Identifier("asbestos", "iron_scraper"), IRON_SCRAPER);

View File

@ -9,7 +9,6 @@ import net.minecraft.item.ToolMaterial;
public class ScraperItem extends MiningToolItem { public class ScraperItem extends MiningToolItem {
public ScraperItem(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) { public ScraperItem(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
super(attackDamage, attackSpeed, material, Set.of(Asbestos.ASBESTOS_BLOCK /* TODO add other blocks here */), super(attackDamage, attackSpeed, material, Set.of(Asbestos.ASBESTOS_BLOCK), settings);
settings);
} }
} }

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "asbestos:block/serpentinite_block"
}
}
}

View File

@ -1,5 +1,6 @@
{ {
"block.asbestos.asbestos_block": "Asbestos Block", "block.asbestos.asbestos_block": "Asbestos Block",
"block.asbestos.serpentinite_block": "Serpentinite",
"item.asbestos.asbestos_fibers": "Asbests Fibers", "item.asbestos.asbestos_fibers": "Asbests Fibers",
"item.asbestos.iron_scraper": "Asbestos Scraper", "item.asbestos.iron_scraper": "Asbestos Scraper",
"effect.asbestos.mesothelioma": "Mesothelioma", "effect.asbestos.mesothelioma": "Mesothelioma",

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "asbestos:block/serpentinite_block"
}
}

View File

@ -0,0 +1,3 @@
{
"parent": "asbestos:block/serpentinite_block"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

View File

@ -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"
}
]
}
]
}