mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-26 13:18:34 +01:00
added particles to the mover cart
This commit is contained in:
parent
10765e17ea
commit
8aef58566c
2 changed files with 21 additions and 0 deletions
|
@ -2,6 +2,8 @@ package de.ellpeck.naturesaura.entities;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||||
import de.ellpeck.naturesaura.items.ModItems;
|
import de.ellpeck.naturesaura.items.ModItems;
|
||||||
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.item.EntityMinecart;
|
import net.minecraft.entity.item.EntityMinecart;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
@ -40,6 +42,12 @@ public class EntityMoverMinecart extends EntityMinecart {
|
||||||
if (!this.isActive)
|
if (!this.isActive)
|
||||||
return;
|
return;
|
||||||
BlockPos pos = this.getPosition();
|
BlockPos pos = this.getPosition();
|
||||||
|
|
||||||
|
if (!this.spotOffsets.isEmpty() && this.world.getTotalWorldTime() % 10 == 0)
|
||||||
|
PacketHandler.sendToAllAround(this.world, pos, 32, new PacketParticles(
|
||||||
|
(float) this.posX, (float) this.posY, (float) this.posZ, 22,
|
||||||
|
MathHelper.floor(this.motionX * 100F), MathHelper.floor(this.motionY * 100F), MathHelper.floor(this.motionZ * 100F)));
|
||||||
|
|
||||||
if (pos.distanceSq(this.lastPosition) < 8 * 8)
|
if (pos.distanceSq(this.lastPosition) < 8 * 8)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.packet;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
|
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -347,6 +348,18 @@ public class PacketParticles implements IMessage {
|
||||||
world.rand.nextGaussian() * 0.01F,
|
world.rand.nextGaussian() * 0.01F,
|
||||||
color, 1.5F, 40, 0F, false, true);
|
color, 1.5F, 40, 0F, false, true);
|
||||||
break;
|
break;
|
||||||
|
case 22: // Mover cart
|
||||||
|
float motionX = message.data[0] / 100F;
|
||||||
|
float motionY = message.data[1] / 100F;
|
||||||
|
float motionZ = message.data[2] / 100F;
|
||||||
|
for (int i = world.rand.nextInt(60) + 30; i >= 0; i--)
|
||||||
|
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||||
|
message.posX + world.rand.nextGaussian() * 10F,
|
||||||
|
message.posY + world.rand.nextGaussian() * 10F,
|
||||||
|
message.posZ + world.rand.nextGaussian() * 10F,
|
||||||
|
motionX * 0.2F, motionY * 0.2F, motionZ * 0.2F,
|
||||||
|
IAuraType.forWorld(world).getColor(), 2F, 30, 0F, false, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue