From b90b5c9f8c9dde8f857b342815b4225d4f03d75b Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 4 Nov 2018 16:38:09 +0100 Subject: [PATCH] added the flower generator --- .../blocks/BlockContainerImpl.java | 49 +++++-- .../blocks/BlockFlowerGenerator.java | 13 ++ .../ellpeck/naturesaura/blocks/ModBlocks.java | 1 + .../blocks/tiles/TileEntityAncientLeaves.java | 14 +- .../tiles/TileEntityFlowerGenerator.java | 137 ++++++++++++++++++ .../blocks/tiles/TileEntityFurnaceHeater.java | 14 +- .../blocks/tiles/TileEntityImpl.java | 73 ++++++++-- .../blocks/tiles/TileEntityNatureAltar.java | 14 +- .../blocks/tiles/TileEntityWoodStand.java | 12 +- .../naturesaura/packet/PacketParticles.java | 23 +++ .../blockstates/flower_generator.json | 20 +++ .../assets/naturesaura/lang/en_US.lang | 1 + .../textures/blocks/flower_generator.png | Bin 0 -> 465 bytes .../textures/blocks/flower_generator_top.png | Bin 0 -> 426 bytes 14 files changed, 319 insertions(+), 52 deletions(-) create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java create mode 100644 src/main/resources/assets/naturesaura/blockstates/flower_generator.json create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/flower_generator.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/flower_generator_top.png diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java index 04d3824d..d1bc367a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java @@ -8,22 +8,22 @@ import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.NonNullList; 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.items.IItemHandler; import javax.annotation.Nullable; -import java.util.Collections; -import java.util.Map; public class BlockContainerImpl extends BlockContainer implements IModItem, IModelProvider { @@ -85,19 +85,36 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, IMod public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { TileEntity tile = worldIn.getTileEntity(pos); - if (tile instanceof TileEntityImpl) { - IItemHandler handler = ((TileEntityImpl) tile).getItemHandler(null); - if (handler != null) { - for (int i = 0; i < handler.getSlots(); i++) { - ItemStack stack = handler.getStackInSlot(i); - if (!stack.isEmpty()) { - EntityItem item = new EntityItem(worldIn, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); - worldIn.spawnEntity(item); - } - } - } - } + if (tile instanceof TileEntityImpl) + ((TileEntityImpl) tile).dropInventory(); } super.breakBlock(worldIn, pos, state); } + + @Override + public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + TileEntity tile = world.getTileEntity(pos); + if (tile instanceof TileEntityImpl) + drops.add(((TileEntityImpl) tile).getDrop(state, fortune)); + else + super.getDrops(drops, world, pos, state, fortune); + } + + @Override + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + return willHarvest || super.removedByPlayer(state, world, pos, player, false); + } + + @Override + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) { + super.harvestBlock(worldIn, player, pos, state, te, stack); + worldIn.setBlockToAir(pos); + } + + @Override + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { + TileEntity tile = worldIn.getTileEntity(pos); + if (tile instanceof TileEntityImpl) + ((TileEntityImpl) tile).loadDataOnPlace(stack); + } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java new file mode 100644 index 00000000..11187693 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java @@ -0,0 +1,13 @@ +package de.ellpeck.naturesaura.blocks; + +import de.ellpeck.naturesaura.blocks.tiles.TileEntityFlowerGenerator; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; + +public class BlockFlowerGenerator extends BlockContainerImpl { + public BlockFlowerGenerator() { + super(Material.WOOD, "flower_generator", TileEntityFlowerGenerator.class, "flower_generator"); + this.setSoundType(SoundType.WOOD); + this.setHardness(2F); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java index 3fcfac8c..af497ca0 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java @@ -28,4 +28,5 @@ public final class ModBlocks { public static final Block POTION_GENERATOR = new BlockPotionGenerator(); public static final Block AURA_DETECTOR = new BlockAuraDetector(); public static final Block CONVERSION_CATALYST = new BlockImpl("conversion_catalyst", Material.ROCK).setSoundType(SoundType.STONE).setHardness(2.5F); + public static final Block FLOWER_GENERATOR = new BlockFlowerGenerator(); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java index a7cf5f78..ec9f2682 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java @@ -29,14 +29,16 @@ public class TileEntityAncientLeaves extends TileEntityImpl { } @Override - public void writeNBT(NBTTagCompound compound, boolean syncing) { - super.writeNBT(compound, syncing); - this.container.writeNBT(compound); + public void writeNBT(NBTTagCompound compound, SaveType type) { + super.writeNBT(compound, type); + if (type != SaveType.BLOCK) + this.container.writeNBT(compound); } @Override - public void readNBT(NBTTagCompound compound, boolean syncing) { - super.readNBT(compound, syncing); - this.container.readNBT(compound); + public void readNBT(NBTTagCompound compound, SaveType type) { + super.readNBT(compound, type); + if (type != SaveType.BLOCK) + this.container.readNBT(compound); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java new file mode 100644 index 00000000..d926bc61 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java @@ -0,0 +1,137 @@ +package de.ellpeck.naturesaura.blocks.tiles; + +import de.ellpeck.naturesaura.Helper; +import de.ellpeck.naturesaura.aura.chunk.AuraChunk; +import de.ellpeck.naturesaura.packet.PacketHandler; +import de.ellpeck.naturesaura.packet.PacketParticleStream; +import de.ellpeck.naturesaura.packet.PacketParticles; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.state.IBlockState; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.ITickable; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.common.registry.ForgeRegistries; +import org.apache.commons.lang3.mutable.MutableInt; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickable { + + private static final List FLOWERS = new ArrayList<>(); + + static { + for (Block block : ForgeRegistries.BLOCKS) { + if (block instanceof BlockFlower) { + FLOWERS.addAll(block.getBlockState().getValidStates()); + } + } + } + + private final Map consumedRecently = new HashMap<>(); + + @Override + public void update() { + if (!this.world.isRemote && this.world.getTotalWorldTime() % 10 == 0) { + List possible = new ArrayList<>(); + int range = 3; + for (int x = -range; x <= range; x++) { + for (int z = -range; z <= range; z++) { + BlockPos offset = this.pos.add(x, 0, z); + IBlockState state = this.world.getBlockState(offset); + if (FLOWERS.contains(state)) { + possible.add(offset); + } + } + } + + if (possible.isEmpty()) + return; + + BlockPos pos = possible.get(this.world.rand.nextInt(possible.size())); + IBlockState state = this.world.getBlockState(pos); + MutableInt curr = this.consumedRecently.computeIfAbsent(state, s -> new MutableInt()); + + int toAdd = Math.max(0, 50 - curr.getValue()); + if (toAdd > 0) { + BlockPos auraPos = AuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos); + AuraChunk auraChunk = AuraChunk.getAuraChunk(this.world, auraPos); + auraChunk.storeAura(auraPos, toAdd); + } + + for (Map.Entry entry : this.consumedRecently.entrySet()) { + if (entry.getKey() != state) { + MutableInt val = entry.getValue(); + if (val.getValue() > 0) + val.subtract(1); + } + } + curr.add(5); + + this.world.setBlockToAir(pos); + + int color = Helper.blendColors(0x5ccc30, 0xe53c16, toAdd / 50F); + if (toAdd > 0) { + for (int i = this.world.rand.nextInt(5) + 5; i >= 0; i--) + PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream( + pos.getX() + 0.25F + this.world.rand.nextFloat() * 0.5F, + pos.getY() + 0.25F + this.world.rand.nextFloat() * 0.5F, + pos.getZ() + 0.25F + this.world.rand.nextFloat() * 0.5F, + this.pos.getX() + 0.25F + this.world.rand.nextFloat() * 0.5F, + this.pos.getY() + 0.25F + this.world.rand.nextFloat() * 0.5F, + this.pos.getZ() + 0.25F + this.world.rand.nextFloat() * 0.5F, + this.world.rand.nextFloat() * 0.01F + 0.05F, color, 1F + )); + PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 8)); + } + PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(pos.getX(), pos.getY(), pos.getZ(), 7, color)); + } + } + + @Override + public void writeNBT(NBTTagCompound compound, SaveType type) { + super.writeNBT(compound, type); + + if (type != SaveType.SYNC && !this.consumedRecently.isEmpty()) { + NBTTagList list = new NBTTagList(); + for (Map.Entry entry : this.consumedRecently.entrySet()) { + IBlockState state = entry.getKey(); + Block block = state.getBlock(); + + NBTTagCompound tag = new NBTTagCompound(); + tag.setString("block", block.getRegistryName().toString()); + tag.setInteger("meta", block.getMetaFromState(state)); + tag.setInteger("amount", entry.getValue().intValue()); + list.appendTag(tag); + } + compound.setTag("consumed_recently", list); + } + } + + @Override + public void readNBT(NBTTagCompound compound, SaveType type) { + super.readNBT(compound, type); + + if (type != SaveType.SYNC) { + this.consumedRecently.clear(); + + NBTTagList list = compound.getTagList("consumed_recently", 10); + for (NBTBase base : list) { + NBTTagCompound tag = (NBTTagCompound) base; + + Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(tag.getString("block"))); + if (block != null) { + IBlockState state = block.getStateFromMeta(tag.getInteger("meta")); + this.consumedRecently.put(state, new MutableInt(tag.getInteger("amount"))); + } + } + + } + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java index 39258491..04ef9445 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java @@ -51,7 +51,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable } } - if(did != this.isActive){ + if (did != this.isActive) { this.isActive = did; this.sendToClients(); } @@ -75,18 +75,18 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable } @Override - public void writeNBT(NBTTagCompound compound, boolean syncing) { - super.writeNBT(compound, syncing); + public void writeNBT(NBTTagCompound compound, SaveType type) { + super.writeNBT(compound, type); - if (syncing) + if (type == SaveType.SYNC) compound.setBoolean("active", this.isActive); } @Override - public void readNBT(NBTTagCompound compound, boolean syncing) { - super.readNBT(compound, syncing); + public void readNBT(NBTTagCompound compound, SaveType type) { + super.readNBT(compound, type); - if (syncing) + if (type == SaveType.SYNC) this.isActive = compound.getBoolean("active"); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java index c467e5b4..2594f045 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java @@ -2,7 +2,10 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.aura.Capabilities; import de.ellpeck.naturesaura.aura.container.IAuraContainer; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; @@ -14,6 +17,7 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import javax.annotation.Nullable; @@ -26,46 +30,48 @@ public class TileEntityImpl extends TileEntity { @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { - this.writeNBT(compound, false); + this.writeNBT(compound, SaveType.TILE); return compound; } @Override public void readFromNBT(NBTTagCompound compound) { - this.readNBT(compound, false); + this.readNBT(compound, SaveType.TILE); } - public void writeNBT(NBTTagCompound compound, boolean syncing) { - super.writeToNBT(compound); + public void writeNBT(NBTTagCompound compound, SaveType type) { + if (type != SaveType.BLOCK) + super.writeToNBT(compound); } - public void readNBT(NBTTagCompound compound, boolean syncing) { - super.readFromNBT(compound); + public void readNBT(NBTTagCompound compound, SaveType type) { + if (type != SaveType.BLOCK) + super.readFromNBT(compound); } @Override public final SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound compound = new NBTTagCompound(); - this.writeNBT(compound, true); + this.writeNBT(compound, SaveType.SYNC); return new SPacketUpdateTileEntity(this.pos, 0, compound); } @Override public final NBTTagCompound getUpdateTag() { NBTTagCompound compound = new NBTTagCompound(); - this.writeNBT(compound, true); + this.writeNBT(compound, SaveType.SYNC); return compound; } @Override public void handleUpdateTag(NBTTagCompound tag) { - this.readNBT(tag, true); + this.readNBT(tag, SaveType.SYNC); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) { super.onDataPacket(net, packet); - this.readNBT(packet.getNbtCompound(), true); + this.readNBT(packet.getNbtCompound(), SaveType.SYNC); } public void sendToClients() { @@ -106,4 +112,51 @@ public class TileEntityImpl extends TileEntity { return super.getCapability(capability, facing); } } + + public void dropInventory() { + IItemHandler handler = this.getItemHandler(null); + if (handler != null) { + for (int i = 0; i < handler.getSlots(); i++) { + ItemStack stack = handler.getStackInSlot(i); + if (!stack.isEmpty()) { + EntityItem item = new EntityItem(this.world, + this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5, + stack); + this.world.spawnEntity(item); + } + } + } + } + + public ItemStack getDrop(IBlockState state, int fortune) { + Block block = state.getBlock(); + ItemStack stack = new ItemStack( + block.getItemDropped(state, this.world.rand, fortune), + block.quantityDropped(state, fortune, this.world.rand), + block.damageDropped(state)); + + NBTTagCompound compound = new NBTTagCompound(); + this.writeNBT(compound, SaveType.BLOCK); + + if (!compound.isEmpty()) { + stack.setTagCompound(new NBTTagCompound()); + stack.getTagCompound().setTag("data", compound); + } + + return stack; + } + + public void loadDataOnPlace(ItemStack stack) { + if (stack.hasTagCompound()) { + NBTTagCompound compound = stack.getTagCompound().getCompoundTag("data"); + if (compound != null) + this.readNBT(compound, SaveType.BLOCK); + } + } + + public enum SaveType { + TILE, + SYNC, + BLOCK + } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java index 204b7413..3dae548f 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java @@ -40,7 +40,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { @Override protected boolean canExtract(ItemStack stack, int slot, int amount) { - if(stack.hasCapability(Capabilities.auraContainer, null)) + if (stack.hasCapability(Capabilities.auraContainer, null)) return stack.getCapability(Capabilities.auraContainer, null).storeAura(1, true) <= 0; else return AltarRecipe.forInput(stack) == null; @@ -186,13 +186,13 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { } @Override - public void writeNBT(NBTTagCompound compound, boolean syncing) { - super.writeNBT(compound, syncing); + public void writeNBT(NBTTagCompound compound, SaveType type) { + super.writeNBT(compound, type); compound.setTag("items", this.items.serializeNBT()); compound.setBoolean("fine", this.structureFine); this.container.writeNBT(compound); - if (!syncing) { + if (type == SaveType.TILE) { if (this.currentRecipe != null) { compound.setString("recipe", this.currentRecipe.name.toString()); compound.setInteger("timer", this.timer); @@ -201,13 +201,13 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { } @Override - public void readNBT(NBTTagCompound compound, boolean syncing) { - super.readNBT(compound, syncing); + public void readNBT(NBTTagCompound compound, SaveType type) { + super.readNBT(compound, type); this.items.deserializeNBT(compound.getCompoundTag("items")); this.structureFine = compound.getBoolean("fine"); this.container.readNBT(compound); - if (!syncing) { + if (type == SaveType.TILE) { if (compound.hasKey("recipe")) { this.currentRecipe = AltarRecipe.RECIPES.get(new ResourceLocation(compound.getString("recipe"))); this.timer = compound.getInteger("timer"); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java index fd81b268..ffebf9fc 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java @@ -163,11 +163,11 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { } @Override - public void writeNBT(NBTTagCompound compound, boolean syncing) { - super.writeNBT(compound, syncing); + public void writeNBT(NBTTagCompound compound, SaveType type) { + super.writeNBT(compound, type); compound.setTag("items", this.items.serializeNBT()); - if (!syncing) { + if (type == SaveType.TILE) { if (this.ritualPos != null && this.recipe != null) { compound.setLong("ritual_pos", this.ritualPos.toLong()); compound.setInteger("timer", this.timer); @@ -177,11 +177,11 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { } @Override - public void readNBT(NBTTagCompound compound, boolean syncing) { - super.readNBT(compound, syncing); + public void readNBT(NBTTagCompound compound, SaveType type) { + super.readNBT(compound, type); this.items.deserializeNBT(compound.getCompoundTag("items")); - if (!syncing) { + if (type == SaveType.TILE) { if (compound.hasKey("recipe")) { this.ritualPos = BlockPos.fromLong(compound.getLong("ritual_pos")); this.timer = compound.getInteger("timer"); diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index df2aae0c..8ee97960 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -154,6 +154,29 @@ public class PacketParticles implements IMessage { 0x5ccc30, 1F + world.rand.nextFloat() * 2F, 100, 0F, false, true); break; + case 7: // Flower generator consumation + color = message.data[0]; + for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) + NaturesAura.proxy.spawnMagicParticle(world, + message.posX + 0.25F + world.rand.nextFloat() * 0.5F, + message.posY + 0.25F + world.rand.nextFloat() * 0.5F, + message.posZ + 0.25F + world.rand.nextFloat() * 0.5F, + world.rand.nextGaussian() * 0.01F, + world.rand.nextGaussian() * 0.01F, + world.rand.nextGaussian() * 0.01F, + color, world.rand.nextFloat() * 2F + 1F, 50, 0F, false, true); + break; + case 8: // Flower generator aura creation + for (int i = world.rand.nextInt(10) + 5; i >= 0; i--) + NaturesAura.proxy.spawnMagicParticle(world, + message.posX + 0.25F + world.rand.nextFloat() * 0.5F, + message.posY + 1.01F, + message.posZ + 0.25F + world.rand.nextFloat() * 0.5F, + world.rand.nextGaussian() * 0.005F, + world.rand.nextFloat() * 0.02F + 0.01F, + world.rand.nextGaussian() * 0.005F, + 0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 80, 0F, false, true); + break; } } }); diff --git a/src/main/resources/assets/naturesaura/blockstates/flower_generator.json b/src/main/resources/assets/naturesaura/blockstates/flower_generator.json new file mode 100644 index 00000000..6af981fb --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/flower_generator.json @@ -0,0 +1,20 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cube", + "textures": { + "particle": "naturesaura:blocks/flower_generator", + "up": "naturesaura:blocks/flower_generator_top", + "down": "naturesaura:blocks/flower_generator_top", + "north": "#particle", + "east": "#particle", + "south": "#particle", + "west": "#particle" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}] + } +} \ 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 index 7f6a0305..cccecf0b 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -25,6 +25,7 @@ tile.naturesaura.infused_brick.name=Infused Brick tile.naturesaura.infused_brick_stairs.name=Infused Brick Stairs tile.naturesaura.infused_brick_slab.name=Infused Brick Slab tile.naturesaura.infused_brick_slab_double.name=Infused Brick Double Slab +tile.naturesaura.flower_generator.name=Herbivorous Absorber item.naturesaura.eye.name=Environmental Eye item.naturesaura.gold_fiber.name=Brilliant Fiber diff --git a/src/main/resources/assets/naturesaura/textures/blocks/flower_generator.png b/src/main/resources/assets/naturesaura/textures/blocks/flower_generator.png new file mode 100644 index 0000000000000000000000000000000000000000..b0a4114cea59357310ea27ad10564af37533e1da GIT binary patch literal 465 zcmV;?0WSWDP)<{97<5HgbW?9;ba!ELWdLwtX>N2bZe?^J zG%hhNF=Hy6O8@`?Pf0{UR5(wSlf6m`c$iDwBa$zy&d`6iFgRXcHSzOV`u{xDwca z*rKo3Ka<{97<5HgbW?9;ba!ELWdLwtX>N2bZe?^J zG%hhNF=Hy6O8@`?C`m*?R5(wSlRs(#K^VpN7>dG%ZOjEM1R+HAqq(ok|rRe zNJ?89FW`;rJVVYg@_X=>&(SSXyxsTxd2i>NnJt#XP6Df8H_Zoa!Q3@KJn6UU9_NeC z=Q8bndcx?bo!;N7n)6=F$}}B!#ecsZ#p!{g)e52kZyMko}Moyze zc^;1TY6Oa&E#DL8>Deqx8E6Dt5aUXb`h09OJV5H}f6iw49R!82ii zYc2%)(^@reF3<=(>`0N=A`6Y}_(30W|CIs2fUh(eP{Y6@HyT7ygipaE%fOomyotuW z>l+P->th67p3Qj2JVLnd0osC%p~*!z=OXiXjA-kte6KNbeyZF+D~L1y|CjEh3wn0; UP3v^Lg8%>k07*qoM6N<$f(6vB*8l(j literal 0 HcmV?d00001