Re-added copper armour
This commit is contained in:
parent
4cbee5b2dd
commit
b916845ae2
|
|
@ -8,8 +8,6 @@ public class MCRebalance implements ModInitializer {
|
||||||
public static final String MOD_ID = "mc_rebalance";
|
public static final String MOD_ID = "mc_rebalance";
|
||||||
|
|
||||||
// This logger is used to write text to the console and the log file.
|
// 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);
|
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -19,6 +17,7 @@ public class MCRebalance implements ModInitializer {
|
||||||
|
|
||||||
ModItems.init(); // Initialise: load all static values
|
ModItems.init(); // Initialise: load all static values
|
||||||
ModBlocks.init();
|
ModBlocks.init();
|
||||||
|
ModArmourMats.init();
|
||||||
LOGGER.info("Hello Fabric world!");
|
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,27 +6,33 @@ import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.ArmorItem;
|
||||||
import net.minecraft.world.item.CreativeModeTabs;
|
import net.minecraft.world.item.CreativeModeTabs;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
|
||||||
public class ModItems {
|
public class ModItems {
|
||||||
public static void init(){
|
public static void init(){
|
||||||
// Add paxels to creative tabs
|
// Add items to creative tabs
|
||||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Wood));
|
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Wood));
|
||||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Copper));
|
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Copper));
|
||||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Iron));
|
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Iron));
|
||||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Gold));
|
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Gold));
|
||||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Diamond));
|
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Diamond));
|
||||||
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(ModItems.Paxel_Dendrite));
|
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register((itemGroup) -> itemGroup.accept(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));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Item register(String id, Item.Properties item) {
|
public static Item register(String id, Item.Properties item) {
|
||||||
ResourceKey<Item> itemID = ResourceKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MCRebalance.MOD_ID, id));
|
ResourceKey<Item> itemID = ResourceKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MCRebalance.MOD_ID, id));
|
||||||
return Registry.register(BuiltInRegistries.ITEM, itemID, new Item(item));
|
return Registry.register(BuiltInRegistries.ITEM, itemID, new Item(item));
|
||||||
}
|
}
|
||||||
|
public static Item register(String id, Item item) { // I want either to work. There's probably a better way to do this.
|
||||||
//public static final Item Plush_Emerald = register("emerald_plush", new Item.Properties() );
|
ResourceKey<Item> itemID = ResourceKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MCRebalance.MOD_ID, id));
|
||||||
//public static final Item Plush_Acoustic = register("acoustic_plush", new Item.Properties() );
|
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
|
// 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() );
|
public static final Item Paxel_Wood = register("wooden_paxel", new Item.Properties() );
|
||||||
|
|
@ -35,4 +41,9 @@ public class ModItems {
|
||||||
public static final Item Paxel_Gold = register("golden_paxel", new Item.Properties() );
|
public static final Item Paxel_Gold = register("golden_paxel", new Item.Properties() );
|
||||||
public static final Item Paxel_Diamond = register("diamond_paxel", new Item.Properties() );
|
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 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))) );
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue