mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-29 22:28:34 +01:00
Compare commits
4 commits
8d68aa5777
...
21e553f0e4
Author | SHA1 | Date | |
---|---|---|---|
21e553f0e4 | |||
29e167f07c | |||
0578677580 | |||
7d9dce5a7b |
9 changed files with 212 additions and 27 deletions
|
@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
version = '37.7'
|
version = '38.0'
|
||||||
group = 'de.ellpeck.naturesaura' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group = 'de.ellpeck.naturesaura' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = 'NaturesAura'
|
archivesBaseName = 'NaturesAura'
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,12 @@ import de.ellpeck.naturesaura.items.ModItems;
|
||||||
import de.ellpeck.naturesaura.reg.ICustomItemModel;
|
import de.ellpeck.naturesaura.reg.ICustomItemModel;
|
||||||
import de.ellpeck.naturesaura.reg.IModItem;
|
import de.ellpeck.naturesaura.reg.IModItem;
|
||||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
|
@ -25,6 +27,7 @@ import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ItemShovel extends ShovelItem implements IModItem, ICustomItemModel {
|
public class ItemShovel extends ShovelItem implements IModItem, ICustomItemModel {
|
||||||
|
|
||||||
|
@ -43,39 +46,65 @@ public class ItemShovel extends ShovelItem implements IModItem, ICustomItemModel
|
||||||
var stack = player.getItemInHand(context.getHand());
|
var stack = player.getItemInHand(context.getHand());
|
||||||
var pos = context.getClickedPos();
|
var pos = context.getClickedPos();
|
||||||
var state = level.getBlockState(pos);
|
var state = level.getBlockState(pos);
|
||||||
if (this == ModItems.INFUSED_IRON_SHOVEL) {
|
|
||||||
var damage = 0;
|
// turning dirt to grass
|
||||||
if (state.getBlock() == Blocks.DIRT || state.getBlock() == Blocks.MYCELIUM) {
|
if (this == ModItems.INFUSED_IRON_SHOVEL || this == ModItems.DEPTH_SHOVEL) {
|
||||||
if (level.getBlockState(pos.above()).getMaterial() == Material.AIR) {
|
if ((state.getBlock() == Blocks.DIRT || state.getBlock() == Blocks.MYCELIUM) && level.getBlockState(pos.above()).getMaterial() == Material.AIR) {
|
||||||
level.setBlockAndUpdate(pos, Blocks.GRASS_BLOCK.defaultBlockState());
|
level.setBlockAndUpdate(pos, Blocks.GRASS_BLOCK.defaultBlockState());
|
||||||
damage = 5;
|
var damage = 5F;
|
||||||
}
|
|
||||||
} else {
|
if (this == ModItems.DEPTH_SHOVEL && !level.isClientSide) {
|
||||||
var range = player.isShiftKeyDown() ? 0 : 1;
|
var possible = new ArrayList<BlockPos>();
|
||||||
for (var x = -range; x <= range; x++) {
|
for (var x = -5; x <= 5; x++) {
|
||||||
for (var y = -range; y <= range; y++) {
|
for (var z = -5; z <= 5; z++) {
|
||||||
var actualPos = pos.offset(x, 0, y);
|
for (var y = -1; y <= 1; y++) {
|
||||||
var facing = context.getClickedFace();
|
var offset = pos.offset(x, y, z);
|
||||||
if (player.mayUseItemAt(actualPos.relative(facing), facing, stack)) {
|
var offState = level.getBlockState(offset);
|
||||||
if (facing != Direction.DOWN
|
if ((offState.getBlock() == Blocks.DIRT || offState.getBlock() == Blocks.MYCELIUM) && level.getBlockState(offset.above()).getMaterial() == Material.AIR)
|
||||||
&& level.getBlockState(actualPos.above()).getMaterial() == Material.AIR
|
possible.add(offset);
|
||||||
&& level.getBlockState(actualPos).getBlock() == Blocks.GRASS_BLOCK) {
|
|
||||||
if (!level.isClientSide)
|
|
||||||
level.setBlock(actualPos, Blocks.DIRT_PATH.defaultBlockState(), 11);
|
|
||||||
damage = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (var i = 0; i < 63 && !possible.isEmpty(); i++) {
|
||||||
|
level.setBlockAndUpdate(possible.get(level.random.nextInt(possible.size())), Blocks.GRASS_BLOCK.defaultBlockState());
|
||||||
|
damage += 0.25F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
level.playSound(player, pos, SoundEvents.GRASS_PLACE, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||||
|
stack.hurtAndBreak(Mth.ceil(damage), player, p -> p.broadcastBreakEvent(context.getHand()));
|
||||||
|
return InteractionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// flattening a large area
|
||||||
|
if (this == ModItems.INFUSED_IRON_SHOVEL) {
|
||||||
|
var flattened = false;
|
||||||
|
var range = player.isShiftKeyDown() ? 0 : 1;
|
||||||
|
for (var x = -range; x <= range; x++) {
|
||||||
|
for (var y = -range; y <= range; y++) {
|
||||||
|
var actualPos = pos.offset(x, 0, y);
|
||||||
|
var facing = context.getClickedFace();
|
||||||
|
if (player.mayUseItemAt(actualPos.relative(facing), facing, stack)) {
|
||||||
|
if (facing != Direction.DOWN
|
||||||
|
&& level.getBlockState(actualPos.above()).getMaterial() == Material.AIR
|
||||||
|
&& level.getBlockState(actualPos).getBlock() == Blocks.GRASS_BLOCK) {
|
||||||
|
if (!level.isClientSide)
|
||||||
|
level.setBlock(actualPos, Blocks.DIRT_PATH.defaultBlockState(), 11);
|
||||||
|
flattened = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (flattened) {
|
||||||
if (damage > 0) {
|
|
||||||
level.playSound(player, pos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F);
|
level.playSound(player, pos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||||
stack.hurtAndBreak(damage, player, p -> p.broadcastBreakEvent(context.getHand()));
|
stack.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(context.getHand()));
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
return InteractionResult.PASS;
|
}
|
||||||
} else if (this == ModItems.SKY_SHOVEL) {
|
|
||||||
|
// sky shovel swapping
|
||||||
|
if (this == ModItems.SKY_SHOVEL) {
|
||||||
if (this.getDestroySpeed(stack, state) <= 1)
|
if (this.getDestroySpeed(stack, state) <= 1)
|
||||||
return super.useOn(context);
|
return super.useOn(context);
|
||||||
var otherHand = context.getHand() == InteractionHand.MAIN_HAND ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
|
var otherHand = context.getHand() == InteractionHand.MAIN_HAND ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
|
||||||
|
@ -90,6 +119,7 @@ public class ItemShovel extends ShovelItem implements IModItem, ICustomItemModel
|
||||||
stack.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(context.getHand()));
|
stack.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(context.getHand()));
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.useOn(context);
|
return super.useOn(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,10 @@
|
||||||
"advancement.naturesaura.range_visualizer.desc": "Create a Mystical Magnifier to see the range of your devices",
|
"advancement.naturesaura.range_visualizer.desc": "Create a Mystical Magnifier to see the range of your devices",
|
||||||
"advancement.naturesaura.vacuum_bottle": "Breathe Through, Breathe Deep",
|
"advancement.naturesaura.vacuum_bottle": "Breathe Through, Breathe Deep",
|
||||||
"advancement.naturesaura.vacuum_bottle.desc": "Capture a vacuum using a Bottle and Cork",
|
"advancement.naturesaura.vacuum_bottle.desc": "Capture a vacuum using a Bottle and Cork",
|
||||||
|
"advancement.naturesaura.depth_ingot": "Depth Stranding",
|
||||||
|
"advancement.naturesaura.depth_ingot.desc": "Craft an Ingot of the Depths",
|
||||||
|
"advancement.naturesaura.depth_tools": "Striding in Style",
|
||||||
|
"advancement.naturesaura.depth_tools.desc": "Craft a full set of Soulstrider's tools and armor",
|
||||||
"command.naturesaura.aura.usage": "/naaura store|drain <amount> [range] OR /naaura reset <range>",
|
"command.naturesaura.aura.usage": "/naaura store|drain <amount> [range] OR /naaura reset <range>",
|
||||||
"effect.naturesaura.breathless": "Breathless",
|
"effect.naturesaura.breathless": "Breathless",
|
||||||
"entity.naturesaura.effect_inhibitor": "Effect Powder",
|
"entity.naturesaura.effect_inhibitor": "Effect Powder",
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "Soulstrider's Armor",
|
||||||
|
"icon": "naturesaura:depth_chest",
|
||||||
|
"category": "naturesaura:items",
|
||||||
|
"advancement": "naturesaura:depth_ingot",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "When wearing $(item)Soulstrider's armor$(), a magical botanist can feel dark energy surging in them. While this armor can be repaired like its $(l:items/sky_armor)counterparts$(), it also provides a $(thing)set bonus$(): When wearing every piece of the armor (or swapping the chestplate for an $(item)Elytra$()), upon being struck, the armor causes all nearby enemies to fuse with the ground for a few seconds, causing them to $(thing)stand completely still$()."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"recipe": "naturesaura:depth_helmet",
|
||||||
|
"recipe2": "naturesaura:depth_chest"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"recipe": "naturesaura:depth_pants",
|
||||||
|
"recipe2": "naturesaura:depth_shoes"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "Ingot of the Depths",
|
||||||
|
"icon": "naturesaura:depth_ingot",
|
||||||
|
"category": "naturesaura:items",
|
||||||
|
"advancement": "naturesaura:sky_ingot",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Years after their original inception, magical botanists have finally found a new material able to harness the powers of $(aura) through new means: the mystical and elusive $(item)Netherite$(). With it, one can create a most powerful material: $(item)Ingots of the Depths$(). These ingots, as expected, can also be turned into $(l:items/depth_armor)armor$() and $(l:items/depth_tools)tools$()."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"text": "Creating the $(item)Ingot of the Depths$()",
|
||||||
|
"recipe": "naturesaura:depth_ingot_creation"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"name": "Soulstrider's Tools",
|
||||||
|
"icon": "naturesaura:depth_pickaxe",
|
||||||
|
"category": "naturesaura:items",
|
||||||
|
"advancement": "naturesaura:depth_ingot",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "$(item)Soulstrider's tools$() are extraordinarily powerful as tools go, being forged out of a combination of materials from the Skies, the Earth, and the Depths. While also functioning as regular tools, they each have an additional $(thing)special ability$() that sets them apart from their $(item)netherite$() counterparts.$(br)Additionally, these tools can be $(thing)repaired$() in the same way as $(l:items/sky_tools)Skyseeker's tools$()."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"text": "The $(item)Soulstrider's Pickaxe$(), when enabled by $(thing)sneak-interacting$() with it, will mine a whole $(thing)vein of ores$() all in one, allowing mining much more efficiently.",
|
||||||
|
"recipe": "naturesaura:depth_pickaxe"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"text": "The $(item)Soulstrider's Handaxe$(), when enabled by $(thing)sneak-interacting$() with it, is very efficient at chopping $(thing)any type of tree$(), even extraordinarily large ones, doing so in one fell swoop.",
|
||||||
|
"recipe": "naturesaura:depth_axe"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"text": "The $(item)Soulstrider's Shovel$(), when interacting with a barren block like $(item)Dirt$(), turns it into a luscious grass block, additionally doing so for a $(thing)large area$() around it in the process.",
|
||||||
|
"recipe": "naturesaura:depth_shovel"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"text": "The $(item)Soulstrider's Hoe$() helps those botanists who don't enjoy waiting for a tree to fully fall on its own, allowing them to break $(item)Leaves$() in a very large area with only a single swing.",
|
||||||
|
"recipe": "naturesaura:depth_hoe"
|
||||||
|
}, {
|
||||||
|
"type": "crafting",
|
||||||
|
"text": "The sheer size of the $(item)Soulstrider's Blade$() comes to play when attacking a larger group of monsters: Upon attacking one of them, several in a rather large area are struck, as if it was enchanted with a more powerful version of $(item)Sweeping Edge$(). Of course, these two abilities are not mutually exclusive, either.",
|
||||||
|
"recipe": "naturesaura:depth_sword"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -15,7 +15,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "crafting",
|
"type": "crafting",
|
||||||
"text": "The $(item)Skyseeker's Handaxe$() is very efficient at chopping $(thing)small trees$(), doing so in one fell swoop.",
|
"text": "The $(item)Skyseeker's Handaxe$(), when enabled by $(thing)sneak-interacting$() with it, is very efficient at chopping $(thing)small trees$(), doing so in one fell swoop.",
|
||||||
"recipe": "naturesaura:sky_axe"
|
"recipe": "naturesaura:sky_axe"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "naturesaura:depth_ingot"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"translate": "advancement.naturesaura.depth_ingot"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"translate": "advancement.naturesaura.depth_ingot.desc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parent": "naturesaura:sky_ingot",
|
||||||
|
"criteria": {
|
||||||
|
"ingot": {
|
||||||
|
"trigger": "minecraft:inventory_changed",
|
||||||
|
"conditions": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_ingot"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"display": {
|
||||||
|
"icon": {
|
||||||
|
"item": "naturesaura:depth_pickaxe"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"translate": "advancement.naturesaura.depth_tools"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"translate": "advancement.naturesaura.depth_tools.desc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parent": "naturesaura:depth_ingot",
|
||||||
|
"criteria": {
|
||||||
|
"materials": {
|
||||||
|
"trigger": "minecraft:inventory_changed",
|
||||||
|
"conditions": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_pickaxe"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_sword"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_axe"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_shovel"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_hoe"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_helmet"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_chest"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_pants"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": ["naturesaura:depth_shoes"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue