List of usage examples for com.google.common.io ByteArrayDataInput readDouble
@Override
double readDouble();
From source file:nxminetilities.network.MultilightPacket.java
@Override public void read(ByteArrayDataInput in) throws ProtocolException { x = in.readInt();/* w ww.j a va 2 s . c o m*/ y = in.readInt(); z = in.readInt(); lightColourRed = in.readDouble(); lightColourGreen = in.readDouble(); lightColourBlue = in.readDouble(); lightEnabled = in.readBoolean(); }
From source file:buildcraft.core.EntityLaser.java
@Override public void readSpawnData(ByteArrayDataInput data) { head = new Position(data.readDouble(), data.readDouble(), data.readDouble()); tail = new Position(data.readDouble(), data.readDouble(), data.readDouble()); init();//from w w w. j av a2 s.co m }
From source file:buildcraft.factory.EntityMechanicalArm.java
@Override public void readSpawnData(ByteArrayDataInput data) { armSizeX = data.readDouble(); armSizeZ = data.readDouble();/*w w w . j av a2 s. co m*/ setArmSize(armSizeX, armSizeZ); updatePosition(); }
From source file:io.github.apfelcreme.LitePortals.Bukkit.Listener.BungeeMessageListener.java
/** * listenes to portal messages//from w w w .ja v a 2 s.co m * * @param s the channel * @param player ? * @param bytes the data */ public void onPluginMessageReceived(String s, Player player, byte[] bytes) { if (!s.equals("LitePortals")) { return; } ByteArrayDataInput in = ByteStreams.newDataInput(bytes); String subChannel = in.readUTF(); if (subChannel.equals("WARP")) { Player p = LitePortals.getInstance().getServer().getPlayer(UUID.fromString(in.readUTF())); Location location = new Location(Bukkit.getWorld(in.readUTF()), in.readDouble() + 0.5, in.readDouble() + 0.2, in.readDouble() + 0.5, (float) in.readDouble(), 0); if (p != null) { p.teleport(location); for (int i = 0; i < 10; i++) { p.getWorld().spigot().playEffect(location, Effect.PORTAL, 0, 0, (float) (-1 + Math.random() * 2), (float) (Math.random() * 2), (float) (-1 + Math.random() * 2), 0, 1, 50); } } } else if (subChannel.equals("POSITIONREQUEST")) { Player p = LitePortals.getInstance().getServer().getPlayer(UUID.fromString(in.readUTF())); if (p != null) { PortalStructure portalStructure = LitePortals.getPortalStructure(p.getLocation()); BungeeMessenger.getInstance().sendPlayerPositionMessage(p.getUniqueId(), portalStructure); } } }
From source file:io.github.apfelcreme.LitePortals.Bungee.Listener.BukkitMessageListener.java
/** * listener for the bukkit communication channel * * @param event an event object//from w ww .java 2 s. com * @throws IOException */ @EventHandler public void onPluginMessageReceived(PluginMessageEvent event) throws IOException { if (!event.getTag().equals("LitePortals")) { return; } if (!(event.getSender() instanceof Server)) { return; } ByteArrayDataInput in = ByteStreams.newDataInput(event.getData()); String subChannel = in.readUTF(); if (subChannel.equals("PORTALWASBUILT")) { Portal portal = new Portal(UUID.fromString(in.readUTF()), new Location(in.readUTF(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), in.readDouble())); portalWasBuilt(portal); } else if (subChannel.equals("PLAYERBROKEPORTAL")) { UUID breaker = UUID.fromString(in.readUTF()); Location location = new Location(in.readUTF(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), null); portalGotDestroyed(breaker, location); } else if (subChannel.equals("PLAYERUSEDPORTAL")) { UUID player = UUID.fromString(in.readUTF()); Location location = new Location(in.readUTF(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), null); Portal portal = PortalManager.getInstance().portalExists(location); teleport(player, portal); } else if (subChannel.equals("POSITIONANSWER")) { UUID player = UUID.fromString(in.readUTF()); boolean portalExists = in.readBoolean(); if (portalExists) { // there is a portal or a portal structure there Location location = new Location(in.readUTF(), in.readUTF(), in.readDouble(), in.readDouble(), in.readDouble(), null); printInfo(player, location); } else { LitePortals.sendMessage(player, LitePortalsConfig.getInstance().getText("error.notStandingInAPortal")); } } }
From source file:micdoodle8.mods.galacticraft.mars.entities.GCMarsEntityCargoRocket.java
@Override public void readNetworkedData(ByteArrayDataInput dataStream) { this.rocketType = EnumRocketType.values()[dataStream.readInt()]; super.readNetworkedData(dataStream); this.posX = dataStream.readDouble() / 8000.0D; this.posY = dataStream.readDouble() / 8000.0D; this.posZ = dataStream.readDouble() / 8000.0D; }
From source file:com.yogpc.qp.TileQuarry.java
@Override protected void C_recievePacket(final byte id, final byte[] data, final EntityPlayer ep) { super.C_recievePacket(id, data, ep); switch (id) { case PacketHandler.StC_NOW: this.now = data[0]; G_renew_powerConfigure();//from w w w . ja va 2 s . com this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); break; case PacketHandler.StC_HEAD_POS: final ByteArrayDataInput badi = ByteStreams.newDataInput(data); this.headPosX = badi.readDouble(); this.headPosY = badi.readDouble(); this.headPosZ = badi.readDouble(); break; } }
From source file:com.yogpc.qp.tile.TileQuarry.java
@Override public void C_recievePacket(final byte id, final byte[] data, final EntityPlayer ep) { super.C_recievePacket(id, data, ep); switch (id) { case PacketHandler.StC_NOW: this.now = data[0]; G_renew_powerConfigure();//from ww w .j a v a 2 s . co m this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); break; case PacketHandler.StC_HEAD_POS: final ByteArrayDataInput badi = ByteStreams.newDataInput(data); this.headPosX = badi.readDouble(); this.headPosY = badi.readDouble(); this.headPosZ = badi.readDouble(); break; } }
From source file:org.yogpstop.qp.TileQuarry.java
@Override protected void C_recievePacket(byte pattern, ByteArrayDataInput data, EntityPlayer ep) { super.C_recievePacket(pattern, data, ep); switch (pattern) { case StC_NOW: this.now = data.readByte(); G_renew_powerConfigure();/*from www . j a v a 2 s. c o m*/ this.worldObj.markBlockForRenderUpdate(this.xCoord, this.yCoord, this.zCoord); G_initEntities(); break; case StC_HEAD_POS: this.headPosX = data.readDouble(); this.headPosY = data.readDouble(); this.headPosZ = data.readDouble(); if (this.heads != null) this.heads.setHead(this.headPosX, this.headPosY, this.headPosZ); break; } }
From source file:micdoodle8.mods.galacticraft.core.entities.GCCoreEntityLander.java
@Override public void readNetworkedData(ByteArrayDataInput dataStream) { if (this.worldObj.isRemote) { int cargoLength = dataStream.readInt(); if (this.containedItems == null || this.containedItems.length == 0) { this.containedItems = new ItemStack[cargoLength]; PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL, EnumPacketServer.UPDATE_DYNAMIC_ENTITY_INV, new Object[] { this.entityId })); }/*from w w w. j ava 2 s.c o m*/ this.fuelTank.setFluid(new FluidStack(GalacticraftCore.fluidFuel, dataStream.readInt())); this.setWaitForPlayer(dataStream.readBoolean()); this.onGround = dataStream.readBoolean(); } else { this.motionX = dataStream.readDouble() / 8000.0D; this.motionY = dataStream.readDouble() / 8000.0D; this.motionZ = dataStream.readDouble() / 8000.0D; this.rotationPitch = dataStream.readFloat(); this.rotationYaw = dataStream.readFloat(); } }