start of depth tools

This commit is contained in:
Ell 2023-02-17 14:21:39 +01:00
parent 08643e79b8
commit c1797eb14b
37 changed files with 297 additions and 32 deletions

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "naturesaura:item/depth_axe"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "naturesaura:item/depth_chest"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "naturesaura:item/depth_helmet"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "naturesaura:item/depth_hoe"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "naturesaura:item/depth_pants"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "naturesaura:item/depth_pickaxe"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "naturesaura:item/depth_shoes"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "naturesaura:item/depth_shovel"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "naturesaura:item/depth_sword"
}
}

View file

@ -1,6 +1,7 @@
{
"values": [
"naturesaura:infused_iron_pickaxe",
"naturesaura:sky_pickaxe"
"naturesaura:sky_pickaxe",
"naturesaura:depth_pickaxe"
]
}

View file

@ -10,6 +10,8 @@ import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl;
import de.ellpeck.naturesaura.chunk.AuraChunk;
import de.ellpeck.naturesaura.compat.Compat;
import de.ellpeck.naturesaura.misc.LevelData;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -29,6 +31,7 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
@ -333,4 +336,27 @@ public final class Helper {
}
return pos;
}
public static void mineRecursively(Level level, BlockPos pos, BlockPos start, boolean drop, int horizontalRange, int verticalRange, Predicate<BlockState> filter) {
if (Math.abs(pos.getX() - start.getX()) >= horizontalRange || Math.abs(pos.getZ() - start.getZ()) >= horizontalRange || Math.abs(pos.getY() - start.getY()) >= verticalRange)
return;
for (var x = -1; x <= 1; x++) {
for (var y = -1; y <= 1; y++) {
for (var z = -1; z <= 1; z++) {
var offset = pos.offset(x, y, z);
var state = level.getBlockState(offset);
if (filter.test(state)) {
if (drop) {
level.destroyBlock(offset, true);
} else {
// in this case we don't want the block breaking particles, so we can't use destroyBlock
level.setBlockAndUpdate(offset, Blocks.AIR.defaultBlockState());
PacketHandler.sendToAllAround(level, pos, 32, new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), PacketParticles.Type.TR_DISAPPEAR));
}
Helper.mineRecursively(level, offset, start, drop, horizontalRange, verticalRange, filter);
}
}
}
}
}
}

View file

@ -1,5 +1,6 @@
package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticleStream;
@ -122,30 +123,7 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
}
public static void recurseTreeDestruction(Level level, BlockPos pos, BlockPos start, boolean includeLeaves, boolean drop) {
if (Math.abs(pos.getX() - start.getX()) >= 6
|| Math.abs(pos.getZ() - start.getZ()) >= 6
|| Math.abs(pos.getY() - start.getY()) >= 32) {
return;
}
for (var x = -1; x <= 1; x++) {
for (var y = -1; y <= 1; y++) {
for (var z = -1; z <= 1; z++) {
var offset = pos.offset(x, y, z);
var state = level.getBlockState(offset);
if (state.is(BlockTags.LOGS) || includeLeaves && state.getBlock() instanceof LeavesBlock) {
if (drop) {
level.destroyBlock(offset, true);
} else {
// in this case we don't want the particles, so we can't use destroyBlock
level.setBlockAndUpdate(offset, Blocks.AIR.defaultBlockState());
PacketHandler.sendToAllAround(level, pos, 32, new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), PacketParticles.Type.TR_DISAPPEAR));
}
BlockEntityWoodStand.recurseTreeDestruction(level, offset, start, includeLeaves, drop);
}
}
}
}
Helper.mineRecursively(level, pos, start, drop, 6, 32, s -> s.is(BlockTags.LOGS) || includeLeaves && s.getBlock() instanceof LeavesBlock);
}
private boolean isRitualOkay() {

View file

@ -29,14 +29,14 @@ public class ItemTagProvider extends ItemTagsProvider {
this.copy(BlockTags.SLABS, ItemTags.SLABS);
this.tag(Tags.Items.RODS_WOODEN).add(ModItems.ANCIENT_STICK);
this.tag(ItemTags.CLUSTER_MAX_HARVESTABLES).add(ModItems.INFUSED_IRON_PICKAXE, ModItems.SKY_PICKAXE);
this.tag(ItemTags.CLUSTER_MAX_HARVESTABLES).add(ModItems.INFUSED_IRON_PICKAXE, ModItems.SKY_PICKAXE, ModItems.DEPTH_PICKAXE);
Compat.addItemTags(this);
}
@Override
public TagAppender<Item> tag(TagKey<Item> p_126549_) {
public TagAppender<Item> tag(TagKey<Item> tag) {
// super is protected, but CuriosCompat needs this
return super.tag(p_126549_);
return super.tag(tag);
}
}

View file

@ -65,4 +65,14 @@ public final class ModItems {
public static Item PET_REVIVER;
public static Item NETHERITE_FINDER;
public static Item VACUUM_BOTTLE;
public static Item DEPTH_INGOT;
public static Item DEPTH_PICKAXE;
public static Item DEPTH_AXE;
public static Item DEPTH_SHOVEL;
public static Item DEPTH_HOE;
public static Item DEPTH_SWORD;
public static Item DEPTH_HELMET;
public static Item DEPTH_CHEST;
public static Item DEPTH_PANTS;
public static Item DEPTH_SHOES;
}

View file

@ -10,6 +10,7 @@ import de.ellpeck.naturesaura.misc.LevelData;
import de.ellpeck.naturesaura.reg.ICustomItemModel;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
@ -23,7 +24,9 @@ import net.minecraft.world.item.Tier;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.registries.ForgeRegistries;
import javax.annotation.Nullable;
@ -84,6 +87,15 @@ public class ItemPickaxe extends PickaxeItem implements IModItem, ICustomItemMod
}
}
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, Player player) {
if (itemstack.getItem() == ModItems.DEPTH_PICKAXE && !player.isShiftKeyDown() && player.level.getBlockState(pos).is(Tags.Blocks.ORES)) {
Helper.mineRecursively(player.level, pos, pos, true, 5, 5, s -> s.is(Tags.Blocks.ORES));
return true;
}
return false;
}
@Nullable
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {

View file

@ -15,8 +15,9 @@ import java.util.function.Supplier;
public enum ModArmorMaterial implements ArmorMaterial {
INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ARMOR_EQUIP_GENERIC, 0, () -> Ingredient.of(ModItems.INFUSED_IRON)),
SKY(NaturesAura.MOD_ID + ":sky", 33, new int[]{3, 6, 8, 3}, 12, SoundEvents.ARMOR_EQUIP_GENERIC, 2, () -> Ingredient.of(ModItems.SKY_INGOT));
INFUSED(NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ARMOR_EQUIP_IRON, 0, () -> Ingredient.of(ModItems.INFUSED_IRON)),
SKY(NaturesAura.MOD_ID + ":sky", 33, new int[]{3, 6, 8, 3}, 12, SoundEvents.ARMOR_EQUIP_DIAMOND, 2, () -> Ingredient.of(ModItems.SKY_INGOT)),
DEPTH(NaturesAura.MOD_ID + ":depth", 37, new int[]{3, 6, 8, 3}, 18, SoundEvents.ARMOR_EQUIP_NETHERITE, 3, () -> Ingredient.of(ModItems.DEPTH_INGOT));
private static final int[] MAX_DAMAGE_ARRAY = {13, 15, 16, 11};
private final String name;

View file

@ -8,8 +8,10 @@ import net.minecraftforge.common.util.Lazy;
import java.util.function.Supplier;
public enum ModItemTier implements Tier {
INFUSED(2, 250, 6, 2, 16, () -> Ingredient.of(ModItems.INFUSED_IRON)),
SKY(3, 1500, 8, 3, 12, () -> Ingredient.of(ModItems.SKY_INGOT));
SKY(3, 1500, 8, 3, 12, () -> Ingredient.of(ModItems.SKY_INGOT)),
DEPTH(4, 2500, 10, 5, 18, () -> Ingredient.of(ModItems.DEPTH_INGOT));
private final int harvestLevel;
private final int maxUses;

View file

@ -212,7 +212,16 @@ public final class ModRegistry {
new ItemPetReviver(),
new ItemNetheriteFinder(),
new ItemImpl("vacuum_bottle"),
new ItemImpl("depth_ingot")
new ItemImpl("depth_ingot"),
new ItemPickaxe("depth_pickaxe", ModItemTier.DEPTH, 1, -2.8F),
new ItemAxe("depth_axe", ModItemTier.DEPTH, 5, -3),
new ItemShovel("depth_shovel", ModItemTier.DEPTH, 1.5F, -3),
new ItemHoe("depth_hoe", ModItemTier.DEPTH, -1),
new ItemSword("depth_sword", ModItemTier.DEPTH, 3, -2.4F),
new ItemArmor("depth_helmet", ModArmorMaterial.DEPTH, EquipmentSlot.HEAD),
new ItemArmor("depth_chest", ModArmorMaterial.DEPTH, EquipmentSlot.CHEST),
new ItemArmor("depth_pants", ModArmorMaterial.DEPTH, EquipmentSlot.LEGS),
new ItemArmor("depth_shoes", ModArmorMaterial.DEPTH, EquipmentSlot.FEET)
);
Helper.populateObjectHolders(ModItems.class, event.getForgeRegistry());
});

View file

@ -151,6 +151,15 @@
"item.naturesaura.break_prevention": "Eir's Token",
"item.naturesaura.pet_reviver": "Token of Undying Friendship",
"item.naturesaura.netherite_finder": "Staff of Ancient Knowledge",
"item.naturesaura.depth_pickaxe": "Soulstrider's Pickaxe",
"item.naturesaura.depth_axe": "Soulstrider's Handaxe",
"item.naturesaura.depth_shovel": "Soulstrider's Shovel",
"item.naturesaura.depth_sword": "Soulstrider's Blade",
"item.naturesaura.depth_hoe": "Soulstrider's Hoe",
"item.naturesaura.depth_helmet": "Soulstrider's Headwear",
"item.naturesaura.depth_chest": "Soulstrider's Chestplate",
"item.naturesaura.depth_pants": "Soulstrider's Leggings",
"item.naturesaura.depth_shoes": "Soulstrider's Shoes",
"container.naturesaura:tree_ritual.name": "Ritual of the Forest",
"container.naturesaura:altar.name": "Natural Altar Infusion",
"container.naturesaura:offering.name": "Offering to the Gods",

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"AA",
"AS",
" S"
],
"key": {
"A": {
"item": "naturesaura:depth_ingot"
},
"S": {
"item": "naturesaura:ancient_stick"
}
},
"result": {
"item": "naturesaura:depth_axe"
}
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"ASA",
"AAA",
"AAA"
],
"key": {
"A": {
"item": "naturesaura:depth_ingot"
},
"S": {
"item": "naturesaura:ancient_stick"
}
},
"result": {
"item": "naturesaura:depth_chest"
}
}

View file

@ -0,0 +1,18 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"AAA",
"ASA"
],
"key": {
"A": {
"item": "naturesaura:depth_ingot"
},
"S": {
"item": "naturesaura:ancient_stick"
}
},
"result": {
"item": "naturesaura:depth_helmet"
}
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"AA",
" S",
" S"
],
"key": {
"A": {
"item": "naturesaura:depth_ingot"
},
"S": {
"item": "naturesaura:ancient_stick"
}
},
"result": {
"item": "naturesaura:depth_hoe"
}
}

View file

@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"AAA",
"A A",
"A A"
],
"key": {
"A": {
"item": "naturesaura:depth_ingot"
}
},
"result": {
"item": "naturesaura:depth_pants"
}
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"AAA",
" S ",
" S "
],
"key": {
"A": {
"item": "naturesaura:depth_ingot"
},
"S": {
"item": "naturesaura:ancient_stick"
}
},
"result": {
"item": "naturesaura:depth_pickaxe"
}
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"A A",
"A A"
],
"key": {
"A": {
"item": "naturesaura:depth_ingot"
}
},
"result": {
"item": "naturesaura:depth_shoes"
}
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"A",
"S",
"S"
],
"key": {
"A": {
"item": "naturesaura:depth_ingot"
},
"S": {
"item": "naturesaura:ancient_stick"
}
},
"result": {
"item": "naturesaura:depth_shovel"
}
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"A",
"A",
"S"
],
"key": {
"A": {
"item": "naturesaura:depth_ingot"
},
"S": {
"item": "naturesaura:ancient_stick"
}
},
"result": {
"item": "naturesaura:depth_sword"
}
}