From d2ab31607246de8aa8ec6868f5cc856bfda91357 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 9 Feb 2020 12:25:13 -0500 Subject: [PATCH] ?? --- .../java/main/mindustry/gen/Call.java | 1132 ----------------- 1 file changed, 1132 deletions(-) delete mode 100644 core/build/generated/sources/annotationProcessor/java/main/mindustry/gen/Call.java diff --git a/core/build/generated/sources/annotationProcessor/java/main/mindustry/gen/Call.java b/core/build/generated/sources/annotationProcessor/java/main/mindustry/gen/Call.java deleted file mode 100644 index 3003d832ff..0000000000 --- a/core/build/generated/sources/annotationProcessor/java/main/mindustry/gen/Call.java +++ /dev/null @@ -1,1132 +0,0 @@ -package mindustry.gen; - -import java.lang.String; -import java.nio.ByteBuffer; -import mindustry.entities.bullet.BulletType; -import mindustry.entities.units.BuildRequest; -import mindustry.game.Rules; -import mindustry.game.Team; -import mindustry.net.Administration; -import mindustry.net.NetConnection; -import mindustry.net.Packets; -import mindustry.type.Item; -import mindustry.world.Block; -import mindustry.world.Tile; - -/** - * Autogenerated file. Do not modify! - */ -public class Call { - private static final ByteBuffer TEMP_BUFFER = ByteBuffer.allocate(4096); - - public static synchronized void beginBreak(Team team, int x, int y) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.Build.beginBreak(team, x, y); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)0; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); - TEMP_BUFFER.putInt(x); - TEMP_BUFFER.putInt(y); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void beginPlace(Team team, int x, int y, Block result, int rotation) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.Build.beginPlace(team, x, y, result, rotation); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)1; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); - TEMP_BUFFER.putInt(x); - TEMP_BUFFER.putInt(y); - mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, result); - TEMP_BUFFER.putInt(rotation); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void connectConfirm() { - if(mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)2; - TEMP_BUFFER.position(0); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void createBullet(BulletType type, Team team, float x, float y, - float angle, float damage, float velocityScl, float lifetimeScl) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.entities.bullet.BulletType.createBullet(type, team, x, y, angle, damage, velocityScl, lifetimeScl); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)3; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeBulletType(TEMP_BUFFER, type); - mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); - TEMP_BUFFER.putFloat(x); - TEMP_BUFFER.putFloat(y); - TEMP_BUFFER.putFloat(angle); - TEMP_BUFFER.putFloat(damage); - TEMP_BUFFER.putFloat(velocityScl); - TEMP_BUFFER.putFloat(lifetimeScl); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void dropItem(float angle) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.input.InputHandler.dropItem(mindustry.Vars.player, angle); - } - if(mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)4; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putFloat(angle); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void launchZone() { - mindustry.core.Logic.launchZone(); - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)5; - TEMP_BUFFER.position(0); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onAdminRequest(Playerc other, Packets.AdminAction action) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.core.NetServer.onAdminRequest(mindustry.Vars.player, other, action); - } - if(mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)6; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, other); - mindustry.io.TypeIO.writeAction(TEMP_BUFFER, action); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onBlockSnapshot(short amount, short dataLen, byte[] data) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)2; - packet.type = (byte)7; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putShort(amount); - TEMP_BUFFER.putShort(dataLen); - mindustry.io.TypeIO.writeBytes(TEMP_BUFFER, data); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void onBlockSnapshot(NetConnection playerConnection, short amount, - short dataLen, byte[] data) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)2; - packet.type = (byte)7; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putShort(amount); - TEMP_BUFFER.putShort(dataLen); - mindustry.io.TypeIO.writeBytes(TEMP_BUFFER, data); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void onClientShapshot(int snapshotID, float x, float y, float pointerX, - float pointerY, float rotation, float baseRotation, float xVelocity, float yVelocity, - Tile mining, boolean boosting, boolean shooting, boolean chatting, BuildRequest[] requests, - float viewX, float viewY, float viewWidth, float viewHeight) { - if(mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)8; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putInt(snapshotID); - TEMP_BUFFER.putFloat(x); - TEMP_BUFFER.putFloat(y); - TEMP_BUFFER.putFloat(pointerX); - TEMP_BUFFER.putFloat(pointerY); - TEMP_BUFFER.putFloat(rotation); - TEMP_BUFFER.putFloat(baseRotation); - TEMP_BUFFER.putFloat(xVelocity); - TEMP_BUFFER.putFloat(yVelocity); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, mining); - TEMP_BUFFER.put(boosting ? (byte)1 : 0); - TEMP_BUFFER.put(shooting ? (byte)1 : 0); - TEMP_BUFFER.put(chatting ? (byte)1 : 0); - mindustry.io.TypeIO.writeRequests(TEMP_BUFFER, requests); - TEMP_BUFFER.putFloat(viewX); - TEMP_BUFFER.putFloat(viewY); - TEMP_BUFFER.putFloat(viewWidth); - TEMP_BUFFER.putFloat(viewHeight); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void onConnect(NetConnection playerConnection, String ip, int port) { - if(mindustry.Vars.net.client() || !mindustry.Vars.net.active()) { - mindustry.core.NetClient.onConnect(ip, port); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)9; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, ip); - TEMP_BUFFER.putInt(port); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onConstructFinish(Tile tile, Block block, int builderID, - byte rotation, Team team, boolean skipConfig) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.blocks.BuildBlock.onConstructFinish(tile, block, builderID, rotation, team, skipConfig); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)10; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, block); - TEMP_BUFFER.putInt(builderID); - TEMP_BUFFER.put(rotation); - mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); - TEMP_BUFFER.put(skipConfig ? (byte)1 : 0); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onDeconstructFinish(Tile tile, Block block, int builderID) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.blocks.BuildBlock.onDeconstructFinish(tile, block, builderID); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)11; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, block); - TEMP_BUFFER.putInt(builderID); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onDoorToggle(Playerc player, Tile tile, boolean open) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.blocks.defense.Door.onDoorToggle(player, tile, open); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)12; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - TEMP_BUFFER.put(open ? (byte)1 : 0); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onEntitySnapshot(NetConnection playerConnection, short amount, - short dataLen, byte[] data) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)2; - packet.type = (byte)13; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putShort(amount); - TEMP_BUFFER.putShort(dataLen); - mindustry.io.TypeIO.writeBytes(TEMP_BUFFER, data); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void onGameOver(Team winner) { - mindustry.core.Logic.onGameOver(winner); - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)14; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, winner); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onInfoMessage(String message) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)15; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onInfoMessage(NetConnection playerConnection, String message) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)15; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onInfoPopup(String message, float duration, int align, int top, - int left, int bottom, int right) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)16; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - TEMP_BUFFER.putFloat(duration); - TEMP_BUFFER.putInt(align); - TEMP_BUFFER.putInt(top); - TEMP_BUFFER.putInt(left); - TEMP_BUFFER.putInt(bottom); - TEMP_BUFFER.putInt(right); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onInfoPopup(NetConnection playerConnection, String message, - float duration, int align, int top, int left, int bottom, int right) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)16; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - TEMP_BUFFER.putFloat(duration); - TEMP_BUFFER.putInt(align); - TEMP_BUFFER.putInt(top); - TEMP_BUFFER.putInt(left); - TEMP_BUFFER.putInt(bottom); - TEMP_BUFFER.putInt(right); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onInfoToast(String message, float duration) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)17; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - TEMP_BUFFER.putFloat(duration); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onInfoToast(NetConnection playerConnection, String message, - float duration) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)17; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - TEMP_BUFFER.putFloat(duration); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onKick(NetConnection playerConnection, String reason) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)1; - packet.type = (byte)18; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, reason); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onKick(NetConnection playerConnection, - Packets.KickReason reason) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)1; - packet.type = (byte)19; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeKick(TEMP_BUFFER, reason); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onLabel(String info, float duration, float worldx, float worldy) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)20; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, info); - TEMP_BUFFER.putFloat(duration); - TEMP_BUFFER.putFloat(worldx); - TEMP_BUFFER.putFloat(worldy); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onLabel(NetConnection playerConnection, String info, - float duration, float worldx, float worldy) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)20; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, info); - TEMP_BUFFER.putFloat(duration); - TEMP_BUFFER.putFloat(worldx); - TEMP_BUFFER.putFloat(worldy); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onMechFactoryDone(Tile tile) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.blocks.units.MechPad.onMechFactoryDone(tile); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)21; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onMechFactoryTap(Playerc player, Tile tile) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.blocks.units.MechPad.onMechFactoryTap(player, tile); - } - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)22; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onPing(long time) { - if(mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)23; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putLong(time); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onPingResponse(NetConnection playerConnection, long time) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)24; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putLong(time); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onPlayerDisconnect(int playerid) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)25; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putInt(playerid); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onPositionSet(NetConnection playerConnection, float x, float y) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)26; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putFloat(x); - TEMP_BUFFER.putFloat(y); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onSetRules(Rules rules) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)27; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeRules(TEMP_BUFFER, rules); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onSetRules(NetConnection playerConnection, Rules rules) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)27; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeRules(TEMP_BUFFER, rules); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onStateSnapshot(NetConnection playerConnection, float waveTime, - int wave, int enemies, short coreDataLen, byte[] coreData) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)2; - packet.type = (byte)28; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putFloat(waveTime); - TEMP_BUFFER.putInt(wave); - TEMP_BUFFER.putInt(enemies); - TEMP_BUFFER.putShort(coreDataLen); - mindustry.io.TypeIO.writeBytes(TEMP_BUFFER, coreData); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void onTileConfig(Playerc player, Tile tile, int value) { - mindustry.input.InputHandler.onTileConfig(player, tile, value); - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)29; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - TEMP_BUFFER.putInt(value); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - static synchronized void onTileConfig__forward(NetConnection exceptConnection, Playerc player, - Tile tile, int value) { - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)29; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - TEMP_BUFFER.putInt(value); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.sendExcept(exceptConnection, packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onTileDamage(Tile tile, float health) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.Tile.onTileDamage(tile, health); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)30; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - TEMP_BUFFER.putFloat(health); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void onTileDestroyed(Tile tile) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.Tile.onTileDestroyed(tile); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)31; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onTileTapped(Playerc player, Tile tile) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.input.InputHandler.onTileTapped(player, tile); - } - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)32; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - static synchronized void onTileTapped__forward(NetConnection exceptConnection, Playerc player, - Tile tile) { - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)32; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onTraceInfo(NetConnection playerConnection, Playerc player, - Administration.TraceInfo info) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)33; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - mindustry.io.TypeIO.writeTraceInfo(TEMP_BUFFER, info); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onUnitFactorySpawn(Tile tile, int spawns) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.blocks.units.UnitFactory.onUnitFactorySpawn(tile, spawns); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)34; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - TEMP_BUFFER.putInt(spawns); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onUnitRespawn(Tile tile, Playerc player) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.blocks.storage.CoreBlock.onUnitRespawn(tile, player); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)35; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onWorldDataBegin() { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)36; - TEMP_BUFFER.position(0); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void onWorldDataBegin(NetConnection playerConnection) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)36; - TEMP_BUFFER.position(0); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void removeQueueBlock(NetConnection playerConnection, int x, int y, - boolean breaking) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)37; - TEMP_BUFFER.position(0); - TEMP_BUFFER.putInt(x); - TEMP_BUFFER.putInt(y); - TEMP_BUFFER.put(breaking ? (byte)1 : 0); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void removeTile(Tile tile) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.Tile.removeTile(tile); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)38; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void requestItem(Playerc player, Tile tile, Item item, int amount) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.ui.fragments.BlockInventoryFragment.requestItem(player, tile, item, amount); - } - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)39; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item); - TEMP_BUFFER.putInt(amount); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - static synchronized void requestItem__forward(NetConnection exceptConnection, Playerc player, - Tile tile, Item item, int amount) { - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)39; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item); - TEMP_BUFFER.putInt(amount); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void rotateBlock(Playerc player, Tile tile, boolean direction) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.input.InputHandler.rotateBlock(player, tile, direction); - } - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)40; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - TEMP_BUFFER.put(direction ? (byte)1 : 0); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - static synchronized void rotateBlock__forward(NetConnection exceptConnection, Playerc player, - Tile tile, boolean direction) { - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)40; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - TEMP_BUFFER.put(direction ? (byte)1 : 0); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void sendChatMessage(String message) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.core.NetClient.sendChatMessage(mindustry.Vars.player, message); - } - if(mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)41; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void sendMessage(String message) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.core.NetClient.sendMessage(message); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)42; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void sendMessage(String message, String sender, Playerc playersender) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)43; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, sender); - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, playersender); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void sendMessage(NetConnection playerConnection, String message, - String sender, Playerc playersender) { - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)43; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, message); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, sender); - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, playersender); - packet.writeLength = TEMP_BUFFER.position(); - playerConnection.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void setMessageBlockText(Playerc player, Tile tile, String text) { - mindustry.world.blocks.logic.MessageBlock.setMessageBlockText(player, tile, text); - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)44; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, text); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - static synchronized void setMessageBlockText__forward(NetConnection exceptConnection, - Playerc player, Tile tile, String text) { - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)44; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - mindustry.io.TypeIO.writeString(TEMP_BUFFER, text); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.sendExcept(exceptConnection, packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void setPlayerTeamEditor(Playerc player, Team team) { - mindustry.ui.fragments.HudFragment.setPlayerTeamEditor(player, team); - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)45; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - static synchronized void setPlayerTeamEditor__forward(NetConnection exceptConnection, - Playerc player, Team team) { - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)45; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.sendExcept(exceptConnection, packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void setTile(Tile tile, Block block, Team team, int rotation) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.world.Tile.setTile(tile, block, team, rotation); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)46; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - mindustry.io.TypeIO.writeBlock(TEMP_BUFFER, block); - mindustry.io.TypeIO.writeTeam(TEMP_BUFFER, team); - TEMP_BUFFER.putInt(rotation); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void transferInventory(Playerc player, Tile tile) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.input.InputHandler.transferInventory(player, tile); - } - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)47; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - static synchronized void transferInventory__forward(NetConnection exceptConnection, - Playerc player, Tile tile) { - if(mindustry.Vars.net.server() || mindustry.Vars.net.client()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)47; - TEMP_BUFFER.position(0); - if(mindustry.Vars.net.server()) { - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, player); - } - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.tcp); - } - } - - public static synchronized void transferItemEffect(Item item, float x, float y, Itemsc to) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.input.InputHandler.transferItemEffect(item, x, y, to); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)48; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item); - TEMP_BUFFER.putFloat(x); - TEMP_BUFFER.putFloat(y); - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, to); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void transferItemTo(Item item, int amount, float x, float y, - Tile tile) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.input.InputHandler.transferItemTo(item, amount, x, y, tile); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)49; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item); - TEMP_BUFFER.putInt(amount); - TEMP_BUFFER.putFloat(x); - TEMP_BUFFER.putFloat(y); - mindustry.io.TypeIO.writeTile(TEMP_BUFFER, tile); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); - } - } - - public static synchronized void transferItemToUnit(Item item, float x, float y, Itemsc to) { - if(mindustry.Vars.net.server() || !mindustry.Vars.net.active()) { - mindustry.input.InputHandler.transferItemToUnit(item, x, y, to); - } - if(mindustry.Vars.net.server()) { - mindustry.net.Packets.InvokePacket packet = arc.util.pooling.Pools.obtain(mindustry.net.Packets.InvokePacket.class, mindustry.net.Packets.InvokePacket::new); - packet.writeBuffer = TEMP_BUFFER; - packet.priority = (byte)0; - packet.type = (byte)50; - TEMP_BUFFER.position(0); - mindustry.io.TypeIO.writeItem(TEMP_BUFFER, item); - TEMP_BUFFER.putFloat(x); - TEMP_BUFFER.putFloat(y); - mindustry.io.TypeIO.writeEntity(TEMP_BUFFER, to); - packet.writeLength = TEMP_BUFFER.position(); - mindustry.Vars.net.send(packet, mindustry.net.Net.SendMode.udp); - } - } -}