From 3e434b8fc82f9f1169527b99b12ea029c30bca70 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 13 Oct 2020 23:30:47 +0200 Subject: [PATCH] added the staff of ancient knowledge --- .../items/ItemNetheriteFinder.java | 60 ++++++++++++++++++ .../ellpeck/naturesaura/items/ModItems.java | 1 + .../ellpeck/naturesaura/reg/ModRegistry.java | 3 +- .../assets/naturesaura/lang/en_us.json | 1 + .../textures/item/netherite_finder.png | Bin 0 -> 388 bytes .../en_us/entries/items/netherite_finder.json | 21 ++++++ .../naturesaura/recipes/netherite_finder.json | 25 ++++++++ 7 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 src/main/java/de/ellpeck/naturesaura/items/ItemNetheriteFinder.java create mode 100644 src/main/resources/assets/naturesaura/textures/item/netherite_finder.png create mode 100644 src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/items/netherite_finder.json create mode 100644 src/main/resources/data/naturesaura/recipes/netherite_finder.json diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemNetheriteFinder.java b/src/main/java/de/ellpeck/naturesaura/items/ItemNetheriteFinder.java new file mode 100644 index 00000000..9dd7c807 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemNetheriteFinder.java @@ -0,0 +1,60 @@ +package de.ellpeck.naturesaura.items; + +import de.ellpeck.naturesaura.Helper; +import de.ellpeck.naturesaura.api.NaturesAuraAPI; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.MobSpawnerTileEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Hand; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.items.CapabilityItemHandler; + +public class ItemNetheriteFinder extends ItemImpl { + public ItemNetheriteFinder() { + super("netherite_finder", new Properties().maxStackSize(1)); + } + + @Override + public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { + ItemStack stack = playerIn.getHeldItem(handIn); + NaturesAuraAPI.IInternalHooks inst = NaturesAuraAPI.instance(); + if (!inst.extractAuraFromPlayer(playerIn, 200000, false)) + return new ActionResult<>(ActionResultType.FAIL, stack); + if (worldIn.isRemote) { + inst.setParticleDepth(false); + inst.setParticleSpawnRange(64); + inst.setParticleCulling(false); + + BlockPos pos = playerIn.getPosition(); + int range = 64; + for (int x = -range; x <= range; x++) { + for (int y = 0; y <= 128; y++) { + for (int z = -range; z <= range; z++) { + BlockPos offset = new BlockPos(pos.getX() + x, y, pos.getZ() + z); + BlockState state = worldIn.getBlockState(offset); + if (state.getBlock() == Blocks.ANCIENT_DEBRIS || state.getBlock().getRegistryName().toString().contains("netherite")) { + inst.spawnMagicParticle( + offset.getX() + 0.5F, offset.getY() + 0.5F, offset.getZ() + 0.5F, + 0F, 0F, 0F, 0xab4d38, 6F, 20 * 60, 0F, false, true); + } + } + } + } + + inst.setParticleDepth(true); + inst.setParticleSpawnRange(32); + inst.setParticleCulling(true); + playerIn.swingArm(handIn); + } + playerIn.getCooldownTracker().setCooldown(this, 20 * 60); + return new ActionResult<>(ActionResultType.SUCCESS, stack); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java index 558cbed4..0e0498ec 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java @@ -62,4 +62,5 @@ public final class ModItems { public static Item END_CITY_FINDER; public static Item BREAK_PREVENTION; public static Item PET_REVIVER; + public static Item NETHERITE_FINDER; } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java index e2f5ed80..59e91c9b 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java @@ -223,7 +223,8 @@ public final class ModRegistry { new ItemStructureFinder("fortress_finder", Structure.field_236378_n_, 0xba2800), new ItemStructureFinder("end_city_finder", Structure.field_236379_o_, 0xca5cd6), new ItemBreakPrevention(), - new ItemPetReviver() + new ItemPetReviver(), + new ItemNetheriteFinder() ); Helper.populateObjectHolders(ModItems.class, event.getRegistry()); } diff --git a/src/main/resources/assets/naturesaura/lang/en_us.json b/src/main/resources/assets/naturesaura/lang/en_us.json index ccd7464b..5516fab3 100644 --- a/src/main/resources/assets/naturesaura/lang/en_us.json +++ b/src/main/resources/assets/naturesaura/lang/en_us.json @@ -132,6 +132,7 @@ "item.naturesaura.end_city_finder": "Eye of the Shulker", "item.naturesaura.break_prevention": "Eir's Token", "item.naturesaura.pet_reviver": "Token of Undying Friendship", + "item.naturesaura.netherite_finder": "Staff of Ancient Knowledge", "container.naturesaura:tree_ritual.name": "Ritual of the Forest", "container.naturesaura:altar.name": "Natural Altar Infusion", "container.naturesaura:offering.name": "Offering to the Gods", diff --git a/src/main/resources/assets/naturesaura/textures/item/netherite_finder.png b/src/main/resources/assets/naturesaura/textures/item/netherite_finder.png new file mode 100644 index 0000000000000000000000000000000000000000..a1b1a91674a060e28090e6c89fd9ea21fdfcc841 GIT binary patch literal 388 zcmV-~0ek+5P)Px$K1oDDR5*>*lFdp&Q51#0YYikj=3f+OMrekpRAxazm@m+{20`>74SJS(4u^sU z5d@id5g~)X|C`_>cOwspm`0=4Y;(@H_TK9p_;<<#mnH0W$gsBk77RyY9ELWyzC0HI zV;1-#6&JhLN54_W?)3qX%@-)Qdd5r>)B=r<4mqIrlPN+}I>yIl;!&~P{!BbzS}S@BSMZ)$i%N-0DH z5z(D*GFP%2*pji!-=v*H1gFypz}eBBM2U0vcuT4GX#iN3^|OIeiil%Q{O$x+uSk2~ zq1<`X=aURZUcv89a1z|6J@D}G`ZCiW(FU2oj-*yMdFBb1tw}naCYel5HPBs#VYzHg i?pyt_?vqydv%UcDb$N|*TfoZz0000