change the way the rose of oblivion releases its aura

This commit is contained in:
Ellpeck 2019-01-30 18:18:07 +01:00
parent a0b2a68728
commit 10765e17ea
3 changed files with 36 additions and 4 deletions

View file

@ -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<EntityItem> 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);

View file

@ -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;
}
}
});

View file

@ -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
}
]
}