added missing files for initial RPC implementation

This commit is contained in:
SpaceToad 2014-01-06 19:59:09 +01:00
parent b1f5a4b96a
commit d697944364
4 changed files with 41 additions and 1 deletions

View file

@ -30,6 +30,7 @@ import buildcraft.api.gates.ActionManager;
import buildcraft.api.recipes.BuildcraftRecipes; import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.builders.blueprints.BlueprintDatabase; import buildcraft.builders.blueprints.BlueprintDatabase;
import buildcraft.core.BlockIndex; import buildcraft.core.BlockIndex;
import buildcraft.core.BlockPingPong;
import buildcraft.core.BlockSpring; import buildcraft.core.BlockSpring;
import buildcraft.core.BuildCraftConfiguration; import buildcraft.core.BuildCraftConfiguration;
import buildcraft.core.CommandBuildCraft; import buildcraft.core.CommandBuildCraft;
@ -44,6 +45,7 @@ import buildcraft.core.ItemSpring;
import buildcraft.core.ItemWrench; import buildcraft.core.ItemWrench;
import buildcraft.core.SpringPopulate; import buildcraft.core.SpringPopulate;
import buildcraft.core.TickHandlerCoreClient; import buildcraft.core.TickHandlerCoreClient;
import buildcraft.core.TilePingPong;
import buildcraft.core.Version; import buildcraft.core.Version;
import buildcraft.core.blueprints.BptItem; import buildcraft.core.blueprints.BptItem;
import buildcraft.core.network.EntityIds; import buildcraft.core.network.EntityIds;
@ -68,6 +70,8 @@ import buildcraft.core.recipes.AssemblyRecipeManager;
import buildcraft.core.recipes.IntegrationRecipeManager; import buildcraft.core.recipes.IntegrationRecipeManager;
import buildcraft.core.recipes.RefineryRecipeManager; import buildcraft.core.recipes.RefineryRecipeManager;
import buildcraft.core.triggers.TriggerRedstoneInput; import buildcraft.core.triggers.TriggerRedstoneInput;
import buildcraft.factory.BlockAutoWorkbench;
import buildcraft.factory.TileRefinery;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Instance;
@ -105,6 +109,7 @@ public class BuildCraftCore {
public static final int trackedPassiveEntityId = 156; public static final int trackedPassiveEntityId = 156;
public static boolean continuousCurrentModel; public static boolean continuousCurrentModel;
public static Block springBlock; public static Block springBlock;
public static Block pingPongBlock;
public static Item woodenGearItem; public static Item woodenGearItem;
public static Item stoneGearItem; public static Item stoneGearItem;
public static Item ironGearItem; public static Item ironGearItem;
@ -257,11 +262,25 @@ public class BuildCraftCore {
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
// FIXME: Ping Pong is just here as a temporary demonstration for
// RPCs, it's aimed at being removed before release
int pingPongId = BuildCraftCore.mainConfiguration.getBlock("pingpong.id", DefaultProps.PING_PONG_ID).getInt(DefaultProps.PING_PONG_ID);
if (pingPongId > 0) {
pingPongBlock = new BlockPingPong (pingPongId);
CoreProxy.proxy.registerBlock(pingPongBlock.setUnlocalizedName("pingPongBlock"));
CoreProxy.proxy.addName(pingPongBlock, "Ping Pong");
CoreProxy.proxy.registerTileEntity(TilePingPong.class, "net.minecraft.src.core.TilePingPong");
}
} finally { } finally {
if (mainConfiguration.hasChanged()) { if (mainConfiguration.hasChanged()) {
mainConfiguration.save(); mainConfiguration.save();
} }
} }
} }
@EventHandler @EventHandler

View file

@ -114,10 +114,12 @@ public class DefaultProps {
public static int SPRING_ID = 1522; public static int SPRING_ID = 1522;
public static int FILTERED_BUFFER_ID = 1523; public static int FILTERED_BUFFER_ID = 1523;
public static int FLOOD_GATE_ID = 1524; public static int FLOOD_GATE_ID = 1524;
public static int OIL_ID = 1530; public static int OIL_ID = 1530;
public static int FUEL_ID = 1531; public static int FUEL_ID = 1531;
public static int PING_PONG_ID = 1532;
public static boolean CURRENT_CONTINUOUS = false; public static boolean CURRENT_CONTINUOUS = false;
public static double PIPES_DURABILITY = 0.25D; public static double PIPES_DURABILITY = 0.25D;
public static boolean FILLER_DESTROY = false; public static boolean FILLER_DESTROY = false;

View file

@ -11,6 +11,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.network.IPacketHandler; import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player; import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.repackage.com.nothome.delta.DebugDiffWriter;
public class PacketHandler implements IPacketHandler { public class PacketHandler implements IPacketHandler {
@ -65,6 +66,22 @@ public class PacketHandler implements IPacketHandler {
pkt.readData(data); pkt.readData(data);
break; break;
} }
case PacketIds.RPC: {
PacketRPC rpc = new PacketRPC();
rpc.sender = (EntityPlayer) player;
int x = data.readInt();
int y = data.readInt();
int z = data.readInt();
World world = ((EntityPlayer) player).worldObj;
TileEntity tile = world.getBlockTileEntity(x, y, z);
rpc.setTile (tile);
rpc.readData(data);
break;
}
} }
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();

View file

@ -40,4 +40,6 @@ public class PacketIds {
public static final int GUI_WIDGET = 81; public static final int GUI_WIDGET = 81;
public static final int STATE_UPDATE = 100; public static final int STATE_UPDATE = 100;
public static final int RPC = 110;
} }