more updates
This commit is contained in:
parent
89e372e7f8
commit
2de4c458c0
@ -1,11 +1,14 @@
|
||||
package tech.nevets.vplus;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import tech.nevets.vplus.blocks.VPBlocks;
|
||||
import tech.nevets.vplus.items.VPItems;
|
||||
|
||||
public class VanillaPlus implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
|
||||
VPBlocks.init();
|
||||
VPItems.init();
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,12 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VPBlocks extends Blocks {
|
||||
public class VPBlocks {
|
||||
public static final List<Block> BLOCKS = new ArrayList<>();
|
||||
|
||||
public static final Block SAPPHIRE_ORE;
|
||||
@ -20,22 +21,20 @@ public class VPBlocks extends Blocks {
|
||||
public static final Block RUBY_BLOCK;
|
||||
public static final Block JADE_BLOCK;
|
||||
public static final Block LAVA_SPONGE_BLOCK;
|
||||
public static final Block SATURATED_LAVASPONGE_BLOCK;
|
||||
|
||||
|
||||
public static final Block SATURATED_LAVA_SPONGE_BLOCK;
|
||||
|
||||
public VPBlocks() {
|
||||
}
|
||||
|
||||
static {
|
||||
SAPPHIRE_ORE = register("sapphire_ore", new OreBlock(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.ALL).getBlock();
|
||||
RUBY_ORE = register("ruby_ore", new OreBlock(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.ALL).getBlock();
|
||||
JADE_ORE = register("jade_ore", new OreBlock(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.ALL).getBlock();
|
||||
SAPPHIRE_BLOCK = register("sapphire_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.ALL).getBlock();
|
||||
RUBY_BLOCK = register("ruby_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.ALL).getBlock();
|
||||
JADE_BLOCK = register("jade_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.ALL).getBlock();
|
||||
LAVA_SPONGE_BLOCK = register("lava_sponge_block", new Block(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(1.5F, 1.5F)), VPItemGroups.ALL).getBlock();
|
||||
SATURATED_LAVASPONGE_BLOCK = register("saturated_lava_sponge_block", new Block(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(1.5F, 1.5F)), VPItemGroups.ALL, new Item.Settings().recipeRemainder(Item.fromBlock(LAVA_SPONGE_BLOCK))).getBlock();
|
||||
SAPPHIRE_ORE = register("sapphire_ore", new OreBlock(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
RUBY_ORE = register("ruby_ore", new OreBlock(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
JADE_ORE = register("jade_ore", new OreBlock(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
SAPPHIRE_BLOCK = register("sapphire_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
RUBY_BLOCK = register("ruby_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
JADE_BLOCK = register("jade_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
LAVA_SPONGE_BLOCK = register("lava_sponge_block", new Block(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(1.5F, 1.5F)), VPItemGroups.BLOCKS).getBlock();
|
||||
SATURATED_LAVA_SPONGE_BLOCK = register("saturated_lava_sponge_block", new Block(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(1.5F, 1.5F)), VPItemGroups.BLOCKS, new Item.Settings().recipeRemainder(Item.fromBlock(LAVA_SPONGE_BLOCK))).getBlock();
|
||||
|
||||
///////////////////\\\\ITERATOR////\\\\\\\\\\\\\\\\\\\
|
||||
|
||||
@ -61,4 +60,6 @@ public class VPBlocks extends Blocks {
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", id), block);
|
||||
return Registry.register(Registry.ITEM, new Identifier("vplus", id), new BlockItem(block, itemSettings.group(group)));
|
||||
}
|
||||
|
||||
public static void init() {}
|
||||
}
|
||||
|
75
src/main/java/tech/nevets/vplus/client/VPZoom.java
Normal file
75
src/main/java/tech/nevets/vplus/client/VPZoom.java
Normal file
@ -0,0 +1,75 @@
|
||||
package tech.nevets.vplus.client;
|
||||
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class VPZoom {
|
||||
public static Boolean currentlyZoomed;
|
||||
public static KeyBinding keyBinding;
|
||||
public static Boolean originalSmoothCameraEnabled;
|
||||
public static final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
public static final double zoomLevel = 0.23;
|
||||
|
||||
public static void zoomInit() {
|
||||
keyBinding = new KeyBinding("key.vplus.zoom", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_C, "category.vplus.zoom");
|
||||
currentlyZoomed = false;
|
||||
originalSmoothCameraEnabled = false;
|
||||
KeyBindingHelper.registerKeyBinding(keyBinding);
|
||||
}
|
||||
|
||||
public static boolean isZooming() {
|
||||
return keyBinding.isPressed();
|
||||
}
|
||||
|
||||
public static void manageSmoothCamera() {
|
||||
if (zoomStarting()) {
|
||||
zoomStarted();
|
||||
enableSmoothCamera();
|
||||
}
|
||||
|
||||
if (zoomStopping()) {
|
||||
zoomStopped();
|
||||
resetSmoothCamera();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isSmoothCamera() {
|
||||
return mc.options.smoothCameraEnabled;
|
||||
}
|
||||
|
||||
private static void enableSmoothCamera() {
|
||||
mc.options.smoothCameraEnabled = true;
|
||||
}
|
||||
|
||||
private static void disableSmoothCamera() {
|
||||
mc.options.smoothCameraEnabled = false;
|
||||
}
|
||||
|
||||
private static boolean zoomStarting() {
|
||||
return isZooming() && !currentlyZoomed;
|
||||
}
|
||||
|
||||
private static boolean zoomStopping() {
|
||||
return !isZooming() && currentlyZoomed;
|
||||
}
|
||||
|
||||
private static void zoomStarted() {
|
||||
originalSmoothCameraEnabled = isSmoothCamera();
|
||||
currentlyZoomed = true;
|
||||
}
|
||||
|
||||
private static void zoomStopped() {
|
||||
currentlyZoomed = false;
|
||||
}
|
||||
|
||||
private static void resetSmoothCamera() {
|
||||
if (originalSmoothCameraEnabled) {
|
||||
enableSmoothCamera();
|
||||
} else {
|
||||
disableSmoothCamera();
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,6 @@ public class VanillaPlusClient implements ClientModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
|
||||
VPZoom.zoomInit();
|
||||
}
|
||||
}
|
||||
|
24
src/main/java/tech/nevets/vplus/client/mixin/ZoomMixin.java
Normal file
24
src/main/java/tech/nevets/vplus/client/mixin/ZoomMixin.java
Normal file
@ -0,0 +1,24 @@
|
||||
package tech.nevets.vplus.client.mixin;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import tech.nevets.vplus.client.VPZoom;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mixin(GameRenderer.class)
|
||||
public class ZoomMixin {
|
||||
@Inject(method = "getFov(Lnet/minecraft/client/render/Camera;FZ)D", at = @At("RETURN"), cancellable = true)
|
||||
public void getZoomLevel(CallbackInfoReturnable<Double> callbackInfo) {
|
||||
if (VPZoom.isZooming()) {
|
||||
double fov = callbackInfo.getReturnValue();
|
||||
callbackInfo.setReturnValue(fov * VPZoom.zoomLevel);
|
||||
}
|
||||
|
||||
VPZoom.manageSmoothCamera();
|
||||
}
|
||||
}
|
39
src/main/java/tech/nevets/vplus/items/VPArmor.java
Normal file
39
src/main/java/tech/nevets/vplus/items/VPArmor.java
Normal 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() {}
|
||||
}
|
75
src/main/java/tech/nevets/vplus/items/VPFood.java
Normal file
75
src/main/java/tech/nevets/vplus/items/VPFood.java
Normal 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() {}
|
||||
}
|
@ -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() {}
|
||||
}
|
||||
|
33
src/main/java/tech/nevets/vplus/items/VPItems.java
Normal file
33
src/main/java/tech/nevets/vplus/items/VPItems.java
Normal 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();
|
||||
}
|
||||
}
|
137
src/main/java/tech/nevets/vplus/items/VPMaterials.java
Normal file
137
src/main/java/tech/nevets/vplus/items/VPMaterials.java
Normal 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;
|
||||
}
|
||||
}
|
16
src/main/java/tech/nevets/vplus/items/VPTools.java
Normal file
16
src/main/java/tech/nevets/vplus/items/VPTools.java
Normal 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()));
|
||||
|
||||
}
|
||||
}
|
4
src/main/java/tech/nevets/vplus/items/tools/AxeBase.java
Normal file
4
src/main/java/tech/nevets/vplus/items/tools/AxeBase.java
Normal file
@ -0,0 +1,4 @@
|
||||
package tech.nevets.vplus.items.tools;
|
||||
|
||||
public class AxeBase {
|
||||
}
|
4
src/main/java/tech/nevets/vplus/items/tools/HoeBase.java
Normal file
4
src/main/java/tech/nevets/vplus/items/tools/HoeBase.java
Normal file
@ -0,0 +1,4 @@
|
||||
package tech.nevets.vplus.items.tools;
|
||||
|
||||
public class HoeBase {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package tech.nevets.vplus.items.tools;
|
||||
|
||||
public class PickaxeBase {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package tech.nevets.vplus.items.tools;
|
||||
|
||||
public class ShovelBase {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package tech.nevets.vplus.items.tools;
|
||||
|
||||
public class SwordBase {
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ZoomMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Loading…
Reference in New Issue
Block a user