Compare commits
2 commits
e8f22b8313
...
2cb680f59c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cb680f59c | ||
|
|
b916845ae2 |
|
|
@ -8,8 +8,6 @@ public class MCRebalance implements ModInitializer {
|
|||
public static final String MOD_ID = "mc_rebalance";
|
||||
|
||||
// This logger is used to write text to the console and the log file.
|
||||
// It is considered best practice to use your mod id as the logger's name.
|
||||
// That way, it's clear which mod wrote info, warnings, and errors.
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
|
||||
@Override
|
||||
|
|
@ -19,6 +17,7 @@ public class MCRebalance implements ModInitializer {
|
|||
|
||||
ModItems.init(); // Initialise: load all static values
|
||||
ModBlocks.init();
|
||||
ModArmourMats.init();
|
||||
LOGGER.info("Hello Fabric world!");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package xyz.nearmisses.patience.mc_rebalance;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ArmorMaterial;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModArmourMats {
|
||||
public static void init(){}
|
||||
|
||||
// Speeds up the process of making new armour.
|
||||
public static Holder<ArmorMaterial> registerMaterial(
|
||||
String id,
|
||||
Map<ArmorItem.Type, Integer> defensePoints,
|
||||
int enchantability,
|
||||
Holder<SoundEvent> equipSound,
|
||||
Supplier<Ingredient> repairIngredientSupplier,
|
||||
float toughness,
|
||||
float knockbackResistance,
|
||||
boolean dyeable
|
||||
) {
|
||||
// Get the supported layers for the armor material
|
||||
List<ArmorMaterial.Layer> layers = List.of(
|
||||
new ArmorMaterial.Layer(ResourceLocation.fromNamespaceAndPath(MCRebalance.MOD_ID, id), "", dyeable) // ID, suffix(?), dyeable
|
||||
);
|
||||
|
||||
ArmorMaterial material = new ArmorMaterial(defensePoints, enchantability, equipSound, repairIngredientSupplier, layers, toughness, knockbackResistance);
|
||||
|
||||
// Check why/if this is necessary later.
|
||||
material = Registry.register(BuiltInRegistries.ARMOR_MATERIAL, ResourceLocation.fromNamespaceAndPath(MCRebalance.MOD_ID, id), material);
|
||||
return Holder.direct(material);
|
||||
}
|
||||
|
||||
public static final Holder<ArmorMaterial> Copper = registerMaterial("copper",
|
||||
Map.of( // Armour values
|
||||
ArmorItem.Type.HELMET, 2,
|
||||
ArmorItem.Type.CHESTPLATE, 4,
|
||||
ArmorItem.Type.LEGGINGS, 3,
|
||||
ArmorItem.Type.BOOTS, 1
|
||||
),
|
||||
9, // Enchantability
|
||||
SoundEvents.ARMOR_EQUIP_IRON,
|
||||
() -> Ingredient.of(Items.COPPER_INGOT),
|
||||
0.0F, // Toughness
|
||||
0.0F, // Knockback resistance
|
||||
false
|
||||
);
|
||||
|
||||
// Armor items defined in ModItems.
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import net.minecraft.core.registries.BuiltInRegistries;
|
|||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
|
@ -19,7 +20,10 @@ public class ModItems {
|
|||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.addAfter(Items.GOLDEN_HOE, ModItems.Paxel_Gold));
|
||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.addAfter(Items.DIAMOND_HOE, ModItems.Paxel_Diamond));
|
||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.addAfter(Items.NETHERITE_HOE, ModItems.Paxel_Dendrite));
|
||||
|
||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.COMBAT).register((itemGroup) -> itemGroup.accept(ModItems.Armour_Copper_Helm));
|
||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.COMBAT).register((itemGroup) -> itemGroup.accept(ModItems.Armour_Copper_Chest));
|
||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.COMBAT).register((itemGroup) -> itemGroup.accept(ModItems.Armour_Copper_Legs));
|
||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.COMBAT).register((itemGroup) -> itemGroup.accept(ModItems.Armour_Copper_Boots));
|
||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.INGREDIENTS).register((itemGroup) -> itemGroup.addAfter(Items.COPPER_INGOT, ModItems.Copper_Nugget));
|
||||
}
|
||||
|
||||
|
|
@ -27,9 +31,10 @@ public class ModItems {
|
|||
ResourceKey<Item> itemID = ResourceKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MCRebalance.MOD_ID, id));
|
||||
return Registry.register(BuiltInRegistries.ITEM, itemID, new Item(item));
|
||||
}
|
||||
|
||||
//public static final Item Plush_Emerald = register("emerald_plush", new Item.Properties() );
|
||||
//public static final Item Plush_Acoustic = register("acoustic_plush", new Item.Properties() );
|
||||
public static Item register(String id, Item item) { // I want either to work. There's probably a better way to do this.
|
||||
ResourceKey<Item> itemID = ResourceKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MCRebalance.MOD_ID, id));
|
||||
return Registry.register(BuiltInRegistries.ITEM, itemID, item);
|
||||
}
|
||||
|
||||
// Paxel stats are supplied solely with data, this is just to give them an ID so they're nice and easy to meddle with
|
||||
public static final Item Paxel_Wood = register("wooden_paxel", new Item.Properties() );
|
||||
|
|
@ -39,5 +44,9 @@ public class ModItems {
|
|||
public static final Item Paxel_Diamond = register("diamond_paxel", new Item.Properties() );
|
||||
public static final Item Paxel_Dendrite = register("netherite_paxel", new Item.Properties() ); // As with copper
|
||||
|
||||
public static final Item Armour_Copper_Helm = register("copper_helmet", new ArmorItem(ModArmourMats.Copper, ArmorItem.Type.HELMET, new Item.Properties().durability(ArmorItem.Type.HELMET.getDurability(10))) );
|
||||
public static final Item Armour_Copper_Chest = register("copper_chestplate", new ArmorItem(ModArmourMats.Copper, ArmorItem.Type.CHESTPLATE, new Item.Properties().durability(ArmorItem.Type.CHESTPLATE.getDurability(10))) );
|
||||
public static final Item Armour_Copper_Legs = register("copper_leggings", new ArmorItem(ModArmourMats.Copper, ArmorItem.Type.LEGGINGS, new Item.Properties().durability(ArmorItem.Type.LEGGINGS.getDurability(10))) );
|
||||
public static final Item Armour_Copper_Boots = register("copper_boots", new ArmorItem(ModArmourMats.Copper, ArmorItem.Type.BOOTS, new Item.Properties().durability(ArmorItem.Type.BOOTS.getDurability(10))) );
|
||||
public static final Item Copper_Nugget = register("copper_nugget", new Item.Properties());
|
||||
}
|
||||
Loading…
Reference in a new issue