diff --git a/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java b/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java index d7967311..999df4f5 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java @@ -2,6 +2,8 @@ package de.ellpeck.naturesaura.entities; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; 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.entity.item.EntityMinecart; import net.minecraft.init.Blocks; @@ -40,6 +42,12 @@ public class EntityMoverMinecart extends EntityMinecart { if (!this.isActive) return; 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) return; diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index 61442bbc..fcedf5ac 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.packet; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; +import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import io.netty.buffer.ByteBuf; import net.minecraft.block.state.IBlockState; @@ -347,6 +348,18 @@ public class PacketParticles implements IMessage { world.rand.nextGaussian() * 0.01F, color, 1.5F, 40, 0F, false, true); 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; } } });