added armor
This commit is contained in:
@@ -35,5 +35,6 @@ public class DataGenerators {
|
||||
generator.addProvider(event.includeClient(), new ModBlockStateProvider(packOutput, existingFileHelper));
|
||||
generator.addProvider(event.includeClient(), new ModItemModelProvider(packOutput, existingFileHelper));
|
||||
generator.addProvider(event.includeServer(), new ModDatapackProvider(packOutput, lookupProvider));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,5 @@ public class ModItemModelProvider extends ItemModelProvider {
|
||||
handheldItem(ModItems.STALINIUM_AXE.get());
|
||||
handheldItem(ModItems.STALINIUM_SHOVEL.get());
|
||||
handheldItem(ModItems.STALINIUM_HOE.get());
|
||||
handheldItem(ModItems.STALINIUM_PICKAXE.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,5 +34,10 @@ public class ModItemTagProvider extends ItemTagsProvider {
|
||||
.add(ModItems.STALINIUM_SHOVEL.get());
|
||||
this.tag(ItemTags.HOES)
|
||||
.add(ModItems.STALINIUM_HOE.get());
|
||||
this.tag(ItemTags.TRIMMABLE_ARMOR)
|
||||
.add(ModItems.STALINIUM_HELMET.get())
|
||||
.add(ModItems.STALINIUM_CHESTPLATE.get())
|
||||
.add(ModItems.STALINIUM_LEGGINGS.get())
|
||||
.add(ModItems.STALINIUM_BOOTS.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package net.krituximon.stalinium.item;
|
||||
|
||||
import net.krituximon.stalinium.Stalinium;
|
||||
import net.minecraft.Util;
|
||||
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.Item;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModArmorMaterials {
|
||||
public static final Holder<ArmorMaterial> STALINIUM_ARMOR_MATERIAL = register("stalinium",
|
||||
Util.make(new EnumMap<>(ArmorItem.Type.class), attribute -> {
|
||||
attribute.put(ArmorItem.Type.BOOTS, 5);
|
||||
attribute.put(ArmorItem.Type.LEGGINGS, 7);
|
||||
attribute.put(ArmorItem.Type.CHESTPLATE, 9);
|
||||
attribute.put(ArmorItem.Type.HELMET, 5);
|
||||
attribute.put(ArmorItem.Type.BODY, 11);
|
||||
}), 16, 2f, 0.1f, () -> ModItems.STALINIUM_INGOT.get());
|
||||
|
||||
|
||||
private static Holder<ArmorMaterial> register(String name, EnumMap<ArmorItem.Type, Integer> typeProtection,
|
||||
int enchantability, float toughness, float knockbackResistance,
|
||||
Supplier<Item> ingredientItem) {
|
||||
ResourceLocation location = ResourceLocation.fromNamespaceAndPath(Stalinium.MODID, name);
|
||||
Holder<SoundEvent> equipSound = SoundEvents.ARMOR_EQUIP_NETHERITE;
|
||||
Supplier<Ingredient> ingredient = () -> Ingredient.of(ingredientItem.get());
|
||||
List<ArmorMaterial.Layer> layers = List.of(new ArmorMaterial.Layer(location));
|
||||
|
||||
EnumMap<ArmorItem.Type, Integer> typeMap = new EnumMap<>(ArmorItem.Type.class);
|
||||
for (ArmorItem.Type type : ArmorItem.Type.values()) {
|
||||
typeMap.put(type, typeProtection.get(type));
|
||||
}
|
||||
|
||||
return Registry.registerForHolder(BuiltInRegistries.ARMOR_MATERIAL, location,
|
||||
new ArmorMaterial(typeProtection, enchantability, equipSound, ingredient, layers, toughness, knockbackResistance));
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ public class ModCreativeModeTabs {
|
||||
output.accept(ModItems.STALINIUM_AXE.get());
|
||||
output.accept(ModItems.STALINIUM_SHOVEL.get());
|
||||
output.accept(ModItems.STALINIUM_HOE.get());
|
||||
output.accept(ModItems.STALINIUM_PICKAXE.get());
|
||||
}).build());
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import net.krituximon.stalinium.Stalinium;
|
||||
import net.krituximon.stalinium.sound.ModSounds;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredItem;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
@@ -28,6 +27,10 @@ public class ModItems {
|
||||
() -> new StaliniumAxeItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
.attributes(AxeItem.createAttributes(ModTiers.STALINIUM, 5f, -3.0f))));
|
||||
|
||||
public static final DeferredItem<PickaxeItem> STALINIUM_PICKAXE = ITEMS.register("stalinium_pickaxe",
|
||||
() -> new StaliniumPickaxeItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
.attributes(PickaxeItem.createAttributes(ModTiers.STALINIUM, 1.0f, -2.8f))));
|
||||
|
||||
public static final DeferredItem<ShovelItem> STALINIUM_SHOVEL = ITEMS.register("stalinium_shovel",
|
||||
() -> new StaliniumShovelItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
.attributes(ShovelItem.createAttributes(ModTiers.STALINIUM, 1.5f, -3.0f))));
|
||||
@@ -36,9 +39,22 @@ public class ModItems {
|
||||
() -> new StaliniumHoeItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
.attributes(HoeItem.createAttributes(ModTiers.STALINIUM, 1.0f, -3.0f))));
|
||||
|
||||
public static final DeferredItem<PickaxeItem> STALINIUM_PICKAXE = ITEMS.register("stalinium_pickaxe",
|
||||
() -> new StaliniumPickaxeItem(ModTiers.STALINIUM, new Item.Properties()
|
||||
.attributes(PickaxeItem.createAttributes(ModTiers.STALINIUM, 1.0f, -2.8f))));
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_HELMET = ITEMS.register("stalinium_helmet",
|
||||
() -> new ArmorItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorItem.Type.HELMET,
|
||||
new Item.Properties().durability(ArmorItem.Type.HELMET.getDurability(19))));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_CHESTPLATE = ITEMS.register("stalinium_chestplate",
|
||||
() -> new ArmorItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorItem.Type.CHESTPLATE,
|
||||
new Item.Properties().durability(ArmorItem.Type.CHESTPLATE.getDurability(19))));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_LEGGINGS = ITEMS.register("stalinium_leggings",
|
||||
() -> new ArmorItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorItem.Type.LEGGINGS,
|
||||
new Item.Properties().durability(ArmorItem.Type.LEGGINGS.getDurability(19))));
|
||||
|
||||
public static final DeferredItem<ArmorItem> STALINIUM_BOOTS = ITEMS.register("stalinium_boots",
|
||||
() -> new ArmorItem(ModArmorMaterials.STALINIUM_ARMOR_MATERIAL, ArmorItem.Type.BOOTS,
|
||||
new Item.Properties().durability(ArmorItem.Type.BOOTS.getDurability(19))));
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
ITEMS.register(eventBus);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user