Equipment
This commit is contained in:
parent
72b173a9e3
commit
fb7192cda4
40 changed files with 340 additions and 1 deletions
89
src/main/java/ru/betterend/item/EndArmorMaterial.java
Normal file
89
src/main/java/ru/betterend/item/EndArmorMaterial.java
Normal file
|
@ -0,0 +1,89 @@
|
|||
package ru.betterend.item;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.ArmorMaterial;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.Lazy;
|
||||
import ru.betterend.registry.ItemRegistry;
|
||||
|
||||
public enum EndArmorMaterial implements ArmorMaterial {
|
||||
TERMINITE("terminite", 26, new int[] { 3, 6, 7, 3 }, 14, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 1.0F, 0.05F, () -> {
|
||||
return Ingredient.ofItems(ItemRegistry.TERMINITE_INGOT);
|
||||
}),
|
||||
AETERNIUM("aeternium", 40, new int[] { 4, 7, 9, 4 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 3.5F, 0.2F, () -> {
|
||||
return Ingredient.ofItems(ItemRegistry.AETERNIUM_INGOT);
|
||||
});
|
||||
|
||||
private static final int[] BASE_DURABILITY = new int[] { 13, 15, 16, 11 };
|
||||
private final String name;
|
||||
private final int durabilityMultiplier;
|
||||
private final int[] protectionAmounts;
|
||||
private final int enchantability;
|
||||
private final SoundEvent equipSound;
|
||||
private final float toughness;
|
||||
private final float knockbackResistance;
|
||||
private final Lazy<Ingredient> repairIngredient;
|
||||
|
||||
private EndArmorMaterial(String name, int durabilityMultiplier, int[] protectionAmounts, int enchantability,
|
||||
SoundEvent equipSound, float toughness, float knockbackResistance,
|
||||
Supplier<Ingredient> repairIngredient) {
|
||||
|
||||
this.name = name;
|
||||
this.durabilityMultiplier = durabilityMultiplier;
|
||||
this.protectionAmounts = protectionAmounts;
|
||||
this.enchantability = enchantability;
|
||||
this.equipSound = equipSound;
|
||||
this.toughness = toughness;
|
||||
this.knockbackResistance = knockbackResistance;
|
||||
this.repairIngredient = new Lazy<>(repairIngredient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurability(EquipmentSlot slot) {
|
||||
return BASE_DURABILITY[slot.getEntitySlotId()] * this.durabilityMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProtectionAmount(EquipmentSlot slot) {
|
||||
return this.protectionAmounts[slot.getEntitySlotId()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantability() {
|
||||
return this.enchantability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getEquipSound() {
|
||||
return this.equipSound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ingredient getRepairIngredient() {
|
||||
return this.repairIngredient.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Environment(EnvType.CLIENT)
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getToughness() {
|
||||
return this.toughness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getKnockbackResistance() {
|
||||
return this.knockbackResistance;
|
||||
}
|
||||
|
||||
}
|
11
src/main/java/ru/betterend/item/EndAxe.java
Normal file
11
src/main/java/ru/betterend/item/EndAxe.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package ru.betterend.item;
|
||||
|
||||
import net.minecraft.item.AxeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
|
||||
public class EndAxe extends AxeItem {
|
||||
|
||||
public EndAxe(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) {
|
||||
super(material, attackDamage, attackSpeed, settings);
|
||||
}
|
||||
}
|
11
src/main/java/ru/betterend/item/EndHoe.java
Normal file
11
src/main/java/ru/betterend/item/EndHoe.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package ru.betterend.item;
|
||||
|
||||
import net.minecraft.item.HoeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
|
||||
public class EndHoe extends HoeItem {
|
||||
|
||||
public EndHoe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
|
||||
super(material, attackDamage, attackSpeed, settings);
|
||||
}
|
||||
}
|
11
src/main/java/ru/betterend/item/EndPickaxe.java
Normal file
11
src/main/java/ru/betterend/item/EndPickaxe.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package ru.betterend.item;
|
||||
|
||||
import net.minecraft.item.PickaxeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
|
||||
public class EndPickaxe extends PickaxeItem {
|
||||
|
||||
public EndPickaxe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
|
||||
super(material, attackDamage, attackSpeed, settings);
|
||||
}
|
||||
}
|
67
src/main/java/ru/betterend/item/EndToolMaterial.java
Normal file
67
src/main/java/ru/betterend/item/EndToolMaterial.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
package ru.betterend.item;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.util.Lazy;
|
||||
|
||||
import ru.betterend.registry.ItemRegistry;
|
||||
|
||||
public enum EndToolMaterial implements ToolMaterial {
|
||||
TERMINITE(3, 1230, 8.5F, 3.0F, 14, () -> {
|
||||
return Ingredient.ofItems(ItemRegistry.TERMINITE_INGOT);
|
||||
}),
|
||||
AETERNIUM(5, 2196, 10.0F, 4.5F, 18, () -> {
|
||||
return Ingredient.ofItems(ItemRegistry.AETERNIUM_INGOT);
|
||||
});
|
||||
|
||||
private final int durability;
|
||||
private final float miningSpeed;
|
||||
private final float attackDamage;
|
||||
private final int miningLevel;
|
||||
private final int enchantability;
|
||||
private final Lazy<Ingredient> repairIngredient;
|
||||
|
||||
private EndToolMaterial(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability,
|
||||
Supplier<Ingredient> repairIngredient) {
|
||||
|
||||
this.durability = durability;
|
||||
this.miningSpeed = miningSpeed;
|
||||
this.attackDamage = attackDamage;
|
||||
this.miningLevel = miningLevel;
|
||||
this.enchantability = enchantability;
|
||||
this.repairIngredient = new Lazy<>(repairIngredient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurability() {
|
||||
return this.durability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier() {
|
||||
return this.miningSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAttackDamage() {
|
||||
return this.attackDamage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMiningLevel() {
|
||||
return this.miningLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantability() {
|
||||
return this.enchantability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ingredient getRepairIngredient() {
|
||||
return this.repairIngredient.get();
|
||||
}
|
||||
|
||||
}
|
|
@ -4,20 +4,48 @@ import java.util.List;
|
|||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ShovelItem;
|
||||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.item.EndArmorMaterial;
|
||||
import ru.betterend.item.EndAxe;
|
||||
import ru.betterend.item.EndHoe;
|
||||
import ru.betterend.item.EndPickaxe;
|
||||
import ru.betterend.item.EndToolMaterial;
|
||||
|
||||
public class ItemRegistry {
|
||||
private static final List<Item> MOD_BLOCKS = Lists.newArrayList();
|
||||
private static final List<Item> MOD_ITEMS = Lists.newArrayList();
|
||||
|
||||
//Materials
|
||||
public final static Item ENDER_DUST = registerItem("ender_dust", new Item((new Item.Settings()).group(ItemGroup.MATERIALS)));
|
||||
public final static Item TERMINITE_INGOT = registerItem("terminite_ingot", new Item((new Item.Settings()).group(ItemGroup.MATERIALS)));
|
||||
public final static Item AETERNIUM_INGOT = registerItem("aeternium_ingot", new Item((new Item.Settings()).group(ItemGroup.MATERIALS)));
|
||||
|
||||
//Armor
|
||||
public static final Item TERMINITE_HELMET = registerItem("terminite_helmet", new ArmorItem(EndArmorMaterial.TERMINITE, EquipmentSlot.HEAD,new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
public static final Item TERMINITE_CHESTPLATE = registerItem("terminite_chestplate", new ArmorItem(EndArmorMaterial.TERMINITE, EquipmentSlot.CHEST, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
public static final Item TERMINITE_LEGGINGS = registerItem("terminite_leggings", new ArmorItem(EndArmorMaterial.TERMINITE, EquipmentSlot.LEGS, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
public static final Item TERMINITE_BOOTS = registerItem("terminite_boots", new ArmorItem(EndArmorMaterial.TERMINITE, EquipmentSlot.FEET, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
public static final Item AETERNIUM_HELMET = registerItem("aeternium_helmet", new ArmorItem(EndArmorMaterial.AETERNIUM, EquipmentSlot.HEAD,new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
public static final Item AETERNIUM_CHESTPLATE = registerItem("aeternium_chestplate", new ArmorItem(EndArmorMaterial.AETERNIUM, EquipmentSlot.CHEST, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
public static final Item AETERNIUM_LEGGINGS = registerItem("aeternium_leggings", new ArmorItem(EndArmorMaterial.AETERNIUM, EquipmentSlot.LEGS, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
public static final Item AETERNIUM_BOOTS = registerItem("aeternium_boots", new ArmorItem(EndArmorMaterial.AETERNIUM, EquipmentSlot.FEET, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
|
||||
//Tools
|
||||
public static ToolItem TERMINITE_SHOVEL = registerTool("terminite_shovel", new ShovelItem(EndToolMaterial.TERMINITE, 1.5F, -3.0F, new Item.Settings().group(ItemGroup.TOOLS)));
|
||||
public static ToolItem TERMINITE_SWORD = registerTool("terminite_sword", new SwordItem(EndToolMaterial.TERMINITE, 3, -2.4F, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
public static ToolItem TERMINITE_PICKAXE = registerTool("terminite_pickaxe", new EndPickaxe(EndToolMaterial.TERMINITE, 1, -2.8F, new Item.Settings().group(ItemGroup.TOOLS)));
|
||||
public static ToolItem TERMINITE_AXE = registerTool("terminite_axe", new EndAxe(EndToolMaterial.TERMINITE, 5.0F, -3.0F, new Item.Settings().group(ItemGroup.TOOLS)));
|
||||
public static ToolItem TERMINITE_HOE = registerTool("terminite_hoe", new EndHoe(EndToolMaterial.TERMINITE, -3, 0.0F, new Item.Settings().group(ItemGroup.TOOLS)));
|
||||
|
||||
protected static Item registerItem(String name, Item item) {
|
||||
if (item != Items.AIR) {
|
||||
|
@ -29,6 +57,14 @@ public class ItemRegistry {
|
|||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
protected static ToolItem registerTool(String name, ToolItem item) {
|
||||
if (item != Items.AIR) {
|
||||
Registry.register(Registry.ITEM, BetterEnd.getResId(name), item);
|
||||
MOD_ITEMS.add(item);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public static void register() {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue