From 2be1a57e7ab2fb57d64e287f260b9fa5f83be1d3 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 13 Oct 2018 23:46:30 +0200 Subject: [PATCH] added the ancient tree --- .../de/ellpeck/naturesaura/NaturesAura.java | 4 +- .../blocks/BlockAncientLeaves.java | 152 ++++++++++++++++++ .../naturesaura/blocks/BlockAncientLog.java | 69 ++++++++ .../blocks/BlockAncientSapling.java | 121 ++++++++++++++ .../ellpeck/naturesaura/blocks/BlockImpl.java | 6 + .../ellpeck/naturesaura/blocks/ModBlocks.java | 13 ++ .../ellpeck/naturesaura/blocks/OurBlocks.java | 6 - .../blocks/tiles/TileEntityAncientLeaves.java | 4 + .../naturesaura/gen/WorldGenAncientTree.java | 138 ++++++++++++++++ .../naturesaura/particles/ParticleMagic.java | 2 +- .../naturesaura/blockstates/ancient_bark.json | 14 ++ .../blockstates/ancient_leaves.json | 22 +++ .../naturesaura/blockstates/ancient_log.json | 26 +++ .../blockstates/ancient_sapling.json | 26 +++ .../assets/naturesaura/lang/en_US.lang | 6 + .../textures/blocks/ancient_leaves.png | Bin 0 -> 407 bytes .../textures/blocks/ancient_log.png | Bin 0 -> 606 bytes .../textures/blocks/ancient_log_top.png | Bin 0 -> 540 bytes .../textures/blocks/ancient_sapling.png | Bin 0 -> 753 bytes .../textures/particles/magic_round.png | Bin 0 -> 576 bytes 20 files changed, 600 insertions(+), 9 deletions(-) create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java delete mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/OurBlocks.java create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java create mode 100644 src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java create mode 100644 src/main/resources/assets/naturesaura/blockstates/ancient_bark.json create mode 100644 src/main/resources/assets/naturesaura/blockstates/ancient_leaves.json create mode 100644 src/main/resources/assets/naturesaura/blockstates/ancient_log.json create mode 100644 src/main/resources/assets/naturesaura/blockstates/ancient_sapling.json create mode 100644 src/main/resources/assets/naturesaura/lang/en_US.lang create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/ancient_leaves.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/ancient_log.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/ancient_log_top.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/ancient_sapling.png create mode 100644 src/main/resources/assets/naturesaura/textures/particles/magic_round.png diff --git a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java index c983b081..91a178da 100644 --- a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java +++ b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java @@ -1,6 +1,6 @@ package de.ellpeck.naturesaura; -import de.ellpeck.naturesaura.blocks.OurBlocks; +import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.proxy.IProxy; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.creativetab.CreativeTabs; @@ -37,7 +37,7 @@ public final class NaturesAura { @EventHandler public void preInit(FMLPreInitializationEvent event) { - new OurBlocks(); + new ModBlocks(); ModRegistry.preInit(event); proxy.preInit(event); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java new file mode 100644 index 00000000..7c1e264d --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java @@ -0,0 +1,152 @@ +package de.ellpeck.naturesaura.blocks; + +import de.ellpeck.naturesaura.NaturesAura; +import de.ellpeck.naturesaura.blocks.tiles.TileEntityAncientLeaves; +import de.ellpeck.naturesaura.reg.*; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.color.IBlockColor; +import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import javax.annotation.Nullable; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class BlockAncientLeaves extends BlockLeaves implements + IModItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem, ITileEntityProvider { + + public BlockAncientLeaves() { + this.leavesFancy = true; + ModRegistry.addItemOrBlock(this); + } + + @Override + public String getBaseName() { + return "ancient_leaves"; + } + + @Override + public boolean shouldAddCreative() { + return true; + } + + @Override + public void onPreInit(FMLPreInitializationEvent event) { + + } + + @Override + public void onInit(FMLInitializationEvent event) { + GameRegistry.registerTileEntity(TileEntityAncientLeaves.class, new ResourceLocation(NaturesAura.MOD_ID, "ancient_leaves")); + } + + @Override + public void onPostInit(FMLPostInitializationEvent event) { + + } + + @Override + public Map getModelLocations() { + return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); + } + + @Override + public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { + return Collections.singletonList(new ItemStack(this, 1, 0)); + } + + @Override + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, CHECK_DECAY, DECAYABLE); + } + + @Override + public IBlockState getStateFromMeta(int meta) { + boolean check = (meta & 1) != 0; + boolean decay = (meta & 2) != 0; + + return this.getDefaultState().withProperty(CHECK_DECAY, check).withProperty(DECAYABLE, decay); + } + + @Override + public int getMetaFromState(IBlockState state) { + boolean check = state.getValue(CHECK_DECAY); + boolean decay = state.getValue(DECAYABLE); + + return (check ? 1 : 0) | (decay ? 1 : 0) << 1; + } + + @Override + public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) { + if (!state.getValue(CHECK_DECAY) && state.getValue(DECAYABLE)) { + world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); + } + } + + @Override + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { + super.breakBlock(worldIn, pos, state); + worldIn.removeTileEntity(pos); + } + + @Override + public BlockPlanks.EnumType getWoodType(int meta) { + return null; + } + + @Nullable + @Override + public TileEntity createNewTileEntity(World worldIn, int meta) { + return new TileEntityAncientLeaves(); + } + + @Override + @SideOnly(Side.CLIENT) + public IBlockColor getBlockColor() { + return (state, worldIn, pos, tintIndex) -> 0xE480D9; + } + + @Override + @SideOnly(Side.CLIENT) + public IItemColor getItemColor() { + return (stack, tintIndex) -> 0xE480D9; + } + + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { + super.randomDisplayTick(stateIn, worldIn, pos, rand); + if (rand.nextFloat() >= 0.9F && !worldIn.getBlockState(pos.down()).isFullBlock()) { + NaturesAura.proxy.spawnMagicParticle(worldIn, + pos.getX() + rand.nextDouble(), pos.getY(), pos.getZ() + rand.nextDouble(), + 0F, 0F, 0F, 0xc46df9, + rand.nextFloat() * 2F + 0.5F, + rand.nextInt(100) + 150, + rand.nextFloat() * 0.05F + 0.005F, true); + + } + } + + @Override + public Item getItemDropped(IBlockState state, Random rand, int fortune) { + return Item.getItemFromBlock(ModBlocks.ANCIENT_SAPLING); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java new file mode 100644 index 00000000..ce94bed1 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java @@ -0,0 +1,69 @@ +package de.ellpeck.naturesaura.blocks; + +import de.ellpeck.naturesaura.NaturesAura; +import de.ellpeck.naturesaura.reg.IModItem; +import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; +import net.minecraft.block.BlockLog; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +import java.util.Collections; +import java.util.Map; + +public class BlockAncientLog extends BlockLog implements IModItem, IModelProvider { + + public BlockAncientLog() { + ModRegistry.addItemOrBlock(this); + } + + @Override + public String getBaseName() { + return "ancient_log"; + } + + @Override + public boolean shouldAddCreative() { + return true; + } + + @Override + public void onPreInit(FMLPreInitializationEvent event) { + + } + + @Override + public void onInit(FMLInitializationEvent event) { + + } + + @Override + public void onPostInit(FMLPostInitializationEvent event) { + + } + + @Override + public Map getModelLocations() { + return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); + } + + @Override + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, LOG_AXIS); + } + + @Override + public int getMetaFromState(IBlockState state) { + return state.getValue(LOG_AXIS).ordinal(); + } + + @Override + public IBlockState getStateFromMeta(int meta) { + return this.getDefaultState().withProperty(LOG_AXIS, EnumAxis.values()[meta]); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java new file mode 100644 index 00000000..461d49cf --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java @@ -0,0 +1,121 @@ +package de.ellpeck.naturesaura.blocks; + +import de.ellpeck.naturesaura.NaturesAura; +import de.ellpeck.naturesaura.gen.WorldGenAncientTree; +import de.ellpeck.naturesaura.reg.IModItem; +import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; +import net.minecraft.block.BlockBush; +import net.minecraft.block.BlockSapling; +import net.minecraft.block.IGrowable; +import net.minecraft.block.SoundType; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.event.terraingen.TerrainGen; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +import java.util.Collections; +import java.util.Map; +import java.util.Random; + +public class BlockAncientSapling extends BlockBush implements IGrowable, IModItem, IModelProvider { + + private static final AxisAlignedBB AABB = new AxisAlignedBB( + 0.09999999403953552D, 0.0D, 0.09999999403953552D, + 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); + + public BlockAncientSapling() { + this.setHardness(0.0F); + this.setSoundType(SoundType.PLANT); + + ModRegistry.addItemOrBlock(this); + } + + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + return AABB; + } + + @Override + public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { + if (!world.isRemote) { + super.updateTick(world, pos, state, rand); + + if (world.getLightFromNeighbors(pos.up()) >= 9 && rand.nextInt(7) == 0) { + this.grow(world, rand, pos, state); + } + } + } + + @Override + public Map getModelLocations() { + return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); + } + + @Override + public String getBaseName() { + return "ancient_sapling"; + } + + @Override + public boolean shouldAddCreative() { + return true; + } + + @Override + public void onPreInit(FMLPreInitializationEvent event) { + + } + + @Override + public void onInit(FMLInitializationEvent event) { + + } + + @Override + public void onPostInit(FMLPostInitializationEvent event) { + + } + + @Override + public IBlockState getStateFromMeta(int meta) { + return this.getDefaultState().withProperty(BlockSapling.STAGE, meta); + } + + @Override + public int getMetaFromState(IBlockState state) { + return state.getValue(BlockSapling.STAGE); + } + + @Override + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, BlockSapling.STAGE); + } + + @Override + public boolean canGrow(World world, BlockPos pos, IBlockState state, boolean isClient) { + return true; + } + + @Override + public boolean canUseBonemeal(World world, Random rand, BlockPos pos, IBlockState state) { + return world.rand.nextFloat() < 0.45F; + } + + @Override + public void grow(World world, Random rand, BlockPos pos, IBlockState state) { + if (state.getValue(BlockSapling.STAGE) == 0) { + world.setBlockState(pos, state.cycleProperty(BlockSapling.STAGE), 4); + } else if (TerrainGen.saplingGrowTree(world, rand, pos)) { + new WorldGenAncientTree(true).generate(world, rand, pos); + } + } +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java index 4e66dae0..14b6a374 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java @@ -5,6 +5,7 @@ import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -54,4 +55,9 @@ public class BlockImpl extends Block implements IModItem, IModelProvider { public Map getModelLocations() { return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); } + + @Override + public Block setSoundType(SoundType sound) { + return super.setSoundType(sound); + } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java new file mode 100644 index 00000000..226e0dc0 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java @@ -0,0 +1,13 @@ +package de.ellpeck.naturesaura.blocks; + +import net.minecraft.block.Block; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; + +public final class ModBlocks { + + public static final Block ANCIENT_LOG = new BlockAncientLog(); + public static final Block ANCIENT_BARK = new BlockImpl("ancient_bark", Material.WOOD).setSoundType(SoundType.WOOD).setHardness(2F); + public static final Block ANCIENT_LEAVES = new BlockAncientLeaves(); + public static final Block ANCIENT_SAPLING = new BlockAncientSapling(); +} diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/OurBlocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/OurBlocks.java deleted file mode 100644 index 6219a6e6..00000000 --- a/src/main/java/de/ellpeck/naturesaura/blocks/OurBlocks.java +++ /dev/null @@ -1,6 +0,0 @@ -package de.ellpeck.naturesaura.blocks; - -public final class OurBlocks { - - -} diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java new file mode 100644 index 00000000..fa4768af --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java @@ -0,0 +1,4 @@ +package de.ellpeck.naturesaura.blocks.tiles; + +public class TileEntityAncientLeaves extends TileEntityImpl { +} diff --git a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java new file mode 100644 index 00000000..eba50b32 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java @@ -0,0 +1,138 @@ +package de.ellpeck.naturesaura.gen; + +import de.ellpeck.naturesaura.blocks.ModBlocks; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockLog; +import net.minecraft.block.BlockLog.EnumAxis; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +import java.util.Random; + +public class WorldGenAncientTree extends WorldGenAbstractTree { + + public WorldGenAncientTree(boolean notify) { + super(notify); + } + + @Override + public boolean generate(World world, Random rand, BlockPos pos) { + int height = rand.nextInt(3) + 5; + BlockPos trunkTop = pos.up(height); + + //Roots + int rootsAmount = rand.nextInt(4) + 5; + for (int i = 0; i < rootsAmount; i++) { + int length = rand.nextInt(3) + 3; + float angle = 2F * (float) Math.PI * (i / (float) rootsAmount); + float x = (float) Math.sin(angle) * length; + float z = (float) Math.cos(angle) * length; + + BlockPos goal = pos.add(x, 0, z); + while (!world.getBlockState(goal).isFullBlock()) { + goal = goal.down(); + } + this.makeBranch(world, pos.up(rand.nextInt(1)), goal, ModBlocks.ANCIENT_BARK.getDefaultState(), false); + } + + //Trunk + for (int x = 0; x <= 1; x++) { + for (int z = 0; z <= 1; z++) { + for (int i = height - (x + z) * (rand.nextInt(2) + 2); i >= 0; i--) { + BlockPos goal = pos.add(x, i, z); + if (this.isReplaceable(world, goal)) { + this.setBlockAndNotifyAdequately(world, goal, + ModBlocks.ANCIENT_LOG.getDefaultState().withProperty(BlockLog.LOG_AXIS, EnumAxis.Y)); + } + } + } + } + this.makeLeaves(world, trunkTop.up(rand.nextInt(2) - 1), + ModBlocks.ANCIENT_LEAVES.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false), rand.nextInt(2) + 3, rand); + + //Branches + int branchAmount = rand.nextInt(3) + 4; + for (int i = 0; i < branchAmount; i++) { + int length = rand.nextInt(2) + 3; + float angle = 2F * (float) Math.PI * (i / (float) branchAmount); + float x = (float) Math.sin(angle) * length; + float z = (float) Math.cos(angle) * length; + + BlockPos goal = trunkTop.add(x, rand.nextInt(3) + 1, z); + this.makeBranch(world, trunkTop, goal, ModBlocks.ANCIENT_LOG.getDefaultState(), true); + this.makeLeaves(world, goal, + ModBlocks.ANCIENT_LEAVES.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false), rand.nextInt(2) + 2, rand); + } + + return true; + } + + @Override + protected boolean canGrowInto(Block blockType) { + if (super.canGrowInto(blockType)) { + return true; + } else { + Material material = blockType.getDefaultState().getMaterial(); + return material == Material.VINE || material == Material.PLANTS; + } + } + + private void makeBranch(World world, BlockPos first, BlockPos second, IBlockState state, boolean hasAxis) { + BlockPos pos = second.add(-first.getX(), -first.getY(), -first.getZ()); + int length = this.getHighestCoord(pos); + float stepX = (float) pos.getX() / (float) length; + float stepY = (float) pos.getY() / (float) length; + float stepZ = (float) pos.getZ() / (float) length; + + for (int i = 0; i <= length; i++) { + BlockPos goal = first.add((0.5F + i * stepX), (0.5F + i * stepY), (0.5F + i * stepZ)); + if (this.isReplaceable(world, goal)) { + if (hasAxis) { + EnumAxis axis = this.getLogAxis(first, goal); + this.setBlockAndNotifyAdequately(world, goal, state.withProperty(BlockLog.LOG_AXIS, axis)); + } else { + this.setBlockAndNotifyAdequately(world, goal, state); + } + } + } + } + + private void makeLeaves(World world, BlockPos pos, IBlockState state, int radius, Random rand) { + for (int x = -radius; x <= radius; x++) { + for (int y = -radius; y <= radius; y++) { + for (int z = -radius; z <= radius; z++) { + BlockPos goal = pos.add(x, y, z); + if (pos.distanceSq(goal) <= radius * radius + rand.nextInt(3) - 1) { + if (this.isReplaceable(world, goal) && !(world.getBlockState(goal).getBlock() instanceof BlockLog)) { + this.setBlockAndNotifyAdequately(world, goal, state); + } + } + } + } + } + } + + private int getHighestCoord(BlockPos pos) { + return Math.max(MathHelper.abs(pos.getX()), Math.max(MathHelper.abs(pos.getY()), MathHelper.abs(pos.getZ()))); + } + + private EnumAxis getLogAxis(BlockPos pos, BlockPos goal) { + EnumAxis axis = EnumAxis.Y; + int x = Math.abs(goal.getX() - pos.getX()); + int y = Math.abs(goal.getZ() - pos.getZ()); + int highest = Math.max(x, y); + if (highest > 0) { + if (x == highest) { + axis = EnumAxis.X; + } else if (y == highest) { + axis = EnumAxis.Z; + } + } + return axis; + } +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java b/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java index 507fa105..5b460c8b 100644 --- a/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java +++ b/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java @@ -12,7 +12,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ParticleMagic extends Particle { - public static final ResourceLocation TEXTURE = new ResourceLocation(NaturesAura.MOD_ID, "particle/magic_round"); + public static final ResourceLocation TEXTURE = new ResourceLocation(NaturesAura.MOD_ID, "particles/magic_round"); private final float desiredScale; diff --git a/src/main/resources/assets/naturesaura/blockstates/ancient_bark.json b/src/main/resources/assets/naturesaura/blockstates/ancient_bark.json new file mode 100644 index 00000000..b246fa24 --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/ancient_bark.json @@ -0,0 +1,14 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cube_all", + "textures": { + "all": "naturesaura:blocks/ancient_log" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/blockstates/ancient_leaves.json b/src/main/resources/assets/naturesaura/blockstates/ancient_leaves.json new file mode 100644 index 00000000..16d4cca9 --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/ancient_leaves.json @@ -0,0 +1,22 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:leaves", + "textures": { + "all": "naturesaura:blocks/ancient_leaves" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}], + "decayable": { + "true": {}, + "false": {} + }, + "check_decay": { + "true": {}, + "false": {} + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/blockstates/ancient_log.json b/src/main/resources/assets/naturesaura/blockstates/ancient_log.json new file mode 100644 index 00000000..4269ee94 --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/ancient_log.json @@ -0,0 +1,26 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cube_column", + "textures": { + "end": "naturesaura:blocks/ancient_log_top", + "side": "naturesaura:blocks/ancient_log" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}], + "axis": { + "y": {}, + "z": { + "x": 90 + }, + "x": { + "x": 90, + "y": 90 + }, + "none": {} + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/blockstates/ancient_sapling.json b/src/main/resources/assets/naturesaura/blockstates/ancient_sapling.json new file mode 100644 index 00000000..d6035c47 --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/ancient_sapling.json @@ -0,0 +1,26 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cross", + "textures": { + "cross": "naturesaura:blocks/ancient_sapling" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [ + { + "model": "builtin/generated", + "transform": "forge:default-item", + "textures": { + "layer0": "naturesaura:blocks/ancient_sapling" + } + } + ], + "stage": { + "0": {}, + "1": {} + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang new file mode 100644 index 00000000..217a8ebf --- /dev/null +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -0,0 +1,6 @@ +itemGroup.naturesaura=Nature's Aura + +tile.naturesaura.ancient_log.name=Ancient Log +tile.naturesaura.ancient_bark.name=Ancient Bark +tile.naturesaura.ancient_leaves.name=Ancient Leaves +tile.naturesaura.ancient_sapling.name=Ancient Sapling \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/blocks/ancient_leaves.png b/src/main/resources/assets/naturesaura/textures/blocks/ancient_leaves.png new file mode 100644 index 0000000000000000000000000000000000000000..266b9e775e6994c49de086c817aa53295163b380 GIT binary patch literal 407 zcmV;I0cie-P)N2bZe?^J zG%hhNF=Hy6O8@`?6-h)vR5(vD(J3q=sY3+T?ZNAXlsU)ndMr60m% zlK+3=w9Pn<Q_kDTLkQ2>=uIr+HU02-i`;K1QwoyYH1_&V%*#JQPq+tM81M;s8 zvXJRc25y3g_-jB>lWp7LzAQ_vxq-vNz@`Q7h)xZH5@EP)<6WsNf% z+@fx~?H6$mvs;TQ|@EArtp~k2_6`oT?b)Ppc0`0Rtxj z#dYEXco?7wWCJG>Y)1^kP#>5&xteO=N?FYBp2=|N!E=i+u*eyO2N-0r0y&xlSxDma zaes3SI3qWa;50?{N2bZe?^J zG%hhNF=Hy6O8@`?+(|@1R5(vfljlxCK@f%a8SFJN(!mH(i4C}yrdTjB@vpI91F=SY z0iVKPZ}BZhzJa~+<7SuHnRCvZ8O+A4Pp(&^a#xPa*O@DBa7Y^EX?ZzZl0tM$E(#&J zT8YSIF)R-|Nqys_=DV5|lM9bXJs*_DW?a(#Ug7uqaoQ{XILRm|AfKm>Y|l+704F5I z3HD3H3CnpdphYB7lno6lD_~Aw&{NP2K%PO;`pl%%vVO@&M)i>o0KhDOy`u){#n`y! znVV8fneo7~@Y&z@TX9V$j}`#n1XKY?qyN{Gk@NC9w_g`y{>0*Ez^FB9m~nG>VfE|~%_LN2h849II`S!J^u zw1&yQ^@5i}o25i&k*upoQU$Gzq<`2r*-ij{YB}}B8cjO@88N2bZe?^J zG%hhNF=Hy6O8@`?nn^@KR5(v^Poj<(ZubEzFz{N@1JDt<^^xojTxgu{-QL2SGwcs^e(%8TmdHA0PC5=Dgl8oY2 z2?&N!SKh;p+G!;9liatjy>l72FVugo6(oRl)a=ULW<&0`BDt@$`S*)ePzXhSZ-`z=6l zQx5gR^zPB)q0&^JyTR4g4&2yEpf}MGWI+e4jE7`ruiJ;Y9Pqb={gSfrM2QiH*q(Y8 eoEzSvqWl7174^ZB!z?ub00003m%lhL<1ILed(Oj$H_eKlF+gGtLo%9?EBI2UBWwTzW9qvAwbCUEcCWysGK^(d4? z|0MVy7H$nmpLiR6{z&$mW>9`~0QpQ3_pkS0GLyjM j5Stmj8nA?pOaAxPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E-_;&oJ#-z0kKI$K~y+TrISf7Ls1xpYpR8|N+p7%L(HXy zU{lpDTY@%NP+=p|goULkhBa1(AK_1)<9Sc-O>WE1;>ml?H=XZHA#3fw_|pho5Q9V$ zGk``Q3@x!O6X<|`YwReRLMLI?({XIW&L7ALCWnl*gJ_cAc~)IzTnM0f7ShDUQFR$C zVANs?mIzQn8ET9V&?;;~iMVA{aZzX%AgBjbdvj2PZ8(NAe3w!<_3RrI$zdO1-0OFs zY8hC8Eu3|>p~QQFAJJR%3a!hJZw<{57x6pL-X|arH8_VGc!e+gFX*-GjO8z&GicoF z!01q>sZ4uzA8o)B<4^d8cVeE=3)q7q1$3Z8tsNM5c)Q>_a4Q@8!T1gCJi7`gZVD1! z2ks1#puLqzJVLda_Wpn>S#zC11;4H|P4TE-pc`}xS&X`c9XK@BXvGEz4fF)mo%{Fdl=5dSQXOs>PJfTJKKJv4gCP)g(rlj?H