From 6473bb81d0fac0ae9020f0f6d6ae909a1e537584 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 13 May 2020 15:52:46 +0200 Subject: [PATCH] sky tools, part 1 --- .../naturesaura/models/item/sky_axe.json | 6 ++ .../naturesaura/models/item/sky_chest.json | 6 ++ .../naturesaura/models/item/sky_helmet.json | 6 ++ .../naturesaura/models/item/sky_hoe.json | 6 ++ .../naturesaura/models/item/sky_pants.json | 6 ++ .../naturesaura/models/item/sky_pickaxe.json | 6 ++ .../naturesaura/models/item/sky_shoes.json | 6 ++ .../naturesaura/models/item/sky_shovel.json | 6 ++ .../naturesaura/models/item/sky_sword.json | 6 ++ .../items/ItemShockwaveCreator.java | 3 +- .../ellpeck/naturesaura/items/ModItems.java | 9 ++ .../naturesaura/items/tools/ItemArmor.java | 54 +++++++--- .../naturesaura/items/tools/ItemAxe.java | 2 - .../naturesaura/items/tools/ItemHoe.java | 92 +++++++++++++----- .../naturesaura/items/tools/ItemPickaxe.java | 4 +- .../naturesaura/items/tools/ItemShovel.java | 4 +- .../naturesaura/items/tools/ItemSword.java | 9 +- .../naturesaura/reg/ModArmorMaterial.java | 3 +- .../ellpeck/naturesaura/reg/ModItemTier.java | 3 +- .../ellpeck/naturesaura/reg/ModRegistry.java | 11 ++- .../naturesaura/textures/item/sky_axe.png | Bin 0 -> 521 bytes .../naturesaura/textures/item/sky_chest.png | Bin 0 -> 592 bytes .../naturesaura/textures/item/sky_helmet.png | Bin 0 -> 251 bytes .../naturesaura/textures/item/sky_hoe.png | Bin 0 -> 509 bytes .../naturesaura/textures/item/sky_pants.png | Bin 0 -> 422 bytes .../naturesaura/textures/item/sky_pickaxe.png | Bin 0 -> 553 bytes .../naturesaura/textures/item/sky_shoes.png | Bin 0 -> 414 bytes .../naturesaura/textures/item/sky_shovel.png | Bin 0 -> 448 bytes .../naturesaura/textures/item/sky_sword.png | Bin 0 -> 573 bytes .../textures/models/armor/sky_layer_1.png | Bin 0 -> 1710 bytes .../textures/models/armor/sky_layer_2.png | Bin 0 -> 838 bytes 31 files changed, 193 insertions(+), 55 deletions(-) create mode 100644 src/generated/resources/assets/naturesaura/models/item/sky_axe.json create mode 100644 src/generated/resources/assets/naturesaura/models/item/sky_chest.json create mode 100644 src/generated/resources/assets/naturesaura/models/item/sky_helmet.json create mode 100644 src/generated/resources/assets/naturesaura/models/item/sky_hoe.json create mode 100644 src/generated/resources/assets/naturesaura/models/item/sky_pants.json create mode 100644 src/generated/resources/assets/naturesaura/models/item/sky_pickaxe.json create mode 100644 src/generated/resources/assets/naturesaura/models/item/sky_shoes.json create mode 100644 src/generated/resources/assets/naturesaura/models/item/sky_shovel.json create mode 100644 src/generated/resources/assets/naturesaura/models/item/sky_sword.json create mode 100644 src/main/resources/assets/naturesaura/textures/item/sky_axe.png create mode 100644 src/main/resources/assets/naturesaura/textures/item/sky_chest.png create mode 100644 src/main/resources/assets/naturesaura/textures/item/sky_helmet.png create mode 100644 src/main/resources/assets/naturesaura/textures/item/sky_hoe.png create mode 100644 src/main/resources/assets/naturesaura/textures/item/sky_pants.png create mode 100644 src/main/resources/assets/naturesaura/textures/item/sky_pickaxe.png create mode 100644 src/main/resources/assets/naturesaura/textures/item/sky_shoes.png create mode 100644 src/main/resources/assets/naturesaura/textures/item/sky_shovel.png create mode 100644 src/main/resources/assets/naturesaura/textures/item/sky_sword.png create mode 100644 src/main/resources/assets/naturesaura/textures/models/armor/sky_layer_1.png create mode 100644 src/main/resources/assets/naturesaura/textures/models/armor/sky_layer_2.png diff --git a/src/generated/resources/assets/naturesaura/models/item/sky_axe.json b/src/generated/resources/assets/naturesaura/models/item/sky_axe.json new file mode 100644 index 00000000..81e2895c --- /dev/null +++ b/src/generated/resources/assets/naturesaura/models/item/sky_axe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:item/sky_axe" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/naturesaura/models/item/sky_chest.json b/src/generated/resources/assets/naturesaura/models/item/sky_chest.json new file mode 100644 index 00000000..3d95db6a --- /dev/null +++ b/src/generated/resources/assets/naturesaura/models/item/sky_chest.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "naturesaura:item/sky_chest" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/naturesaura/models/item/sky_helmet.json b/src/generated/resources/assets/naturesaura/models/item/sky_helmet.json new file mode 100644 index 00000000..2d9d7b41 --- /dev/null +++ b/src/generated/resources/assets/naturesaura/models/item/sky_helmet.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "naturesaura:item/sky_helmet" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/naturesaura/models/item/sky_hoe.json b/src/generated/resources/assets/naturesaura/models/item/sky_hoe.json new file mode 100644 index 00000000..e158e7d0 --- /dev/null +++ b/src/generated/resources/assets/naturesaura/models/item/sky_hoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:item/sky_hoe" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/naturesaura/models/item/sky_pants.json b/src/generated/resources/assets/naturesaura/models/item/sky_pants.json new file mode 100644 index 00000000..a6887373 --- /dev/null +++ b/src/generated/resources/assets/naturesaura/models/item/sky_pants.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "naturesaura:item/sky_pants" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/naturesaura/models/item/sky_pickaxe.json b/src/generated/resources/assets/naturesaura/models/item/sky_pickaxe.json new file mode 100644 index 00000000..551fceb5 --- /dev/null +++ b/src/generated/resources/assets/naturesaura/models/item/sky_pickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:item/sky_pickaxe" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/naturesaura/models/item/sky_shoes.json b/src/generated/resources/assets/naturesaura/models/item/sky_shoes.json new file mode 100644 index 00000000..ac5e6d75 --- /dev/null +++ b/src/generated/resources/assets/naturesaura/models/item/sky_shoes.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "naturesaura:item/sky_shoes" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/naturesaura/models/item/sky_shovel.json b/src/generated/resources/assets/naturesaura/models/item/sky_shovel.json new file mode 100644 index 00000000..b27e3f68 --- /dev/null +++ b/src/generated/resources/assets/naturesaura/models/item/sky_shovel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:item/sky_shovel" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/naturesaura/models/item/sky_sword.json b/src/generated/resources/assets/naturesaura/models/item/sky_sword.json new file mode 100644 index 00000000..75bc8f9f --- /dev/null +++ b/src/generated/resources/assets/naturesaura/models/item/sky_sword.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:item/sky_sword" + } +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java b/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java index 2b0d14bb..eec6014c 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java @@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.items.tools.ItemArmor; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; +import de.ellpeck.naturesaura.reg.ModArmorMaterial; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; @@ -74,7 +75,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { source = DamageSource.causePlayerDamage((PlayerEntity) living); else source = DamageSource.MAGIC; - boolean infusedSet = ItemArmor.isFullSetEquipped(living, 0); + boolean infusedSet = ItemArmor.isFullSetEquipped(living, ModArmorMaterial.INFUSED); int range = 5; List mobs = worldIn.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB( diff --git a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java index f4f99c20..9334c0ff 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java @@ -49,4 +49,13 @@ public final class ModItems { public static Item TAINTED_GOLD; public static Item LOOT_FINDER; public static Item LIGHT_STAFF; + public static Item SKY_PICKAXE; + public static Item SKY_AXE; + public static Item SKY_SHOVEL; + public static Item SKY_HOE; + public static Item SKY_SWORD; + public static Item SKY_HELMET; + public static Item SKY_CHEST; + public static Item SKY_PANTS; + public static Item SKY_SHOES; } diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmor.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmor.java index 90ec5af1..cb98c3d2 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmor.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmor.java @@ -2,31 +2,34 @@ package de.ellpeck.naturesaura.items.tools; import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.NaturesAura; -import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.IModItem; +import de.ellpeck.naturesaura.reg.ModArmorMaterial; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; -import net.minecraft.item.ArmorItem; -import net.minecraft.item.IArmorMaterial; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.item.*; import net.minecraft.nbt.CompoundNBT; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Effects; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; +import java.util.*; public class ItemArmor extends ArmorItem implements IModItem { - private static List sets; + private static final AttributeModifier SKY_MOVEMENT_MODIFIER = new AttributeModifier(UUID.fromString("c1f96acc-e117-4dc1-a351-e196a4de6071"), NaturesAura.MOD_ID + ":sky_movement_speed", 0.15F, AttributeModifier.Operation.MULTIPLY_TOTAL); + private static final Map SETS = new HashMap<>(); private final String baseName; public ItemArmor(String baseName, IArmorMaterial materialIn, EquipmentSlotType equipmentSlotIn) { @@ -36,13 +39,11 @@ public class ItemArmor extends ArmorItem implements IModItem { ModRegistry.add(this); } - public static boolean isFullSetEquipped(LivingEntity entity, int setIndex) { - if (sets == null) { - sets = new ArrayList<>(); - sets.add(new Item[]{ModItems.INFUSED_IRON_SHOES, ModItems.INFUSED_IRON_PANTS, ModItems.INFUSED_IRON_CHEST, ModItems.INFUSED_IRON_HELMET}); - } - - Item[] set = sets.get(setIndex); + public static boolean isFullSetEquipped(LivingEntity entity, IArmorMaterial material) { + Item[] set = SETS.computeIfAbsent(material, m -> ForgeRegistries.ITEMS.getValues().stream() + .filter(i -> i instanceof ItemArmor && ((ItemArmor) i).getArmorMaterial() == material) + .sorted(Comparator.comparingInt(i -> ((ItemArmor) i).getEquipmentSlot().ordinal())) + .toArray(Item[]::new)); for (int i = 0; i < 4; i++) { EquipmentSlotType slot = EquipmentSlotType.values()[i + 2]; ItemStack stack = entity.getItemStackFromSlot(slot); @@ -69,12 +70,33 @@ public class ItemArmor extends ArmorItem implements IModItem { public void onAttack(LivingAttackEvent event) { LivingEntity entity = event.getEntityLiving(); if (!entity.world.isRemote) { - if (!isFullSetEquipped(entity, 0)) + if (!isFullSetEquipped(entity, ModArmorMaterial.INFUSED)) return; Entity source = event.getSource().getTrueSource(); if (source instanceof LivingEntity) ((LivingEntity) source).addPotionEffect(new EffectInstance(Effects.WITHER, 40)); } } + + @SubscribeEvent + public void update(TickEvent.PlayerTickEvent event) { + PlayerEntity player = event.player; + IAttributeInstance speed = player.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); + String key = NaturesAura.MOD_ID + ":sky_equipped"; + CompoundNBT nbt = player.getPersistentData(); + boolean equipped = isFullSetEquipped(player, ModArmorMaterial.SKY); + if (equipped && !nbt.getBoolean(key)) { + // we just equipped it + nbt.putBoolean(key, true); + player.stepHeight = 1.1F; + if (!speed.hasModifier(SKY_MOVEMENT_MODIFIER)) + speed.applyModifier(SKY_MOVEMENT_MODIFIER); + } else if (!equipped && nbt.getBoolean(key)) { + // we just unequipped it + nbt.putBoolean(key, false); + player.stepHeight = 0.6F; + speed.removeModifier(SKY_MOVEMENT_MODIFIER); + } + } } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxe.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxe.java index b61dcf4b..c2b2c4c0 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxe.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxe.java @@ -43,9 +43,7 @@ public class ItemAxe extends AxeItem implements IModItem, ICustomItemModel { @Nullable @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { - if (this == ModItems.INFUSED_IRON_AXE) return Helper.makeRechargeProvider(stack, true); - else return null; } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoe.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoe.java index 783a6862..11a9ca3e 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoe.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoe.java @@ -7,12 +7,22 @@ import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.ICustomItemModel; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.ModRegistry; +import net.minecraft.block.BlockState; +import net.minecraft.block.BushBlock; +import net.minecraft.entity.LivingEntity; import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.*; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.capabilities.ICapabilityProvider; import javax.annotation.Nullable; @@ -30,31 +40,69 @@ public class ItemHoe extends HoeItem implements IModItem, ICustomItemModel { @Override public ActionResultType onItemUse(ItemUseContext context) { - World world = context.getWorld(); - ActionResultType result = super.onItemUse(context); - if (!world.isRemote && result == ActionResultType.SUCCESS && this == ModItems.INFUSED_IRON_HOE) { - ItemStack seed = ItemStack.EMPTY; - Random random = world.getRandom(); - BlockPos pos = context.getPos(); - if (random.nextInt(5) == 0) { - seed = new ItemStack(Items.WHEAT_SEEDS); - } else if (random.nextInt(10) == 0) { - int rand = random.nextInt(3); - if (rand == 0) { - seed = new ItemStack(Items.MELON_SEEDS); - } else if (rand == 1) { - seed = new ItemStack(Items.PUMPKIN_SEEDS); - } else if (rand == 2) { - seed = new ItemStack(Items.BEETROOT_SEEDS); + if (this == ModItems.INFUSED_IRON_HOE) { + World world = context.getWorld(); + ActionResultType result = super.onItemUse(context); + if (!world.isRemote && result == ActionResultType.SUCCESS) { + ItemStack seed = ItemStack.EMPTY; + Random random = world.getRandom(); + BlockPos pos = context.getPos(); + if (random.nextInt(5) == 0) { + seed = new ItemStack(Items.WHEAT_SEEDS); + } else if (random.nextInt(10) == 0) { + int rand = random.nextInt(3); + if (rand == 0) { + seed = new ItemStack(Items.MELON_SEEDS); + } else if (rand == 1) { + seed = new ItemStack(Items.PUMPKIN_SEEDS); + } else if (rand == 2) { + seed = new ItemStack(Items.BEETROOT_SEEDS); + } + } + + if (!seed.isEmpty()) { + ItemEntity item = new ItemEntity(world, pos.getX() + random.nextFloat(), pos.getY() + 1F, pos.getZ() + random.nextFloat(), seed); + world.addEntity(item); } } + return result; + } else if (this == ModItems.SKY_HOE) { + boolean success = false; + for (int x = -1; x <= 1; x++) { + for (int z = -1; z <= 1; z++) { + BlockPos offset = context.getPos().add(x, 0, z); + BlockRayTraceResult newResult = new BlockRayTraceResult(context.getHitVec(), context.getFace(), offset, context.isInside()); + ItemUseContext newContext = new ItemUseContext(context.getPlayer(), context.getHand(), newResult); + success |= super.onItemUse(newContext) == ActionResultType.SUCCESS; + } + } + return success ? ActionResultType.SUCCESS : ActionResultType.FAIL; + } + return super.onItemUse(context); + } - if (!seed.isEmpty()) { - ItemEntity item = new ItemEntity(world, pos.getX() + random.nextFloat(), pos.getY() + 1F, pos.getZ() + random.nextFloat(), seed); - world.addEntity(item); + @Override + public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, PlayerEntity player) { + if (stack.getItem() == ModItems.SKY_HOE) { + if (!(player.world.getBlockState(pos).getBlock() instanceof BushBlock)) + return false; + if (!player.world.isRemote) { + int range = 3; + for (int x = -range; x <= range; x++) { + for (int y = -range; y <= range; y++) { + for (int z = -range; z <= range; z++) { + if (x == 0 && y == 0 && z == 0) + continue; + BlockPos offset = pos.add(x, y, z); + BlockState otherState = player.world.getBlockState(offset); + if (otherState.getBlock() instanceof BushBlock) + player.world.destroyBlock(offset, true); + } + } + } } } - return result; + return false; } @Override @@ -65,9 +113,7 @@ public class ItemHoe extends HoeItem implements IModItem, ICustomItemModel { @Nullable @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { - if (this == ModItems.INFUSED_IRON_HOE) - return Helper.makeRechargeProvider(stack, true); - else return null; + return Helper.makeRechargeProvider(stack, true); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxe.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxe.java index 876a7955..1e769c68 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxe.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxe.java @@ -68,9 +68,7 @@ public class ItemPickaxe extends PickaxeItem implements IModItem, ICustomItemMod @Nullable @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { - if (this == ModItems.INFUSED_IRON_PICKAXE) - return Helper.makeRechargeProvider(stack, true); - else return null; + return Helper.makeRechargeProvider(stack, true); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java index 41e3252c..8b809247 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java @@ -86,9 +86,7 @@ public class ItemShovel extends ShovelItem implements IModItem, ICustomItemModel @Nullable @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { - if (this == ModItems.INFUSED_IRON_SHOVEL) - return Helper.makeRechargeProvider(stack, true); - else return null; + return Helper.makeRechargeProvider(stack, true); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSword.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSword.java index c2c6dea3..14c1000c 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSword.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSword.java @@ -34,17 +34,18 @@ public class ItemSword extends SwordItem implements IModItem, ICustomItemModel { @Override public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { - if (this == ModItems.INFUSED_IRON_SWORD) + if (this == ModItems.INFUSED_IRON_SWORD) { target.addPotionEffect(new EffectInstance(Effects.SLOWNESS, 60, 2)); + } else if (this == ModItems.SKY_SWORD) { + target.addPotionEffect(new EffectInstance(Effects.LEVITATION, 60, 2)); + } return super.hitEntity(stack, target, attacker); } @Nullable @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { - if (this == ModItems.INFUSED_IRON_SWORD) - return Helper.makeRechargeProvider(stack, true); - else return null; + return Helper.makeRechargeProvider(stack, true); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java b/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java index b4f67688..dee35779 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java @@ -15,7 +15,8 @@ import java.util.function.Supplier; public enum ModArmorMaterial implements IArmorMaterial { - INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0F, () -> Ingredient.fromItems(ModItems.INFUSED_IRON)); + INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0, () -> Ingredient.fromItems(ModItems.INFUSED_IRON)), + SKY(NaturesAura.MOD_ID + ":sky", 33, new int[]{3, 6, 8, 3}, 12, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 2, () -> Ingredient.fromItems(ModItems.SKY_INGOT)); private static final int[] MAX_DAMAGE_ARRAY = new int[]{13, 15, 16, 11}; private final String name; diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModItemTier.java b/src/main/java/de/ellpeck/naturesaura/reg/ModItemTier.java index df3d5aab..9476d3cd 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModItemTier.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModItemTier.java @@ -8,7 +8,8 @@ import net.minecraft.util.LazyValue; import java.util.function.Supplier; public enum ModItemTier implements IItemTier { - INFUSED(2, 250, 6.0F, 2.0F, 14, () -> Ingredient.fromItems(ModItems.INFUSED_IRON)); + INFUSED(2, 250, 6, 2, 16, () -> Ingredient.fromItems(ModItems.INFUSED_IRON)), + SKY(3, 1500, 8, 3, 12, () -> Ingredient.fromItems(ModItems.SKY_INGOT)); private final int harvestLevel; private final int maxUses; diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java index 15e20c6b..61e0b149 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java @@ -205,7 +205,16 @@ public final class ModRegistry { new ItemDeathRing(), new ItemImpl("tainted_gold"), new ItemLootFinder(), - new ItemLightStaff() + new ItemLightStaff(), + new ItemPickaxe("sky_pickaxe", ModItemTier.SKY, 1, -2.8F), + new ItemAxe("sky_axe", ModItemTier.SKY, 5.0F, -3.0F), + new ItemShovel("sky_shovel", ModItemTier.SKY, 1.5F, -3.0F), + new ItemHoe("sky_hoe", ModItemTier.SKY, -1.0F), + new ItemSword("sky_sword", ModItemTier.SKY, 3, -2.4F), + new ItemArmor("sky_helmet", ModArmorMaterial.SKY, EquipmentSlotType.HEAD), + new ItemArmor("sky_chest", ModArmorMaterial.SKY, EquipmentSlotType.CHEST), + new ItemArmor("sky_pants", ModArmorMaterial.SKY, EquipmentSlotType.LEGS), + new ItemArmor("sky_shoes", ModArmorMaterial.SKY, EquipmentSlotType.FEET) ); Helper.populateObjectHolders(ModItems.class, event.getRegistry()); } diff --git a/src/main/resources/assets/naturesaura/textures/item/sky_axe.png b/src/main/resources/assets/naturesaura/textures/item/sky_axe.png new file mode 100644 index 0000000000000000000000000000000000000000..d8b151c30f43322d90ae35bba309721c105238d7 GIT binary patch literal 521 zcmV+k0`~ohP)4f26otS0W@cxdxNbHiWU&!JiG?V}Utq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nN7U(oS0ph8gen2FhBCbFM1faRiPx$U`a$lR5*>*(z|L^0T6}ZZ(on+LQoKivG4^1D zK8^>miihzv4&pTS<45er_n5~f?!}k56U*@EFs?@O5nxl9x^Sx0sIAQmwhF!44UHAI zrmhFf`6ji}tI-@jV_quWzj11zJKs`mN0D@Vk(mpb5Sk}1`1CnRKYUCsp1x98Qgobm zI{6Z9{~j?YLQ5TTrj5lW}D1a*ak+m&j#9 zrp>VFHLDYnyMF<6=L#K@fhzRc%O%T>az?vilI^H4*)vhmO__#Vfr98s7WhTm?*Jr~ zrTc$|a+zKhHFe4Qg#Li(7%;AI);oKAL^6<9S`1NKzV*x3Bq`g`BmTR71H6BksWrAH Q0ssI207*qoM6N<$f@W^M?EnA( literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/naturesaura/textures/item/sky_pickaxe.png b/src/main/resources/assets/naturesaura/textures/item/sky_pickaxe.png new file mode 100644 index 0000000000000000000000000000000000000000..1d1eda41b1a276752e52a3a3b1a03cbee4dd24a8 GIT binary patch literal 553 zcmV+^0@nSBP)A#8?uWV4Ay`ONmlDDds_CR6-8QHYAN>a`th=^n zWg(IH10*aEn-aRUKqO@n8pSVX^~VQ?Lrhn+QmG1ZglC4^l;u7V*m*IY2JH+ARs?-K-{?rKRb|ApxJ~hLt!Z9 zu3@gsD2`*(?RJX_2HJ_b*tN6xTMKhni~ssM4DW+mcj3{~LSL3Mu*WiXep=kWEneIc z7f)-T##%d2+}L|qQ=`Yl<+I||yjWZilVbv~e+x=c32Thhl|&U*R@<1z&kWaZfXg@o%jPE(99n~6ZK4tOS zN8_C9fw8t&Z3#${1b{S6@!r!IscUFkmE~V8-hE#(d7dK)=Uj0YwJHo%i?)Ft*;>o7 z-TSpYsnJ?(^M3i00m$=w>ye!tQ}m{3oO1;r2mcv(!Z0MuvYxPv7dAB^79NP%a{~_~iXws__{ZOy0jI`A r?jZ^>FW;Jy+@Hl-+iS%b)ARoUd34>dG?qW}00000NkvXXu0mjfpo{#( literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/naturesaura/textures/item/sky_shoes.png b/src/main/resources/assets/naturesaura/textures/item/sky_shoes.png new file mode 100644 index 0000000000000000000000000000000000000000..b06f527e7ec4b9a536a90c1327ae1abc11962e74 GIT binary patch literal 414 zcmV;P0b%}$P)Px$SV=@dR5*?8kF-BO7 z;0;Z(-`P>2DVc{{gUwNQ#9z1rqz1?thNslbqrnB#a}Xjfhj0bMmI)4}C1q&ZI{*pT z+0v84eG&#S0*0kT_6XL4G~sM;%Hxj*WfpVgLXD literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/naturesaura/textures/item/sky_shovel.png b/src/main/resources/assets/naturesaura/textures/item/sky_shovel.png new file mode 100644 index 0000000000000000000000000000000000000000..960403b00d9ed41edba3ff59790097ce711335f7 GIT binary patch literal 448 zcmV;x0YCnUP)R$m4b>3#ed)r6kWIy z0znrp#BAcmRba$Nn=roO17fi0?(1Ucnr>TN1#(tJ-FwchbLztXhP+!8K}7I84}frG zL0xh4OP*_tL8N%+FgvXzKb7!A+22x@=M=z8>q(Ln#Ns$^legF5IDqCQRJ&cT6UZV- z5<~=RE%D5hvb_O~Q+RxY&I%0l!Bf~8=9Ij=ma4Wg*!?Dc|00|PaD4-pSFp4SJ9|aH zspqWsdTm7K2PbvBI;?zMQ~U|#HDm*{)&k(yMs;CmO8wesi?leS)>=xXQk$0*DVNKH zVd%&e+rgjsF9*#ZZ}z!@=Xpd?gfWKk>ag~F{6z3@LE|B9ntO& zU7X!FIl4QS?DvWYs+v2uqxUCNf$Cj_7b@?P)Nkl6*b08 zg^q|61hq>emR4PT2422DwK)vKQ8qyk6rS4+J-qQsY1P&0w(|akvUE?GpVQ2i_Z|_+ zF+m*1x#VFq!21#e0m`4f zIwC@)QXvdO&K^Id7iP{Vt-8*9UDvrkn@VRvjWMI)17Pnx;+!K*Q)Z8yREOnv{FmT{OF@kRwPqkttF0Qf*{B(2(7vj4Y=6-&Q9+e8@(BuJ5>L`iJthvT)II9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