New build limits, recipe refactoring

This commit is contained in:
Anuken
2018-05-16 14:27:25 -07:00
parent a889571b98
commit 97cac33773
14 changed files with 187 additions and 177 deletions

View File

@@ -7,14 +7,11 @@ import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.SyncEntity;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.CallEvent;
import io.anuke.mindustry.net.Net.SendMode;
import io.anuke.mindustry.net.Packets.*;
import io.anuke.mindustry.resource.Recipe;
import io.anuke.mindustry.resource.Upgrade;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.entities.Entity;
import static io.anuke.mindustry.Vars.*;
@@ -102,13 +99,13 @@ public class NetEvents {
Net.send(packet, SendMode.udp);
}
public static void handlePlace(Player player, int x, int y, Block block, int rotation){
public static void handlePlace(Player player, int x, int y, Recipe recipe, int rotation){
PlacePacket packet = Pools.obtain(PlacePacket.class);
packet.x = (short)x;
packet.y = (short)y;
packet.rotation = (byte)rotation;
packet.playerid = player.id;
packet.block = block.id;
packet.recipe = (byte)recipe.id;
Net.send(packet, SendMode.tcp);
}

View File

@@ -3,7 +3,6 @@ package io.anuke.mindustry.net;
import com.badlogic.gdx.utils.Base64Coder;
import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.Method;
import com.badlogic.gdx.utils.reflect.ReflectionException;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.Player;
@@ -220,7 +219,7 @@ public class Packets {
public int playerid;
public byte rotation;
public short x, y;
public int block;
public byte recipe;
@Override
public void write(ByteBuffer buffer) {
@@ -228,7 +227,7 @@ public class Packets {
buffer.put(rotation);
buffer.putShort(x);
buffer.putShort(y);
buffer.putInt(block);
buffer.put(recipe);
}
@Override
@@ -237,7 +236,7 @@ public class Packets {
rotation = buffer.get();
x = buffer.getShort();
y = buffer.getShort();
block = buffer.getInt();
recipe = buffer.get();
}
}