diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java index 3029bf56..19ef6dff 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java @@ -6,12 +6,19 @@ import de.ellpeck.naturesaura.api.aura.container.BasicAuraContainer; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; +import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EntitySelectors; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import java.util.List; + public class TileEntityEndFlower extends TileEntityImpl implements ITickable { private final BasicAuraContainer container = new BasicAuraContainer(null, 500000) { @@ -47,9 +54,24 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickable { return; if (!this.isDrainMode) { - int amount = IAuraChunk.getAuraInArea(this.world, this.pos, 30); - if (amount < IAuraChunk.DEFAULT_AURA) + List items = this.world.getEntitiesWithinAABB(EntityItem.class, + new AxisAlignedBB(this.pos).grow(1), EntitySelectors.IS_ALIVE); + for (EntityItem item : items) { + if (item.cannotPickup()) + continue; + ItemStack stack = item.getItem(); + if (stack.getCount() != 1) + continue; + if (stack.getItem() != Items.ENDER_EYE) + continue; + this.isDrainMode = true; + item.setDead(); + + PacketHandler.sendToAllAround(this.world, this.pos, 32, + new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 21, this.container.getAuraColor())); + break; + } } else { int toDrain = Math.min(5000, this.container.getStoredAura()); this.container.drainAura(toDrain, false); diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index c396006d..61442bbc 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -1,6 +1,5 @@ package de.ellpeck.naturesaura.packet; -import de.ellpeck.naturesaura.ModConfig; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; @@ -338,6 +337,16 @@ public class PacketParticles implements IMessage { return true; }); break; + case 21: // End flower item consuming + color = message.data[0]; + for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) + NaturesAuraAPI.instance().spawnMagicParticle( + message.posX, message.posY + 0.5F, message.posZ, + world.rand.nextGaussian() * 0.01F, + world.rand.nextFloat() * 0.01F, + world.rand.nextGaussian() * 0.01F, + color, 1.5F, 40, 0F, false, true); + break; } } }); diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/end_flower.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/end_flower.json index e1f61621..944302cd 100644 --- a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/end_flower.json +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/end_flower.json @@ -11,7 +11,8 @@ { "type": "spotlight", "item": "naturesaura:end_flower", - "text": "These flowers bear very large amounts of $(aura) that they $(thing)disperse$() in an interesting way: Initially, they will do nothing; however, if there is even the slightest bit of $(aura) missing from the area, they will start slowly feeding their $(aura) into the environment, dying after all of it is drained. During this process, they can neither be stopped, nor harvested." + "text": "This flower bears very large amounts of $(aura) that can be harvested in an interesting way: Dropping an $(item)Ender Eye$() on the ground close to it will cause the rose to consume it and start dispersing its $(aura) into the environment. During this process, it can neither be stopped, nor harvested.", + "link_recipe": true } ] } \ No newline at end of file