more updates

This commit is contained in:
2022-07-13 15:55:43 -04:00
parent 89e372e7f8
commit 2de4c458c0
17 changed files with 463 additions and 20 deletions

View File

@@ -0,0 +1,39 @@
package tech.nevets.vplus.items;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class VPArmor {
public static final ArmorMaterial COPPER_ARMOR;
public static final ArmorMaterial EMERALD_ARMOR;
public static final ArmorMaterial SAPPHIRE_ARMOR;
public static final ArmorMaterial RUBY_ARMOR;
public static final ArmorMaterial JADE_ARMOR;
public VPArmor() {
}
static {
COPPER_ARMOR = register("copper", VPMaterials.COPPER);
EMERALD_ARMOR = register("emerald", VPMaterials.EMERALD);
SAPPHIRE_ARMOR = register("sapphire", VPMaterials.SAPPHIRE);
RUBY_ARMOR = register("ruby", VPMaterials.RUBY);
JADE_ARMOR = register("jade", VPMaterials.JADE);
}
public static VPMaterials register(String id, VPMaterials material) {
Registry.register(Registry.ITEM, new Identifier("vplus", id + "_helmet"), new ArmorItem(material, EquipmentSlot.HEAD, new Item.Settings().group(VPItemGroups.COMBAT)));
Registry.register(Registry.ITEM, new Identifier("vplus", id + "_chestplate"), new ArmorItem(material, EquipmentSlot.CHEST, new Item.Settings().group(VPItemGroups.COMBAT)));
Registry.register(Registry.ITEM, new Identifier("vplus", id + "_leggings"), new ArmorItem(material, EquipmentSlot.LEGS, new Item.Settings().group(VPItemGroups.COMBAT)));
Registry.register(Registry.ITEM, new Identifier("vplus", id + "_boots"), new ArmorItem(material, EquipmentSlot.FEET, new Item.Settings().group(VPItemGroups.COMBAT)));
return material;
}
public static void init() {}
}

View File

@@ -0,0 +1,75 @@
package tech.nevets.vplus.items;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class VPFood {
public static final Item IRON_APPLE;
public static final Item ENCHANTED_IRON_APPLE;
public static final Item COPPER_APPLE;
public static final Item ENCHANTED_COPPER_APPLE;
public static final Item DIAMOND_APPLE;
public static final Item ENCHANTED_DIAMOND_APPLE;
public static final Item EMERALD_APPLE;
public static final Item ENCHANTED_EMERALD_APPLE;
public static final Item NETHERITE_APPLE;
public static final Item ENCHANTED_NETHERITE_APPLE;
public static final Item SAPPHIRE_APPLE;
public static final Item ENCHANTED_SAPPHIRE_APPLE;
public static final Item RUBY_APPLE;
public static final Item ENCHANTED_RUBY_APPLE;
public static final Item JADE_APPLE;
public static final Item ENCHANTED_JADE_APPLE;
public VPFood() {
}
static {
IRON_APPLE = register("iron_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()));
ENCHANTED_IRON_APPLE = register("enchanted_iron_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()), true);
COPPER_APPLE = register("copper_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()));
ENCHANTED_COPPER_APPLE = register("enchanted_copper_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()), true);
DIAMOND_APPLE = register("diamond_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()));
ENCHANTED_DIAMOND_APPLE = register("enchanted_diamond_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()), true);
EMERALD_APPLE = register("emerald_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()));
ENCHANTED_EMERALD_APPLE = register("enchanted_emerald_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()), true);
NETHERITE_APPLE = register("netherite_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()));
ENCHANTED_NETHERITE_APPLE = register("enchanted_netherite_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()), true);
SAPPHIRE_APPLE = register("sapphire_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()));
ENCHANTED_SAPPHIRE_APPLE = register("enchanted_sapphire_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()), true);
RUBY_APPLE = register("ruby_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()));
ENCHANTED_RUBY_APPLE = register("enchanted_ruby_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()), true);
JADE_APPLE = register("jade_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()));
ENCHANTED_JADE_APPLE = register("enchanted_jade_apple", new Item.Settings().group(VPItemGroups.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(10).alwaysEdible().statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20*120, 2),1f).build()), true);
}
private static Item register(String id, Item.Settings settings) {
Item item = new Item(settings);
Registry.register(Registry.ITEM, new Identifier("vplus", id), item);
return item;
}
private static Item register(String id, Item.Settings settings, boolean hasGlint) {
Item item;
if (hasGlint) {
item = new Item(settings) {
@Override
public boolean hasGlint(ItemStack stack) {
return true;
}
};
} else {
item = new Item(settings);
}
Registry.register(Registry.ITEM, new Identifier("vplus", id), item);
return item;
}
public static void init() {}
}

View File

@@ -1,15 +1,34 @@
package tech.nevets.vplus.items;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import tech.nevets.vplus.blocks.VPBlocks;
public class VPItemGroups extends ItemGroup {
public VPItemGroups(int index, String id) {
super(index, id);
public class VPItemGroups {
public static final ItemGroup BLOCKS;
public static final ItemGroup ITEMS;
public static final ItemGroup COMBAT;
public static final ItemGroup TOOLS;
public static final ItemGroup FOOD;
public VPItemGroups() {
}
@Override
public ItemStack createIcon() {
return null;
static {
BLOCKS = FabricItemGroupBuilder.build(newId("blocksplus"), () -> new ItemStack(VPBlocks.RUBY_BLOCK));
ITEMS = FabricItemGroupBuilder.build(newId("itemsplus"), () -> new ItemStack(VPItems.SAPPHIRE));
COMBAT = FabricItemGroupBuilder.build(newId("combatplus"), () -> new ItemStack(Items.DIAMOND_SWORD)); //TODO Fix this when I add back all items
TOOLS = FabricItemGroupBuilder.build(newId("toolsplus"), () -> new ItemStack(Items.DIAMOND_PICKAXE)); //TODO Fix this when I add back all items
FOOD = FabricItemGroupBuilder.build(newId("foodplus"), () -> new ItemStack(Items.GOLDEN_APPLE)); //TODO Fix this when I add back all items
}
private static Identifier newId(String id) {
return new Identifier("vplus", id);
}
public static void init() {}
}

View File

@@ -0,0 +1,33 @@
package tech.nevets.vplus.items;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class VPItems {
public static final Item RUBY;
public static final Item SAPPHIRE;
public static final Item JADE;
public VPItems() {
}
static {
RUBY = register("ruby", new Item.Settings().group(VPItemGroups.ITEMS));
SAPPHIRE = register("sapphire", new Item.Settings().group(VPItemGroups.ITEMS));
JADE = register("jade", new Item.Settings().group(VPItemGroups.ITEMS));
}
public static Item register(String id, Item.Settings settings) {
Item item = new Item(settings);
Registry.register(Registry.ITEM, new Identifier("vplus", id), item);
return item;
}
public static void init() {
VPItemGroups.init();
VPFood.init();
VPArmor.init();
}
}

View File

@@ -0,0 +1,137 @@
package tech.nevets.vplus.items;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
public enum VPMaterials implements ToolMaterial, ArmorMaterial {
COPPER(20, Ingredient.ofItems(Items.COPPER_INGOT), "copper", 13, new int[]{2, 4, 5, 2}, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, 0.0F, 2, 200, 5.0F, 3.0F),
EMERALD(30, Ingredient.ofItems(Items.EMERALD), "emerald", 30, new int[]{2, 6, 8, 2}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.5F, 0.0F, 3, 750, 7.0F, 4.0F),
SAPPHIRE(50, Ingredient.ofItems(VPItems.SAPPHIRE), "sapphire", 40, new int[]{6, 8, 10, 6}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.1F, 4, 3000, 8.0F, 6.0F),
RUBY(50, Ingredient.ofItems(VPItems.RUBY), "ruby", 40, new int[]{10, 15, 20, 10}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, .01F, 4, 3000, 8.0F, 6.0F),
JADE(50, Ingredient.ofItems(VPItems.JADE), "jade", 40, new int[]{10, 15, 20, 10}, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F, 0.1F, 4, 3000, 8.0F, 6.0F);
private static final int[] BASE_ARMOR_DURABILITY = new int[]{13, 15, 16, 11};
// Used by both
private int enchantability;
private Ingredient repairIngredient;
// Used by armor
private String name;
private int armorDurability;
private int[] protectionAmounts;
private SoundEvent equipSound;
private float toughness;
private float knockbackResistance;
// Used by tools
private int miningLevel;
private float miningSpeed;
private float attackDamage;
private int toolDurability;
// Used for armor materials
VPMaterials(String name, int armorDurability, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) {
this.name = name;
this.armorDurability = armorDurability;
this.protectionAmounts = protectionAmounts;
this.enchantability = enchantability;
this.equipSound = equipSound;
this.toughness = toughness;
this.knockbackResistance = knockbackResistance;
this.repairIngredient = repairIngredient;
}
// Used for tool materials
VPMaterials(int miningLevel, int toolDurability, float miningSpeed, float attackDamage, int enchantability, Ingredient repairIngredient) {
this.miningLevel = miningLevel;
this.toolDurability = toolDurability;
this.miningSpeed = miningSpeed;
this.attackDamage = attackDamage;
this.enchantability = enchantability;
this.repairIngredient = repairIngredient;
}
//Used for both
VPMaterials(int enchantability, Ingredient repairIngredient, String name, int armorDurability, int[] protectionAmounts, SoundEvent equipSound, float toughness, float knockbackResistance, int miningLevel, int toolDurability, float miningSpeed, float attackDamage) {
this.enchantability = enchantability;
this.repairIngredient = repairIngredient;
this.name = name;
this.armorDurability = armorDurability;
this.protectionAmounts = protectionAmounts;
this.equipSound = equipSound;
this.toughness = toughness;
this.knockbackResistance = knockbackResistance;
this.miningLevel = miningLevel;
this.toolDurability = toolDurability;
this.miningSpeed = miningSpeed;
this.attackDamage = attackDamage;
}
@Override
public String getName() {
return this.name;
}
@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient;
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public int getDurability() {
return this.toolDurability;
}
@Override
public int getDurability(EquipmentSlot slot) {
return BASE_ARMOR_DURABILITY[slot.getEntitySlotId()] * this.armorDurability;
}
@Override
public int getProtectionAmount(EquipmentSlot slot) {
return this.protectionAmounts[slot.getEntitySlotId()];
}
@Override
public SoundEvent getEquipSound() {
return this.equipSound;
}
@Override
public float getToughness() {
return this.toughness;
}
@Override
public float getKnockbackResistance() {
return this.knockbackResistance;
}
@Override
public float getMiningSpeedMultiplier() {
return this.miningSpeed;
}
@Override
public float getAttackDamage() {
return this.attackDamage;
}
@Override
public int getMiningLevel() {
return this.miningLevel;
}
}

View File

@@ -0,0 +1,16 @@
package tech.nevets.vplus.items;
import net.minecraft.item.AxeItem;
import net.minecraft.item.Item;
import net.minecraft.item.SwordItem;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class VPTools {
private static void register(String id) {
Registry.register(Registry.ITEM, new Identifier("vplus", id + "_axe"), new AxeItem(VPMaterials.COPPER, new Item.Settings()));
}
}

View File

@@ -0,0 +1,4 @@
package tech.nevets.vplus.items.tools;
public class AxeBase {
}

View File

@@ -0,0 +1,4 @@
package tech.nevets.vplus.items.tools;
public class HoeBase {
}

View File

@@ -0,0 +1,4 @@
package tech.nevets.vplus.items.tools;
public class PickaxeBase {
}

View File

@@ -0,0 +1,4 @@
package tech.nevets.vplus.items.tools;
public class ShovelBase {
}

View File

@@ -0,0 +1,4 @@
package tech.nevets.vplus.items.tools;
public class SwordBase {
}