com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket Java Examples
The following examples show how to use
com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpawnParticleEffectSerializer_v354.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { buffer.writeByte(packet.getDimensionId()); VarInts.writeLong(buffer, packet.getUniqueEntityId()); BedrockUtils.writeVector3f(buffer, packet.getPosition()); BedrockUtils.writeString(buffer, packet.getIdentifier()); }
Example #2
Source File: SpawnParticleEffectSerializer_v354.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void deserialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { packet.setDimensionId(buffer.readUnsignedByte()); packet.setUniqueEntityId(VarInts.readLong(buffer)); packet.setPosition(BedrockUtils.readVector3f(buffer)); packet.setIdentifier(BedrockUtils.readString(buffer)); }
Example #3
Source File: SpawnParticleEffectSerializer_v388.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { buffer.writeByte(packet.getDimensionId()); VarInts.writeLong(buffer, packet.getUniqueEntityId()); BedrockUtils.writeVector3f(buffer, packet.getPosition()); BedrockUtils.writeString(buffer, packet.getIdentifier()); }
Example #4
Source File: SpawnParticleEffectSerializer_v388.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void deserialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { packet.setDimensionId(buffer.readUnsignedByte()); packet.setUniqueEntityId(VarInts.readLong(buffer)); packet.setPosition(BedrockUtils.readVector3f(buffer)); packet.setIdentifier(BedrockUtils.readString(buffer)); }
Example #5
Source File: SpawnParticleEffectSerializer_v340.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { buffer.writeByte(packet.getDimensionId()); VarInts.writeLong(buffer, packet.getUniqueEntityId()); BedrockUtils.writeVector3f(buffer, packet.getPosition()); BedrockUtils.writeString(buffer, packet.getIdentifier()); }
Example #6
Source File: SpawnParticleEffectSerializer_v340.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void deserialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { packet.setDimensionId(buffer.readUnsignedByte()); packet.setUniqueEntityId(VarInts.readLong(buffer)); packet.setPosition(BedrockUtils.readVector3f(buffer)); packet.setIdentifier(BedrockUtils.readString(buffer)); }
Example #7
Source File: SpawnParticleEffectSerializer_v361.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { buffer.writeByte(packet.getDimensionId()); VarInts.writeLong(buffer, packet.getUniqueEntityId()); BedrockUtils.writeVector3f(buffer, packet.getPosition()); BedrockUtils.writeString(buffer, packet.getIdentifier()); }
Example #8
Source File: SpawnParticleEffectSerializer_v361.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void deserialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { packet.setDimensionId(buffer.readUnsignedByte()); packet.setUniqueEntityId(VarInts.readLong(buffer)); packet.setPosition(BedrockUtils.readVector3f(buffer)); packet.setIdentifier(BedrockUtils.readString(buffer)); }
Example #9
Source File: SpawnParticleEffectSerializer_v332.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { buffer.writeByte(packet.getDimensionId()); VarInts.writeLong(buffer, packet.getUniqueEntityId()); BedrockUtils.writeVector3f(buffer, packet.getPosition()); BedrockUtils.writeString(buffer, packet.getIdentifier()); }
Example #10
Source File: SpawnParticleEffectSerializer_v332.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void deserialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { packet.setDimensionId(buffer.readUnsignedByte()); packet.setUniqueEntityId(VarInts.readLong(buffer)); packet.setPosition(BedrockUtils.readVector3f(buffer)); packet.setIdentifier(BedrockUtils.readString(buffer)); }
Example #11
Source File: JavaSpawnParticleTranslator.java From Geyser with MIT License | 4 votes |
@Override public void translate(ServerSpawnParticlePacket packet, GeyserSession session) { LevelEventPacket particle = new LevelEventPacket(); switch (packet.getParticle().getType()) { case BLOCK: particle.setType(LevelEventType.DESTROY); particle.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ())); particle.setData(BlockTranslator.getBedrockBlockId(((BlockParticleData) packet.getParticle().getData()).getBlockState())); session.sendUpstreamPacket(particle); break; case FALLING_DUST: //In fact, FallingDustParticle should have data like DustParticle, //but in MCProtocol, its data is BlockState(1). particle.setType(LevelEventType.PARTICLE_FALLING_DUST); particle.setData(BlockTranslator.getBedrockBlockId(((FallingDustParticleData)packet.getParticle().getData()).getBlockState())); particle.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ())); session.sendUpstreamPacket(particle); break; case ITEM: ItemStack javaItem = ((ItemParticleData)packet.getParticle().getData()).getItemStack(); ItemData bedrockItem = ItemTranslator.translateToBedrock(session, javaItem); int id = bedrockItem.getId(); short damage = bedrockItem.getDamage(); particle.setType(LevelEventType.PARTICLE_ITEM_BREAK); particle.setData(id << 16 | damage); particle.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ())); session.sendUpstreamPacket(particle); break; case DUST: DustParticleData data = (DustParticleData)packet.getParticle().getData(); int r = (int) (data.getRed()*255); int g = (int) (data.getGreen()*255); int b = (int) (data.getBlue()*255); particle.setType(LevelEventType.PARTICLE_FALLING_DUST); particle.setData(((0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff)); particle.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ())); session.sendUpstreamPacket(particle); break; default: LevelEventType typeParticle = EffectRegistry.getParticleLevelEventType(packet.getParticle().getType()); if (typeParticle != null) { particle.setType(typeParticle); particle.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ())); session.sendUpstreamPacket(particle); } else { String stringParticle = EffectRegistry.getParticleString(packet.getParticle().getType()); if (stringParticle != null) { SpawnParticleEffectPacket stringPacket = new SpawnParticleEffectPacket(); stringPacket.setIdentifier(stringParticle); stringPacket.setDimensionId(session.getPlayerEntity().getDimension()); stringPacket.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ())); session.sendUpstreamPacket(stringPacket); } } break; } }
Example #12
Source File: SpawnParticleEffectSerializer_v313.java From Protocol with Apache License 2.0 | 4 votes |
@Override public void serialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { buffer.writeByte(packet.getDimensionId()); BedrockUtils.writeVector3f(buffer, packet.getPosition()); BedrockUtils.writeString(buffer, packet.getIdentifier()); }
Example #13
Source File: SpawnParticleEffectSerializer_v313.java From Protocol with Apache License 2.0 | 4 votes |
@Override public void deserialize(ByteBuf buffer, SpawnParticleEffectPacket packet) { packet.setDimensionId(buffer.readUnsignedByte()); packet.setPosition(BedrockUtils.readVector3f(buffer)); packet.setIdentifier(BedrockUtils.readString(buffer)); }