1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-28 04:17:38 +00:00

Get us booting on a dedicated server

It doesn't appear that blocks are syncing, so we'll need to look into
that. Hopefully fixes #193
This commit is contained in:
SquidDev
2019-04-29 08:04:24 +01:00
parent e8d7e6a562
commit e6094a59fa
4 changed files with 12 additions and 8 deletions

View File

@@ -17,6 +17,8 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
import net.fabricmc.fabric.api.network.PacketContext;
import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.packet.CustomPayloadS2CPacket;
import net.minecraft.entity.player.PlayerEntity;
@@ -45,8 +47,11 @@ public final class NetworkHandler
public static void setup()
{
ClientSidePacketRegistry.INSTANCE.register( ID, NetworkHandler::receive );
ServerSidePacketRegistry.INSTANCE.register( ID, NetworkHandler::receive );
if( FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT )
{
ClientSidePacketRegistry.INSTANCE.register( ID, NetworkHandler::receive );
}
// Server messages
registerMainThread( 0, ComputerActionServerMessage::new );

View File

@@ -11,7 +11,6 @@ import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.media.IMedia;
import dan200.computercraft.api.peripheral.IPeripheralTile;
import dan200.computercraft.api.turtle.event.TurtleEvent;
import dan200.computercraft.client.FrameInfo;
import dan200.computercraft.core.computer.MainThread;
import dan200.computercraft.core.tracking.Tracking;
import dan200.computercraft.shared.Registry;
@@ -35,7 +34,6 @@ import dan200.computercraft.shared.turtle.recipes.TurtleUpgradeRecipe;
import dan200.computercraft.shared.util.ImpostorRecipe;
import dan200.computercraft.shared.util.ImpostorShapelessRecipe;
import dan200.computercraft.shared.util.TickScheduler;
import net.fabricmc.fabric.api.event.client.ClientTickCallback;
import net.fabricmc.fabric.api.event.server.ServerStartCallback;
import net.fabricmc.fabric.api.event.server.ServerStopCallback;
import net.fabricmc.fabric.api.event.server.ServerTickCallback;
@@ -109,10 +107,6 @@ public class ComputerCraftProxyCommon
{
CommandRegistry.INSTANCE.register( false, CommandComputerCraft::register );
ClientTickCallback.EVENT.register( client -> {
FrameInfo.onTick();
} );
ServerTickCallback.EVENT.register( server -> {
MainThread.executePendingTasks();
ComputerCraft.serverComputerRegistry.update();