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 00000000..a1b1a916 Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/item/netherite_finder.png differ diff --git a/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/items/netherite_finder.json b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/items/netherite_finder.json new file mode 100644 index 00000000..1e70c943 --- /dev/null +++ b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/items/netherite_finder.json @@ -0,0 +1,21 @@ +{ + "name": "Staff of Ancient Knowledge", + "icon": "naturesaura:netherite_finder", + "category": "items", + "advancement": "naturesaura:offering", + "pages": [ + { + "type": "text", + "text": "Recent discoveries have unmasked a rather important, buried substance within the darker parts of this world: $(thing)Ancient Debris$(). This hard-to-find material is sturdy and extremely useful to miners, yet its rarity makes it hard to obtain. The $(item)Staff of Ancient Knowledge$() solves this problem in an elegant way." + }, + { + "type": "text", + "text": "When using it, all $(thing)Ancient Debris$() blocks in a rather large area around the user will be highlighted, making them visible even $(thing)through other blocks$(), for about a minute or so. During this time, the material can easily be located and mined.$(br)Needless to say, this operation requires a large amount of $(aura) from an $(l:items/aura_cache)Aura Cache$() or similar device." + }, + { + "type": "crafting", + "text": "Creating the $(item)Staff of Ancient Knowledge$()", + "recipe": "naturesaura:netherite_finder" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/naturesaura/recipes/netherite_finder.json b/src/main/resources/data/naturesaura/recipes/netherite_finder.json new file mode 100644 index 00000000..09b50bef --- /dev/null +++ b/src/main/resources/data/naturesaura/recipes/netherite_finder.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " NE", + "IRI", + "RN " + ], + "key": { + "R": { + "item": "naturesaura:ancient_stick" + }, + "I": { + "item": "naturesaura:sky_ingot" + }, + "N": { + "item": "minecraft:netherrack" + }, + "E": { + "item": "minecraft:netherite_scrap" + } + }, + "result": { + "item": "naturesaura:netherite_finder" + } +} \ No newline at end of file