Section 2: Energy Charged Tools & Armor
In v0.3.0 Aetherium introduced a new system that adds custom tool and armor materials that work similar to vanilla materials.
This will be a guide to help mod developers set this up
1. Custom Tools
Create a class named 'ModToolMaterials' - or similar
package com.example.mod_id;
import net.minecraft.tags.BlockTags;
import org.mythic_goose.aetherium.api.energy_system.materials.ChargedToolMaterial;
import org.mythic_goose.aetherium.api.Aeth;
public class ModToolMaterials {
public static final ChargedToolMaterial EXAMPLE_MATERIAL = new ChargedToolMaterial(BlockTags.INCORRECT_FOR_NETHERITE_TOOL, 12.0F, 7.0F, 15,
10000, 1, 1000, Aeth.ofUnits(40));
}
Charged Tool Materials example on how the method works
EXAMPLE_MATERIAL = new ChargedToolMaterial(incorrectBlocksForDrops, baseSpeed, attackDamageBonus, enchantmentValue, maxCharge, chargePerUse, rechargeSegmentSize, rechargeSegmentCost);
Segments are how much charge is gained per recharge using 'V' (Default Key), SegmentCost is how much each recharge cost in Aetherium.
Heres how you create each tool using the example in Aetherium
package org.mythic_goose.aetherium.init;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.*;
import org.mythic_goose.aetherium.api.energy_system.materials.ChargedToolMaterial;
import org.mythic_goose.aetherium.api.tools.ChargedAxeItem;
import org.mythic_goose.aetherium.api.tools.ChargedHoeItem;
import org.mythic_goose.aetherium.api.tools.ChargedShovelItem;
import org.mythic_goose.aetherium.api.tools.ChargedToolItem;
import org.mythic_goose.aetherium.registry.ItemRegistry;
public class AetheriumItems extends ItemRegistry {
public static Item VOIDMASS_AXE;
public static Item VOIDMASS_PICKAXE;
public static Item VOIDMASS_SHOVEL;
public static Item VOIDMASS_SPEAR;
public static Item VOIDMASS_SWORD;
public static Item VOIDMASS_HOE;
public static void init() {
VOIDMASS_AXE = registerItem("voidmass_axe", properties -> new ChargedAxeItem(
ChargedToolMaterial.VOIDMASS, 6f, 8f,
properties.fireResistant().rarity(Rarity.RARE)));
VOIDMASS_SHOVEL = registerItem("voidmass_shovel", properties -> new ChargedShovelItem(
ChargedToolMaterial.VOIDMASS, 6f, -2.8f,
properties.fireResistant().rarity(Rarity.RARE)));
VOIDMASS_HOE = registerItem("voidmass_hoe", properties -> new ChargedHoeItem(
ChargedToolMaterial.VOIDMASS, 6f, -2.8f,
properties.fireResistant().rarity(Rarity.RARE)));
VOIDMASS_PICKAXE = registerItem("voidmass_pickaxe", properties -> new ChargedToolItem(
ChargedToolMaterial.VOIDMASS,
ChargedToolMaterial.VOIDMASS.applyToolProperties(properties, BlockTags.MINEABLE_WITH_PICKAXE, 2.8f, 6f, 0f)
.fireResistant().rarity(Rarity.RARE)));
VOIDMASS_SWORD = registerItem("voidmass_sword", properties -> new ChargedToolItem(
ChargedToolMaterial.VOIDMASS,
ChargedToolMaterial.VOIDMASS.applySwordProperties(properties, 6f, 12f)
.fireResistant().rarity(Rarity.RARE)));
VOIDMASS_SPEAR = registerItem("voidmass_spear", properties -> new ChargedToolItem(
ChargedToolMaterial.VOIDMASS,
ChargedToolMaterial.VOIDMASS.applySpearProperties(properties,
1.15F, 2.5F, 0.4F, 2.5F, 9.0F, 5.5F, 5.1F, 8.75F, 4.6F)
.fireResistant().rarity(Rarity.RARE)));
}
public static ResourceKey- getRK(Item item) {
return BuiltInRegistries.ITEM.getResourceKey(item).get();
}
}
ItemRegistry is how Aetherium registers its items. using the "registerItem" method
2. Custom Armor
Create a class named 'ModArmorMaterials' - or similar
package com.example.mod_id;
import net.minecraft.tags.BlockTags;
import org.mythic_goose.aetherium.api.energy_system.materials.ChargedArmorMaterial;
import org.mythic_goose.aetherium.api.Aeth;
public class ModArmorMaterials {
public static final ResourceKey extends Registry> REGISTRY_KEY =
ResourceKey.createRegistryKey(Identifier.withDefaultNamespace("equipment_asset"));
public static final ResourceKey EXAMPLE_KEY =
ResourceKey.create(REGISTRY_KEY, Identifier.fromNamespaceAndPath(ExampleMod.MOD_ID, "example"));
public static final ChargedArmorMaterial EXAMPLE_MATERIAL = new ChargedArmorMaterial(
ArmorMaterials.makeDefense(7, 13, 18, 7, 23), // helmet, chestplate, leggings, boots, body
28, SoundEvents.ARMOR_EQUIP_NETHERITE, 5.0F, 0.35F,
EXAMPLE_KEY, // key
10000, 5, // maxCharge, chargePerHit
1000, Aeth.ofUnits(40)); // rechargeSegmentSize, rechargeSegmentCost
}
Here another example of how to create a Charged Armor Material:
package org.mythic_goose.aetherium.init;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.*;
import org.mythic_goose.aetherium.api.energy_system.materials.ChargedArmorMaterial;
import org.mythic_goose.aetherium.api.energy_system.armor.ChargedArmorItem;
import org.mythic_goose.aetherium.registry.ItemRegistry;
public class AetheriumItems extends ItemRegistry {
public static Item VOIDMASS_HELMET;
public static Item VOIDMASS_CHESTPLATE;
public static Item VOIDMASS_LEGGINGS;
public static Item VOIDMASS_BOOTS;
public static void init() {
VOIDMASS_HELMET = registerItem("voidmass_helmet", properties -> new ChargedArmorItem(
ChargedArmorMaterial.VOIDMASS,
ChargedArmorMaterial.VOIDMASS.applyArmorProperties(properties, ArmorType.HELMET)
.rarity(Rarity.RARE).fireResistant().stacksTo(1)));
VOIDMASS_CHESTPLATE = registerItem("voidmass_chestplate", properties -> new ChargedArmorItem(
ChargedArmorMaterial.VOIDMASS,
ChargedArmorMaterial.VOIDMASS.applyArmorProperties(properties, ArmorType.CHESTPLATE)
.rarity(Rarity.RARE).fireResistant().stacksTo(1)));
VOIDMASS_LEGGINGS = registerItem("voidmass_leggings", properties -> new ChargedArmorItem(
ChargedArmorMaterial.VOIDMASS,
ChargedArmorMaterial.VOIDMASS.applyArmorProperties(properties, ArmorType.LEGGINGS)
.rarity(Rarity.RARE).fireResistant().stacksTo(1)));
VOIDMASS_BOOTS = registerItem("voidmass_boots", properties -> new ChargedArmorItem(
ChargedArmorMaterial.VOIDMASS,
ChargedArmorMaterial.VOIDMASS.applyArmorProperties(properties, ArmorType.BOOTS)
.rarity(Rarity.RARE).fireResistant().stacksTo(1)));
}
public static ResourceKey- getRK(Item item) {
return BuiltInRegistries.ITEM.getResourceKey(item).get();
}
}
Make sure to register your ModItems class to make this all work.