migrated part of the sendTo* calls to the new network API
This commit is contained in:
parent
14003341e3
commit
3b973044ea
10 changed files with 46 additions and 21 deletions
|
@ -140,7 +140,7 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
|
|||
} else if (deleteButton != null && button == deleteButton) {
|
||||
packet.actionId = TileBlueprintLibrary.COMMAND_DELETE;
|
||||
}
|
||||
CoreProxy.proxy.sendToServer(packet.getPacket());
|
||||
BuildCraftBuilders.instance.sendToServer(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,7 +162,7 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
|
|||
payload.intPayload = new int[]{ySlot};
|
||||
PacketLibraryAction packet = new PacketLibraryAction(PacketIds.LIBRARY_SELECT, library.xCoord, library.yCoord, library.zCoord);
|
||||
packet.actionId = ySlot;
|
||||
CoreProxy.proxy.sendToServer(packet.getPacket());
|
||||
BuildCraftBuilders.instance.sendToServer(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.TileArchitect;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.gui.GuiBuildCraft;
|
||||
|
@ -16,9 +17,12 @@ import buildcraft.core.network.PacketPayloadArrays;
|
|||
import buildcraft.core.network.PacketUpdate;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiTemplate extends GuiBuildCraft {
|
||||
|
@ -87,7 +91,7 @@ public class GuiTemplate extends GuiBuildCraft {
|
|||
PacketPayloadArrays payload = new PacketPayloadArrays();
|
||||
payload.intPayload = new int[]{c};
|
||||
PacketUpdate packet = new PacketUpdate(PacketIds.ARCHITECT_NAME, template.xCoord, template.yCoord, template.zCoord, payload);
|
||||
CoreProxy.proxy.sendToServer(packet.getPacket());
|
||||
BuildCraftBuilders.instance.sendToServer(packet);
|
||||
} else {
|
||||
super.keyTyped(c, i);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
package buildcraft.core;
|
||||
|
||||
import buildcraft.BuildCraftMod;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.core.network.ISynchronizedTile;
|
||||
import buildcraft.core.network.PacketPayload;
|
||||
|
@ -16,9 +17,11 @@ import buildcraft.core.network.PacketUpdate;
|
|||
import buildcraft.core.network.TilePacketWrapper;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -87,9 +90,9 @@ public abstract class TileBuildCraft extends TileEntity implements ISynchronized
|
|||
public void destroy() {
|
||||
}
|
||||
|
||||
public void sendNetworkUpdate() {
|
||||
public void sendNetworkUpdate(BuildCraftMod mod) {
|
||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
||||
CoreProxy.proxy.sendToPlayers(getUpdatePacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.NETWORK_UPDATE_RANGE);
|
||||
mod.sendToPlayers(getUpdatePacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.NETWORK_UPDATE_RANGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,14 +7,18 @@
|
|||
*/
|
||||
package buildcraft.factory.gui;
|
||||
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
import buildcraft.core.network.PacketIds;
|
||||
import buildcraft.core.network.PacketPayloadStream;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.factory.TileRefinery;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
|
@ -54,13 +58,12 @@ public class ContainerRefinery extends BuildCraftContainer {
|
|||
if (CoreProxy.proxy.isRenderWorld(refinery.worldObj)) {
|
||||
PacketPayloadStream payload = new PacketPayloadStream(new PacketPayloadStream.StreamWriter() {
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
data.writeByte(slot);
|
||||
data.writeShort(filter != null ? filter.getID() : -1);
|
||||
}
|
||||
});
|
||||
CoreProxy.proxy.sendToServer(new PacketUpdate(PacketIds.REFINERY_FILTER_SET, refinery.xCoord, refinery.yCoord, refinery.zCoord, payload)
|
||||
.getPacket());
|
||||
BuildCraftFactory.instance.sendToServer(new PacketUpdate(PacketIds.REFINERY_FILTER_SET, refinery.xCoord, refinery.yCoord, refinery.zCoord, payload));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package buildcraft.silicon;
|
|||
|
||||
import buildcraft.api.power.ILaserTarget;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionReceptor;
|
||||
import buildcraft.core.IMachine;
|
||||
|
@ -23,9 +24,12 @@ import buildcraft.core.triggers.ActionMachineControl;
|
|||
import buildcraft.core.utils.CraftingHelper;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -46,6 +50,7 @@ import static net.minecraftforge.common.ForgeDirection.NORTH;
|
|||
import static net.minecraftforge.common.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.ForgeDirection.WEST;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.bouncycastle.util.Arrays;
|
||||
|
||||
public class TileAdvancedCraftingTable extends TileLaserTableBase implements IInventory, ILaserTarget, IMachine, IActionReceptor, ISidedInventory {
|
||||
|
@ -366,7 +371,7 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
|
|||
updateRecipe();
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
PacketSlotChange packet = new PacketSlotChange(PacketIds.ADVANCED_WORKBENCH_SETSLOT, xCoord, yCoord, zCoord, slot, stack);
|
||||
CoreProxy.proxy.sendToServer(packet.getPacket());
|
||||
BuildCraftSilicon.instance.sendToServer(packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package buildcraft.silicon;
|
||||
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.core.recipes.AssemblyRecipeManager;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
@ -11,10 +12,12 @@ import buildcraft.core.utils.Utils;
|
|||
import buildcraft.core.recipes.AssemblyRecipeManager.AssemblyRecipe;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -272,7 +275,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IMachine, I
|
|||
packet.posY = yCoord;
|
||||
packet.posZ = zCoord;
|
||||
// FIXME: This needs to be switched over to new synch system.
|
||||
CoreProxy.proxy.sendToPlayers(packet.getPacket(), worldObj, (int) player.posX, (int) player.posY, (int) player.posZ,
|
||||
BuildCraftSilicon.instance.sendToPlayers(packet, worldObj, (int) player.posX, (int) player.posY, (int) player.posZ,
|
||||
DefaultProps.NETWORK_UPDATE_RANGE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package buildcraft.silicon.gui;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.core.CoreIconProvider;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.gui.GuiAdvancedInterface;
|
||||
|
@ -19,13 +20,16 @@ import buildcraft.core.utils.StringUtils;
|
|||
import buildcraft.core.recipes.AssemblyRecipeManager.AssemblyRecipe;
|
||||
import buildcraft.silicon.TileAssemblyTable;
|
||||
import buildcraft.silicon.TileAssemblyTable.SelectionMessage;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiAssemblyTable extends GuiAdvancedInterface {
|
||||
|
@ -112,8 +116,8 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
|
||||
// Request current selection from server
|
||||
if (CoreProxy.proxy.isRenderWorld(assemblyTable.worldObj)) {
|
||||
CoreProxy.proxy.sendToServer(new PacketCoordinates(PacketIds.SELECTION_ASSEMBLY_GET, assemblyTable.xCoord, assemblyTable.yCoord,
|
||||
assemblyTable.zCoord).getPacket());
|
||||
BuildCraftSilicon.instance.sendToServer(new PacketCoordinates(PacketIds.SELECTION_ASSEMBLY_GET, assemblyTable.xCoord, assemblyTable.yCoord,
|
||||
assemblyTable.zCoord));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +201,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
|
||||
PacketNBT packet = new PacketNBT(PacketIds.SELECTION_ASSEMBLY, message.getNBT(), table.xCoord, table.yCoord, table.zCoord);
|
||||
|
||||
CoreProxy.proxy.sendToServer(packet.getPacket());
|
||||
BuildCraftSilicon.instance.sendToServer(packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
|
@ -201,7 +202,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
}
|
||||
PacketFluidUpdate packet = computeFluidUpdate(init, true);
|
||||
if (packet != null) {
|
||||
CoreProxy.proxy.sendToPlayers(packet.getPacket(), container.worldObj, container.xCoord, container.yCoord, container.zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST);
|
||||
BuildCraftTransport.instance.sendToPlayers(packet, container.worldObj, container.xCoord, container.yCoord, container.zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.power.IPowerEmitter;
|
||||
|
@ -258,7 +259,7 @@ public class PipeTransportPower extends PipeTransport {
|
|||
|
||||
packet.displayPower = clientDisplayPower;
|
||||
packet.overload = isOverloaded();
|
||||
CoreProxy.proxy.sendToPlayers(packet.getPacket(), container.worldObj, container.xCoord, container.yCoord, container.zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST);
|
||||
BuildCraftTransport.instance.sendToPlayers(packet, container.worldObj, container.xCoord, container.yCoord, container.zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
package buildcraft.transport.gui;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.gates.ActionManager;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IOverrideDefaultTriggers;
|
||||
|
@ -215,7 +216,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
}
|
||||
|
||||
public void sendSelectionChange(int position) {
|
||||
CoreProxy.proxy.sendToServer(new PacketUpdate(PacketIds.GATE_SELECTION_CHANGE, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, getSelectionPayload(position)).getPacket());
|
||||
BuildCraftTransport.instance.sendToServer(new PacketUpdate(PacketIds.GATE_SELECTION_CHANGE, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, getSelectionPayload(position)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -226,12 +227,12 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
|
||||
if (!isNetInitialized && CoreProxy.proxy.isRenderWorld(pipe.container.worldObj)) {
|
||||
isNetInitialized = true;
|
||||
CoreProxy.proxy.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_INIT, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord).getPacket());
|
||||
BuildCraftTransport.instance.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_INIT, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord));
|
||||
}
|
||||
|
||||
if (!isSynchronized && CoreProxy.proxy.isRenderWorld(pipe.container.worldObj)) {
|
||||
isSynchronized = true;
|
||||
CoreProxy.proxy.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_SELECTION, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord).getPacket());
|
||||
BuildCraftTransport.instance.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_SELECTION, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,7 +302,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
PacketUpdate packet = new PacketUpdate(PacketIds.GATE_ACTIONS, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, payload);
|
||||
|
||||
// Send to player
|
||||
CoreProxy.proxy.sendToPlayer(player, packet);
|
||||
BuildCraftTransport.instance.sendToPlayer(player, packet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,7 +325,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
PacketUpdate packet = new PacketUpdate(PacketIds.GATE_TRIGGERS, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, payload);
|
||||
|
||||
// Send to player
|
||||
CoreProxy.proxy.sendToPlayer(player, packet);
|
||||
BuildCraftTransport.instance.sendToPlayer(player, packet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -336,7 +337,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
if (pipe == null || pipe.gate == null)
|
||||
return;
|
||||
for (int position = 0; position < pipe.gate.material.numSlots; position++) {
|
||||
CoreProxy.proxy.sendToPlayer(player, new PacketUpdate(PacketIds.GATE_SELECTION, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, getSelectionPayload(position)));
|
||||
BuildCraftTransport.instance.sendToPlayer(player, new PacketUpdate(PacketIds.GATE_SELECTION, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, getSelectionPayload(position)));
|
||||
}
|
||||
|
||||
// System.out.println("Sending current selection to player");
|
||||
|
|
Loading…
Reference in a new issue