Browse Source

Add serpentinite

mistress
Agatha 4 months ago
parent
commit
677f928296
Signed by: sorceress <agatharose@wantscuddl.es> GPG Key ID: 2DB18BA2E0A80BC3
8 changed files with 81 additions and 2 deletions
  1. +34
    -0
      src/main/java/dev/agatharose/asbestos/Asbestos.java
  2. +1
    -2
      src/main/java/dev/agatharose/asbestos/item/ScraperItem.java
  3. +7
    -0
      src/main/resources/assets/asbestos/blockstates/serpentinite_block.json
  4. +1
    -0
      src/main/resources/assets/asbestos/lang/en_us.json
  5. +6
    -0
      src/main/resources/assets/asbestos/models/block/serpentinite_block.json
  6. +3
    -0
      src/main/resources/assets/asbestos/models/item/serpentinite_block.json
  7. BIN
      src/main/resources/assets/asbestos/textures/block/serpentinite_block.png
  8. +29
    -0
      src/main/resources/data/asbestos/loot_tables/blocks/serpentinite_block.json

+ 34
- 0
src/main/java/dev/agatharose/asbestos/Asbestos.java View File

@@ -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<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);



+ 1
- 2
src/main/java/dev/agatharose/asbestos/item/ScraperItem.java View File

@@ -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);
}
}

+ 7
- 0
src/main/resources/assets/asbestos/blockstates/serpentinite_block.json View File

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

+ 1
- 0
src/main/resources/assets/asbestos/lang/en_us.json View File

@@ -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",


+ 6
- 0
src/main/resources/assets/asbestos/models/block/serpentinite_block.json View File

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

+ 3
- 0
src/main/resources/assets/asbestos/models/item/serpentinite_block.json View File

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

BIN
src/main/resources/assets/asbestos/textures/block/serpentinite_block.png View File

Before After
Width: 16  |  Height: 16  |  Size: 404 B

+ 29
- 0
src/main/resources/data/asbestos/loot_tables/blocks/serpentinite_block.json 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"
}
]
}
]
}

Loading…
Cancel
Save