Commit 6d1b9c9be2e6ec31e684d218f4af7d61c65a47ac
1 parent
7ab03429
splitting server src
Showing
12 changed files
with
0 additions
and
943 deletions
debug/com/mumfrey/liteloader/debug/ServerStart.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.debug; | |
2 | -import java.io.File; | |
3 | -import java.util.ArrayList; | |
4 | -import java.util.Arrays; | |
5 | -import java.util.List; | |
6 | - | |
7 | -import net.minecraft.launchwrapper.Launch; | |
8 | - | |
9 | -import com.mumfrey.liteloader.launch.LiteLoaderTweakerServer; | |
10 | - | |
11 | -/** | |
12 | - * Wrapper class for LaunchWrapper Main class, which logs into minecraft.net first so that online shizzle can be tested | |
13 | - * | |
14 | - * @author Adam Mummery-Smith | |
15 | - * @version 0.6.2 | |
16 | - */ | |
17 | -public abstract class ServerStart | |
18 | -{ | |
19 | - private static final String FML_TWEAKER_NAME = "cpw.mods.fml.common.launcher.FMLTweaker"; | |
20 | - | |
21 | - /** | |
22 | - * Entry point. | |
23 | - * | |
24 | - * @param args | |
25 | - */ | |
26 | - public static void main(String[] args) | |
27 | - { | |
28 | - System.setProperty("mcpenv", "true"); | |
29 | - | |
30 | - boolean fmlDetected = false; | |
31 | - List<String> argsList = new ArrayList<String>(Arrays.asList(args)); | |
32 | - | |
33 | - // Detect the FML tweaker specified on the command line, this likely means someone has pulled us | |
34 | - // into a Forge MCP workspace | |
35 | - for (String arg : argsList) fmlDetected |= FML_TWEAKER_NAME.equals(arg); | |
36 | - | |
37 | - if (fmlDetected) | |
38 | - { | |
39 | - argsList.clear(); | |
40 | - argsList.add("--tweakClass");argsList.add(FML_TWEAKER_NAME); | |
41 | - } | |
42 | - | |
43 | - File gameDir = new File(System.getProperty("user.dir")); | |
44 | - File assetsDir = new File(gameDir, "assets"); | |
45 | - | |
46 | - argsList.add("--tweakClass"); argsList.add(LiteLoaderTweakerServer.class.getName()); | |
47 | - argsList.add("--version"); argsList.add("mcp"); | |
48 | - argsList.add("--gameDir"); argsList.add(gameDir.getAbsolutePath()); | |
49 | - argsList.add("--assetsDir"); argsList.add(assetsDir.getAbsolutePath()); | |
50 | - | |
51 | - Launch.main(argsList.toArray(args)); | |
52 | - } | |
53 | -} |
java/server/com/mumfrey/liteloader/server/CallbackProxyServer.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server; | |
2 | - | |
3 | -import net.minecraft.entity.player.EntityPlayerMP; | |
4 | -import net.minecraft.network.INetHandler; | |
5 | -import net.minecraft.network.NetworkManager; | |
6 | -import net.minecraft.network.play.INetHandlerPlayServer; | |
7 | -import net.minecraft.network.play.client.C01PacketChatMessage; | |
8 | -import net.minecraft.network.play.client.C17PacketCustomPayload; | |
9 | -import net.minecraft.server.MinecraftServer; | |
10 | -import net.minecraft.server.dedicated.DedicatedServer; | |
11 | -import net.minecraft.server.management.ServerConfigurationManager; | |
12 | - | |
13 | -import com.mojang.authlib.GameProfile; | |
14 | -import com.mumfrey.liteloader.core.LiteLoader; | |
15 | -import com.mumfrey.liteloader.core.ServerPluginChannels; | |
16 | -import com.mumfrey.liteloader.launch.LiteLoaderTweaker; | |
17 | - | |
18 | -/** | |
19 | - * Proxy class which handles the redirected calls from the injected packet hooks and routes them to the | |
20 | - * relevant liteloader handler classes. We do this rather than patching a bunch of bytecode into the packet | |
21 | - * classes themselves because this is easier to maintain. | |
22 | - * | |
23 | - * @author Adam Mummery-Smith | |
24 | - */ | |
25 | -public class CallbackProxyServer | |
26 | -{ | |
27 | - private static ServerEvents events; | |
28 | - | |
29 | - public static void init(MinecraftServer server) | |
30 | - { | |
31 | - LiteLoaderTweaker.init(); | |
32 | - LiteLoaderTweaker.postInit(); | |
33 | - } | |
34 | - | |
35 | - /** | |
36 | - * S02PacketChat::processPacket() | |
37 | - * | |
38 | - * @param netHandler | |
39 | - * @param packet | |
40 | - */ | |
41 | - public static void handleServerChatPacket(INetHandler netHandler, C01PacketChatMessage packet) | |
42 | - { | |
43 | - System.err.println("handleServerChatPacket [" + packet.func_149439_c() + "]"); | |
44 | - | |
45 | - if (CallbackProxyServer.events.onServerChat((INetHandlerPlayServer)netHandler, packet)) | |
46 | - { | |
47 | - ((INetHandlerPlayServer)netHandler).func_147354_a(packet); // processChatMessage - func_147354_a @ server side | |
48 | - } | |
49 | - } | |
50 | -// | |
51 | -// /** | |
52 | -// * S3FPacketCustomPayload::processPacket() | |
53 | -// * | |
54 | -// * @param netHandler | |
55 | -// * @param packet | |
56 | -// */ | |
57 | -// public static void handleCustomPayloadPacket(INetHandler netHandler, S3FPacketCustomPayload packet) | |
58 | -// { | |
59 | -// ((INetHandlerPlayClient)netHandler).handleCustomPayload(packet);; | |
60 | -// | |
61 | -// @SuppressWarnings("unchecked") | |
62 | -// ClientPluginChannels<S3FPacketCustomPayload> pluginChannels = (ClientPluginChannels<S3FPacketCustomPayload>)LiteLoader.getClientPluginChannels(); | |
63 | -// pluginChannels.onPluginChannelMessage(packet); | |
64 | -// } | |
65 | - | |
66 | - /** | |
67 | - * C17PacketCustomPayload::processPacket() | |
68 | - * | |
69 | - * @param netHandler | |
70 | - * @param packet | |
71 | - */ | |
72 | - public static void handleCustomPayloadPacket(INetHandler netHandler, C17PacketCustomPayload packet) | |
73 | - { | |
74 | - ((INetHandlerPlayServer)netHandler).func_147349_a(packet); // processVanilla250Packet - func_147349_a @ server side | |
75 | - | |
76 | - System.err.println("handleCustomPayloadPacket [" + packet.func_149559_c() + "]"); | |
77 | - | |
78 | - ServerPluginChannels pluginChannels = LiteLoader.getServerPluginChannels(); | |
79 | - pluginChannels.onPluginChannelMessage((INetHandlerPlayServer)netHandler, packet); | |
80 | - } | |
81 | - | |
82 | - public static boolean onStartupComplete(boolean returnValue, int ref, DedicatedServer server) | |
83 | - { | |
84 | - System.err.println("onStartupComplete [" + returnValue + "] @" + ref); | |
85 | - if (returnValue) | |
86 | - { | |
87 | - CallbackProxyServer.events = ServerEvents.getInstance(); | |
88 | - CallbackProxyServer.events.onStartupComplete(); | |
89 | - } | |
90 | - | |
91 | - return returnValue; | |
92 | - } | |
93 | - | |
94 | -// public static void onTick(int ref) | |
95 | -// { | |
96 | -// if (ref == 2) | |
97 | -// { | |
98 | -// CallbackProxyServer.events.onTick(CallbackProxyServer.clock); | |
99 | -// CallbackProxyServer.clock = false; | |
100 | -// } | |
101 | -// } | |
102 | - | |
103 | - public static void onInitializePlayerConnection(int ref, ServerConfigurationManager scm, NetworkManager netManager, EntityPlayerMP player) | |
104 | - { | |
105 | - if (ref == 0) | |
106 | - { | |
107 | - System.err.println("onInitializePlayerConnection"); | |
108 | - CallbackProxyServer.events.onInitializePlayerConnection(scm, netManager, player); | |
109 | - } | |
110 | - } | |
111 | - | |
112 | - public static void onPlayerLogin(int ref, ServerConfigurationManager scm, EntityPlayerMP player) | |
113 | - { | |
114 | - if (ref == 0) | |
115 | - { | |
116 | - System.err.println("onPlayerLogin " + player); | |
117 | - CallbackProxyServer.events.onPlayerLogin(scm, player); | |
118 | - } | |
119 | - } | |
120 | - | |
121 | - public static void onPlayerLogout(int ref, ServerConfigurationManager scm, EntityPlayerMP player) | |
122 | - { | |
123 | - if (ref == 0) | |
124 | - { | |
125 | - System.err.println("onPlayerLogout " + player); | |
126 | - CallbackProxyServer.events.onPlayerLogout(scm, player); | |
127 | - } | |
128 | - } | |
129 | - | |
130 | - public static EntityPlayerMP onSpawnPlayer(EntityPlayerMP returnValue, int ref, ServerConfigurationManager scm, GameProfile profile) | |
131 | - { | |
132 | - if (ref == 0) | |
133 | - { | |
134 | - System.err.println("onSpawnPlayer " + profile.getName() + " [" + profile.getId() + "]"); | |
135 | - CallbackProxyServer.events.onSpawnPlayer(scm, returnValue, profile); | |
136 | - } | |
137 | - | |
138 | - return returnValue; | |
139 | - } | |
140 | - | |
141 | - public static EntityPlayerMP onRespawnPlayer(EntityPlayerMP returnValue, int ref, ServerConfigurationManager scm, EntityPlayerMP oldPlayer, int dimension, boolean won) | |
142 | - { | |
143 | - if (ref == 0) | |
144 | - { | |
145 | - System.err.println("onRespawnPlayer " + oldPlayer); | |
146 | - CallbackProxyServer.events.onRespawnPlayer(scm, returnValue, oldPlayer, dimension, won); | |
147 | - } | |
148 | - | |
149 | - return returnValue; | |
150 | - } | |
151 | -} |
java/server/com/mumfrey/liteloader/server/DummyClient.java deleted
100644 → 0
java/server/com/mumfrey/liteloader/server/GameEngineServer.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server; | |
2 | - | |
3 | -import java.util.List; | |
4 | - | |
5 | -import net.minecraft.client.resources.IResourcePack; | |
6 | -import net.minecraft.client.settings.KeyBinding; | |
7 | -import net.minecraft.profiler.Profiler; | |
8 | -import net.minecraft.server.MinecraftServer; | |
9 | - | |
10 | -import com.mumfrey.liteloader.common.GameEngine; | |
11 | -import com.mumfrey.liteloader.launch.LoaderEnvironment; | |
12 | -import com.mumfrey.liteloader.server.resources.ServerResourceManager; | |
13 | - | |
14 | -/** | |
15 | - * | |
16 | - * @author Adam Mummery-Smith | |
17 | - */ | |
18 | -public class GameEngineServer implements GameEngine<DummyClient, MinecraftServer> | |
19 | -{ | |
20 | - private final LoaderEnvironment environment; | |
21 | - | |
22 | - /** | |
23 | - * | |
24 | - */ | |
25 | - private final MinecraftServer engine = MinecraftServer.getServer(); | |
26 | - | |
27 | - /** | |
28 | - * | |
29 | - */ | |
30 | - private final DummyClient client = new DummyClient(); | |
31 | - | |
32 | - private ServerResourceManager resourceManager; | |
33 | - | |
34 | - public GameEngineServer(LoaderEnvironment environment) | |
35 | - { | |
36 | - this.environment = environment; | |
37 | - } | |
38 | - | |
39 | - @Override | |
40 | - public Profiler getProfiler() | |
41 | - { | |
42 | - return this.engine.theProfiler; | |
43 | - } | |
44 | - | |
45 | - @Override | |
46 | - public void refreshResources(boolean force) | |
47 | - { | |
48 | - this.getResourceManager().refreshResources(force); | |
49 | - } | |
50 | - | |
51 | - @Override | |
52 | - public boolean isClient() | |
53 | - { | |
54 | - return false; | |
55 | - } | |
56 | - | |
57 | - @Override | |
58 | - public boolean isServer() | |
59 | - { | |
60 | - return true; | |
61 | - } | |
62 | - | |
63 | - @Override | |
64 | - public boolean isInGame() | |
65 | - { | |
66 | - return true; | |
67 | - } | |
68 | - | |
69 | - @Override | |
70 | - public boolean isRunning() | |
71 | - { | |
72 | - return this.engine.isServerRunning(); | |
73 | - } | |
74 | - | |
75 | - @Override | |
76 | - public boolean isSinglePlayer() | |
77 | - { | |
78 | - return false; | |
79 | - } | |
80 | - | |
81 | - @Override | |
82 | - public DummyClient getClient() | |
83 | - { | |
84 | - return this.client; | |
85 | - } | |
86 | - | |
87 | - @Override | |
88 | - public MinecraftServer getServer() | |
89 | - { | |
90 | - return this.engine; | |
91 | - } | |
92 | - | |
93 | - @Override | |
94 | - public ServerResourceManager getResourceManager() | |
95 | - { | |
96 | - if (this.resourceManager == null) | |
97 | - { | |
98 | - this.resourceManager = new ServerResourceManager(this.environment); | |
99 | - } | |
100 | - | |
101 | - return this.resourceManager; | |
102 | - } | |
103 | - | |
104 | - /* (non-Javadoc) | |
105 | - * @see com.mumfrey.liteloader.common.GameEngine#registerResourcePack(net.minecraft.client.resources.IResourcePack) | |
106 | - */ | |
107 | - @Override | |
108 | - public boolean registerResourcePack(IResourcePack resourcePack) | |
109 | - { | |
110 | - return this.getResourceManager().registerResourcePack(resourcePack); | |
111 | - } | |
112 | - | |
113 | - /* (non-Javadoc) | |
114 | - * @see com.mumfrey.liteloader.common.GameEngine#unRegisterResourcePack(net.minecraft.client.resources.IResourcePack) | |
115 | - */ | |
116 | - @Override | |
117 | - public boolean unRegisterResourcePack(IResourcePack resourcePack) | |
118 | - { | |
119 | - return false; | |
120 | - } | |
121 | - | |
122 | - @Override | |
123 | - public List<KeyBinding> getKeyBindings() | |
124 | - { | |
125 | - throw new RuntimeException("Minecraft Server does not support key bindings"); | |
126 | - } | |
127 | - | |
128 | - @Override | |
129 | - public void setKeyBindings(List<KeyBinding> keyBindings) | |
130 | - { | |
131 | - throw new RuntimeException("Minecraft Server does not support key bindings"); | |
132 | - } | |
133 | -} |
java/server/com/mumfrey/liteloader/server/LiteLoaderCoreProviderServer.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server; | |
2 | - | |
3 | -import net.minecraft.network.INetHandler; | |
4 | -import net.minecraft.network.play.server.S01PacketJoinGame; | |
5 | -import net.minecraft.world.World; | |
6 | - | |
7 | -import com.mumfrey.liteloader.api.CoreProvider; | |
8 | -import com.mumfrey.liteloader.common.GameEngine; | |
9 | -import com.mumfrey.liteloader.core.LiteLoader; | |
10 | -import com.mumfrey.liteloader.core.LiteLoaderMods; | |
11 | -import com.mumfrey.liteloader.launch.LoaderProperties; | |
12 | -import com.mumfrey.liteloader.resources.InternalResourcePack; | |
13 | - | |
14 | -/** | |
15 | - * CoreProvider which fixes SoundManager derping up at startup | |
16 | - * | |
17 | - * @author Adam Mummery-Smith | |
18 | - */ | |
19 | -public class LiteLoaderCoreProviderServer implements CoreProvider | |
20 | -{ | |
21 | - /** | |
22 | - * Loader Properties adapter | |
23 | - */ | |
24 | -// private final LoaderProperties properties; | |
25 | - | |
26 | - public LiteLoaderCoreProviderServer(LoaderProperties properties) | |
27 | - { | |
28 | -// this.properties = properties; | |
29 | - } | |
30 | - | |
31 | - @Override | |
32 | - public void onInit() | |
33 | - { | |
34 | - } | |
35 | - | |
36 | - @Override | |
37 | - public void onPostInit(GameEngine<?, ?> engine) | |
38 | - { | |
39 | - // Add self as a resource pack for texture/lang resources | |
40 | - LiteLoader.getInstance().registerModResourcePack(new InternalResourcePack("LiteLoader", LiteLoader.class, "liteloader")); | |
41 | - } | |
42 | - | |
43 | - @Override | |
44 | - public void onPostInitComplete(LiteLoaderMods mods) | |
45 | - { | |
46 | - } | |
47 | - | |
48 | - @Override | |
49 | - public void onStartupComplete() | |
50 | - { | |
51 | - } | |
52 | - | |
53 | - @Override | |
54 | - public void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket) | |
55 | - { | |
56 | - } | |
57 | - | |
58 | - @Override | |
59 | - public void onPostRender(int mouseX, int mouseY, float partialTicks) | |
60 | - { | |
61 | - } | |
62 | - | |
63 | - @Override | |
64 | - public void onTick(boolean clock, float partialTicks, boolean inGame) | |
65 | - { | |
66 | - } | |
67 | - | |
68 | - @Override | |
69 | - public void onWorldChanged(World world) | |
70 | - { | |
71 | - } | |
72 | - | |
73 | - @Override | |
74 | - public void onShutDown() | |
75 | - { | |
76 | - } | |
77 | -} |
java/server/com/mumfrey/liteloader/server/ServerEvents.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server; | |
2 | - | |
3 | -import net.minecraft.server.MinecraftServer; | |
4 | - | |
5 | -import com.mumfrey.liteloader.common.GameEngine; | |
6 | -import com.mumfrey.liteloader.core.Events; | |
7 | -import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate; | |
8 | -import com.mumfrey.liteloader.core.LiteLoader; | |
9 | -import com.mumfrey.liteloader.launch.LoaderProperties; | |
10 | - | |
11 | -public class ServerEvents extends Events<DummyClient, MinecraftServer> | |
12 | -{ | |
13 | - private static ServerEvents instance; | |
14 | - | |
15 | - private boolean lateInitDone; | |
16 | - | |
17 | - public ServerEvents(LiteLoader loader, GameEngine<DummyClient, MinecraftServer> engine, LoaderProperties properties) | |
18 | - { | |
19 | - super(loader, engine, properties); | |
20 | - | |
21 | - ServerEvents.instance = this; | |
22 | - } | |
23 | - | |
24 | - public static ServerEvents getInstance() | |
25 | - { | |
26 | - return ServerEvents.instance; | |
27 | - } | |
28 | - | |
29 | - /* (non-Javadoc) | |
30 | - * @see com.mumfrey.liteloader.api.InterfaceProvider#registerInterfaces(com.mumfrey.liteloader.core.InterfaceRegistrationDelegate) | |
31 | - */ | |
32 | - @Override | |
33 | - public void registerInterfaces(InterfaceRegistrationDelegate delegate) | |
34 | - { | |
35 | -// delegate.registerInterface(Tickable.class); | |
36 | -// delegate.registerInterface(GameLoopListener.class); | |
37 | -// delegate.registerInterface(InitCompleteListener.class); | |
38 | -// delegate.registerInterface(RenderListener.class); | |
39 | -// delegate.registerInterface(PostRenderListener.class); | |
40 | -// delegate.registerInterface(ChatFilter.class); | |
41 | -// delegate.registerInterface(ChatListener.class); | |
42 | -// delegate.registerInterface(ChatRenderListener.class); | |
43 | -// delegate.registerInterface(HUDRenderListener.class); | |
44 | -// delegate.registerInterface(PreJoinGameListener.class); | |
45 | -// delegate.registerInterface(JoinGameListener.class); | |
46 | -// delegate.registerInterface(OutboundChatListener.class); | |
47 | - } | |
48 | - | |
49 | - @Override | |
50 | - public void initProvider() | |
51 | - { | |
52 | - } | |
53 | - | |
54 | - /** | |
55 | - * Late initialisation callback | |
56 | - */ | |
57 | - @Override | |
58 | - protected void onStartupComplete() | |
59 | - { | |
60 | - this.engine.refreshResources(false); | |
61 | - | |
62 | - if (!this.lateInitDone) | |
63 | - { | |
64 | - this.lateInitDone = true; | |
65 | - | |
66 | -// for (InitCompleteListener initMod : this.initListeners) | |
67 | -// { | |
68 | -// try | |
69 | -// { | |
70 | -// LoadingProgress.setMessage("Calling late init for mod %s...", initMod.getName()); | |
71 | -// LiteLoaderLogger.info("Calling late init for mod %s", initMod.getName()); | |
72 | -// initMod.onInitCompleted(this.engine.getClient(), this.loader); | |
73 | -// } | |
74 | -// catch (Throwable th) | |
75 | -// { | |
76 | -// LiteLoaderLogger.warning(th, "Error initialising mod %s", initMod.getName()); | |
77 | -// } | |
78 | -// } | |
79 | - } | |
80 | - | |
81 | - super.onStartupComplete(); | |
82 | - } | |
83 | -} |
java/server/com/mumfrey/liteloader/server/api/LiteLoaderCoreAPIServer.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server.api; | |
2 | - | |
3 | -import java.util.List; | |
4 | - | |
5 | -import net.minecraft.server.MinecraftServer; | |
6 | - | |
7 | -import com.google.common.collect.ImmutableList; | |
8 | -import com.mumfrey.liteloader.api.CoreProvider; | |
9 | -import com.mumfrey.liteloader.api.CustomisationProvider; | |
10 | -import com.mumfrey.liteloader.api.InterfaceProvider; | |
11 | -import com.mumfrey.liteloader.api.Observer; | |
12 | -import com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI; | |
13 | -import com.mumfrey.liteloader.interfaces.ObjectFactory; | |
14 | -import com.mumfrey.liteloader.server.DummyClient; | |
15 | -import com.mumfrey.liteloader.server.LiteLoaderCoreProviderServer; | |
16 | - | |
17 | -/** | |
18 | - * | |
19 | - * @author Adam Mummery-Smith | |
20 | - */ | |
21 | -public class LiteLoaderCoreAPIServer extends LiteLoaderCoreAPI | |
22 | -{ | |
23 | - private static final String PKG_LITELOADER_SERVER = LiteLoaderCoreAPI.PKG_LITELOADER + ".server"; | |
24 | - | |
25 | - private static final String[] requiredTransformers = { | |
26 | - LiteLoaderCoreAPI.PKG_LITELOADER + ".launch.LiteLoaderTransformer" | |
27 | - }; | |
28 | - | |
29 | - private static final String[] requiredDownstreamTransformers = { | |
30 | - LiteLoaderCoreAPIServer.PKG_LITELOADER_SERVER + ".transformers.LiteLoaderCallbackInjectionTransformer" | |
31 | - }; | |
32 | - | |
33 | - private static final String[] defaultPacketTransformers = { | |
34 | - LiteLoaderCoreAPIServer.PKG_LITELOADER_SERVER + ".transformers.ServerChatPacketTransformer", | |
35 | - LiteLoaderCoreAPIServer.PKG_LITELOADER_SERVER + ".transformers.ServerCustomPayloadPacketTransformer" | |
36 | - }; | |
37 | - | |
38 | - private ObjectFactory<DummyClient, MinecraftServer> objectFactory; | |
39 | - | |
40 | - /* (non-Javadoc) | |
41 | - * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredTransformers() | |
42 | - */ | |
43 | - @Override | |
44 | - public String[] getRequiredTransformers() | |
45 | - { | |
46 | - return LiteLoaderCoreAPIServer.requiredTransformers; | |
47 | - } | |
48 | - | |
49 | - /* (non-Javadoc) | |
50 | - * @see com.mumfrey.liteloader.api.LiteAPI#getRequiredDownstreamTransformers() | |
51 | - */ | |
52 | - @Override | |
53 | - public String[] getRequiredDownstreamTransformers() | |
54 | - { | |
55 | - return LiteLoaderCoreAPIServer.requiredDownstreamTransformers; | |
56 | - } | |
57 | - | |
58 | - /* (non-Javadoc) | |
59 | - * @see com.mumfrey.liteloader.api.LiteAPI#getPacketTransformers() | |
60 | - */ | |
61 | - @Override | |
62 | - public String[] getPacketTransformers() | |
63 | - { | |
64 | - return LiteLoaderCoreAPIServer.defaultPacketTransformers; | |
65 | - } | |
66 | - | |
67 | - /* (non-Javadoc) | |
68 | - * @see com.mumfrey.liteloader.api.LiteAPI#getCustomisationProviders() | |
69 | - */ | |
70 | - @Override | |
71 | - public List<CustomisationProvider> getCustomisationProviders() | |
72 | - { | |
73 | - return null; | |
74 | - } | |
75 | - | |
76 | - /* (non-Javadoc) | |
77 | - * @see com.mumfrey.liteloader.api.LiteAPI#getCoreProviders() | |
78 | - */ | |
79 | - @Override | |
80 | - public List<CoreProvider> getCoreProviders() | |
81 | - { | |
82 | - return ImmutableList.<CoreProvider>of | |
83 | - ( | |
84 | - new LiteLoaderCoreProviderServer(this.properties) | |
85 | - ); | |
86 | - } | |
87 | - | |
88 | - | |
89 | - /* (non-Javadoc) | |
90 | - * @see com.mumfrey.liteloader.api.LiteAPI#getInterfaceProviders() | |
91 | - */ | |
92 | - @Override | |
93 | - public List<InterfaceProvider> getInterfaceProviders() | |
94 | - { | |
95 | - ObjectFactory<?, ?> objectFactory = this.getObjectFactory(); | |
96 | - | |
97 | - return ImmutableList.<InterfaceProvider>of | |
98 | - ( | |
99 | - objectFactory.getEventBroker(), | |
100 | - objectFactory.getServerPluginChannels() | |
101 | - ); | |
102 | - } | |
103 | - | |
104 | - /* (non-Javadoc) | |
105 | - * @see com.mumfrey.liteloader.api.LiteAPI#getObservers() | |
106 | - */ | |
107 | - @Override | |
108 | - public List<Observer> getObservers() | |
109 | - { | |
110 | - return null; | |
111 | - } | |
112 | - | |
113 | - @Override | |
114 | - public ObjectFactory<?, ?> getObjectFactory() | |
115 | - { | |
116 | - if (this.objectFactory == null) | |
117 | - { | |
118 | - this.objectFactory = new ObjectFactoryServer(this.environment, this.properties); | |
119 | - } | |
120 | - | |
121 | - return this.objectFactory; | |
122 | - } | |
123 | -} |
java/server/com/mumfrey/liteloader/server/api/ObjectFactoryServer.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server.api; | |
2 | - | |
3 | -import net.minecraft.server.MinecraftServer; | |
4 | - | |
5 | -import com.mumfrey.liteloader.common.GameEngine; | |
6 | -import com.mumfrey.liteloader.core.ClientPluginChannels; | |
7 | -import com.mumfrey.liteloader.core.Events; | |
8 | -import com.mumfrey.liteloader.core.LiteLoader; | |
9 | -import com.mumfrey.liteloader.core.ServerPluginChannels; | |
10 | -import com.mumfrey.liteloader.interfaces.PanelManager; | |
11 | -import com.mumfrey.liteloader.interfaces.ObjectFactory; | |
12 | -import com.mumfrey.liteloader.launch.LoaderEnvironment; | |
13 | -import com.mumfrey.liteloader.launch.LoaderProperties; | |
14 | -import com.mumfrey.liteloader.permissions.PermissionsManagerClient; | |
15 | -import com.mumfrey.liteloader.permissions.PermissionsManagerServer; | |
16 | -import com.mumfrey.liteloader.server.DummyClient; | |
17 | -import com.mumfrey.liteloader.server.GameEngineServer; | |
18 | -import com.mumfrey.liteloader.server.ServerEvents; | |
19 | - | |
20 | -class ObjectFactoryServer implements ObjectFactory<DummyClient, MinecraftServer> | |
21 | -{ | |
22 | - private LoaderEnvironment environment; | |
23 | - | |
24 | - private LoaderProperties properties; | |
25 | - | |
26 | - private ServerEvents serverEvents; | |
27 | - | |
28 | - private GameEngineServer engine; | |
29 | - | |
30 | - private ServerPluginChannels serverPluginChannels; | |
31 | - | |
32 | - ObjectFactoryServer(LoaderEnvironment environment, LoaderProperties properties) | |
33 | - { | |
34 | - this.environment = environment; | |
35 | - this.properties = properties; | |
36 | - } | |
37 | - | |
38 | - @Override | |
39 | - public Events<DummyClient, MinecraftServer> getEventBroker() | |
40 | - { | |
41 | - if (this.serverEvents == null) | |
42 | - { | |
43 | - this.serverEvents = new ServerEvents(LiteLoader.getInstance(), this.getGameEngine(), this.properties); | |
44 | - } | |
45 | - | |
46 | - return this.serverEvents; | |
47 | - } | |
48 | - | |
49 | - @Override | |
50 | - public GameEngine<DummyClient, MinecraftServer> getGameEngine() | |
51 | - { | |
52 | - if (this.engine == null) | |
53 | - { | |
54 | - this.engine = new GameEngineServer(this.environment); | |
55 | - } | |
56 | - | |
57 | - return this.engine; | |
58 | - } | |
59 | - | |
60 | - @Override | |
61 | - public PanelManager<Object> getModPanelManager() | |
62 | - { | |
63 | - return null; | |
64 | - } | |
65 | - | |
66 | - @Override | |
67 | - public ClientPluginChannels getClientPluginChannels() | |
68 | - { | |
69 | - return null; | |
70 | - } | |
71 | - | |
72 | - @Override | |
73 | - public ServerPluginChannels getServerPluginChannels() | |
74 | - { | |
75 | - if (this.serverPluginChannels == null) | |
76 | - { | |
77 | - this.serverPluginChannels = new ServerPluginChannels(); | |
78 | - } | |
79 | - | |
80 | - return this.serverPluginChannels; | |
81 | - } | |
82 | - | |
83 | - @Override | |
84 | - public PermissionsManagerClient getClientPermissionManager() | |
85 | - { | |
86 | - return null; | |
87 | - } | |
88 | - | |
89 | - @Override | |
90 | - public PermissionsManagerServer getServerPermissionManager() | |
91 | - { | |
92 | - // TODO Auto-generated method stub | |
93 | - return null; | |
94 | - } | |
95 | - | |
96 | - @Override | |
97 | - public void preBeginGame() | |
98 | - { | |
99 | - } | |
100 | -} |
java/server/com/mumfrey/liteloader/server/resources/ServerResourceManager.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server.resources; | |
2 | - | |
3 | -import java.io.IOException; | |
4 | -import java.util.HashMap; | |
5 | -import java.util.List; | |
6 | -import java.util.Map; | |
7 | -import java.util.Set; | |
8 | - | |
9 | -import com.mumfrey.liteloader.common.LoadingProgress; | |
10 | -import com.mumfrey.liteloader.launch.LoaderEnvironment; | |
11 | - | |
12 | -import net.minecraft.client.resources.IResource; | |
13 | -import net.minecraft.client.resources.IResourceManager; | |
14 | -import net.minecraft.client.resources.IResourcePack; | |
15 | -import net.minecraft.util.ResourceLocation; | |
16 | - | |
17 | -public class ServerResourceManager implements IResourceManager | |
18 | -{ | |
19 | - private final LoaderEnvironment environment; | |
20 | - | |
21 | - /** | |
22 | - * Registered resource packs | |
23 | - */ | |
24 | - private final Map<String, IResourcePack> registeredResourcePacks = new HashMap<String, IResourcePack>(); | |
25 | - | |
26 | - /** | |
27 | - * True while initialising mods if we need to do a resource manager reload once the process is completed | |
28 | - */ | |
29 | - private boolean pendingResourceReload; | |
30 | - | |
31 | - public ServerResourceManager(LoaderEnvironment environment) | |
32 | - { | |
33 | - this.environment = environment; | |
34 | - } | |
35 | - | |
36 | - @Override | |
37 | - public Set<String> getResourceDomains() | |
38 | - { | |
39 | - return null; | |
40 | - } | |
41 | - | |
42 | - @Override | |
43 | - public IResource getResource(ResourceLocation var1) throws IOException | |
44 | - { | |
45 | - return null; | |
46 | - } | |
47 | - | |
48 | - @Override | |
49 | - public List<IResource> getAllResources(ResourceLocation var1) throws IOException | |
50 | - { | |
51 | - return null; | |
52 | - } | |
53 | - | |
54 | - public void refreshResources(boolean force) | |
55 | - { | |
56 | - if (this.pendingResourceReload || force) | |
57 | - { | |
58 | - LoadingProgress.setMessage("Reloading Resources..."); | |
59 | - this.pendingResourceReload = false; | |
60 | -// this.engine.refreshResources(); | |
61 | - } | |
62 | - } | |
63 | - | |
64 | - public boolean registerResourcePack(IResourcePack resourcePack) | |
65 | - { | |
66 | - if (!this.registeredResourcePacks.containsKey(resourcePack.getPackName())) | |
67 | - { | |
68 | - this.pendingResourceReload = true; | |
69 | - this.registeredResourcePacks.put(resourcePack.getPackName(), resourcePack); | |
70 | - return true; | |
71 | - } | |
72 | - | |
73 | - return false; | |
74 | - } | |
75 | -} |
java/server/com/mumfrey/liteloader/server/transformers/LiteLoaderCallbackInjectionTransformer.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server.transformers; | |
2 | - | |
3 | -import org.objectweb.asm.Type; | |
4 | - | |
5 | -import com.mumfrey.liteloader.core.runtime.Obf; | |
6 | -import com.mumfrey.liteloader.transformers.Callback; | |
7 | -import com.mumfrey.liteloader.transformers.CallbackInjectionTransformer; | |
8 | -import com.mumfrey.liteloader.transformers.Callback.CallbackType; | |
9 | - | |
10 | -/** | |
11 | - * Transformer which injects method calls in place of the old profiler hook | |
12 | - * | |
13 | - * @author Adam Mummery-Smith | |
14 | - */ | |
15 | -public final class LiteLoaderCallbackInjectionTransformer extends CallbackInjectionTransformer | |
16 | -{ | |
17 | - /** | |
18 | - * Add mappings | |
19 | - */ | |
20 | - @Override | |
21 | - protected void addCallbacks() | |
22 | - { | |
23 | - this.addCallbacks(Obf.MCP); // @MCPONLY | |
24 | - this.addCallbacks(Obf.SRG); | |
25 | - this.addCallbacks(Obf.OBF); | |
26 | - } | |
27 | - | |
28 | - private void addCallbacks(int type) | |
29 | - { | |
30 | -// this.addCallback(type, Obf.Minecraft, Obf.runGameLoop, "()V", new Callback(CallbackType.PROFILER_STARTSECTION, "onTimerUpdate", Obf.CallbackProxyServer.ref, "tick", type)); | |
31 | -// this.addCallback(type, Obf.Minecraft, Obf.runGameLoop, "()V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "onRender", Obf.CallbackProxyServer.ref, "gameRenderer", type)); | |
32 | -// this.addCallback(type, Obf.Minecraft, Obf.runTick, "()V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "onAnimateTick", Obf.CallbackProxyServer.ref, "animateTick", type)); | |
33 | -// this.addCallback(type, Obf.Minecraft, Obf.runGameLoop, "()V", new Callback(CallbackType.PROFILER_ENDSECTION, "onTick", Obf.CallbackProxyServer.ref, "", type)); // ref 2 | |
34 | -// this.addCallback(type, Obf.EntityRenderer, Obf.updateCameraAndRender, "(F)V", new Callback(CallbackType.PROFILER_ENDSECTION, "preRenderGUI", Obf.CallbackProxyServer.ref, "", type)); // ref 1 | |
35 | -// this.addCallback(type, Obf.EntityRenderer, Obf.updateCameraAndRender, "(F)V", new Callback(CallbackType.PROFILER_ENDSECTION, "postRenderHUDandGUI", Obf.CallbackProxyServer.ref, "", type)); // ref 2 | |
36 | -// this.addCallback(type, Obf.EntityRenderer, Obf.updateCameraAndRender, "(F)V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "onRenderHUD", Obf.CallbackProxyServer.ref, "gui", type)); | |
37 | -// this.addCallback(type, Obf.EntityRenderer, Obf.renderWorld, "(FJ)V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "onSetupCameraTransform", Obf.CallbackProxyServer.ref, "frustrum", type)); | |
38 | -// this.addCallback(type, Obf.EntityRenderer, Obf.renderWorld, "(FJ)V", new Callback(CallbackType.PROFILER_ENDSTARTSECTION, "postRenderEntities", Obf.CallbackProxyServer.ref, "litParticles", type)); | |
39 | -// this.addCallback(type, Obf.EntityRenderer, Obf.renderWorld, "(FJ)V", new Callback(CallbackType.PROFILER_ENDSECTION, "postRender", Obf.CallbackProxyServer.ref, "", type)); | |
40 | -// this.addCallback(type, Obf.GuiIngame, Obf.renderGameOverlay, "(FZII)V", new Callback(CallbackType.PROFILER_STARTSECTION, "onRenderChat", Obf.CallbackProxyServer.ref, "chat", type)); | |
41 | -// this.addCallback(type, Obf.GuiIngame, Obf.renderGameOverlay, "(FZII)V", new Callback(CallbackType.PROFILER_ENDSECTION, "postRenderChat", Obf.CallbackProxyServer.ref, "", type)); // ref 10 | |
42 | -// | |
43 | -// String integratedServerCtorDescriptor = Callback.generateDescriptor(type, Type.VOID_TYPE, Obf.Minecraft, String.class, String.class, Obf.WorldSettings); | |
44 | - String initPlayerConnectionDescriptor = Callback.generateDescriptor(type, Type.VOID_TYPE, Obf.NetworkManager, Obf.EntityPlayerMP); | |
45 | - String playerLoggedInOutDescriptor = Callback.generateDescriptor(type, Type.VOID_TYPE, Obf.EntityPlayerMP); | |
46 | - String spawnPlayerDescriptor = Callback.generateDescriptor(type, Obf.EntityPlayerMP, Obf.GameProfile); | |
47 | - String respawnPlayerDescriptor = Callback.generateDescriptor(type, Obf.EntityPlayerMP, Obf.EntityPlayerMP, Type.INT_TYPE, Type.BOOLEAN_TYPE); | |
48 | -// | |
49 | -// this.addCallback(type, Obf.IntegratedServer, Obf.constructor, integratedServerCtorDescriptor, new Callback(CallbackType.RETURN, "IntegratedServerCtor", Obf.CallbackProxyServer.ref)); | |
50 | - this.addCallback(type, Obf.ServerConfigurationManager, Obf.initializeConnectionToPlayer, initPlayerConnectionDescriptor, new Callback(CallbackType.RETURN, "onInitializePlayerConnection", Obf.CallbackProxyServer.ref)); | |
51 | - this.addCallback(type, Obf.ServerConfigurationManager, Obf.playerLoggedIn, playerLoggedInOutDescriptor, new Callback(CallbackType.RETURN, "onPlayerLogin", Obf.CallbackProxyServer.ref)); | |
52 | - this.addCallback(type, Obf.ServerConfigurationManager, Obf.playerLoggedOut, playerLoggedInOutDescriptor, new Callback(CallbackType.RETURN, "onPlayerLogout", Obf.CallbackProxyServer.ref)); | |
53 | - this.addCallback(type, Obf.ServerConfigurationManager, Obf.spawnPlayer, spawnPlayerDescriptor, new Callback(CallbackType.RETURN, "onSpawnPlayer", Obf.CallbackProxyServer.ref)); | |
54 | - this.addCallback(type, Obf.ServerConfigurationManager, Obf.respawnPlayer, respawnPlayerDescriptor, new Callback(CallbackType.RETURN, "onRespawnPlayer", Obf.CallbackProxyServer.ref)); | |
55 | -// this.addCallback(type, Obf.C01PacketChatMessage, Obf.constructor, "(Ljava/lang/String;)V", new Callback(CallbackType.RETURN, "onOutboundChat", Obf.CallbackProxyServer.ref)); | |
56 | - this.addCallback(type, Obf.DedicatedServer, Obf.startServer, "()Z", new Callback(CallbackType.RETURN, "onStartupComplete", Obf.CallbackProxyServer.ref)); | |
57 | - this.addCallback(type, Obf.MinecraftServer, Obf.startServerThread, "()V", new Callback(CallbackType.EVENT, "init", Obf.CallbackProxyServer.ref)); | |
58 | - } | |
59 | - | |
60 | - /** | |
61 | - * @param type | |
62 | - * @param className | |
63 | - * @param methodName | |
64 | - * @param methodSignature | |
65 | - * @param invokeMethod | |
66 | - * @param section | |
67 | - * @param callback | |
68 | - */ | |
69 | - private void addCallback(int type, Obf className, Obf methodName, String methodSignature, Callback callback) | |
70 | - { | |
71 | - this.addCallback(className.names[type], methodName.names[type], methodSignature, callback); | |
72 | - } | |
73 | -} |
java/server/com/mumfrey/liteloader/server/transformers/ServerChatPacketTransformer.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server.transformers; | |
2 | - | |
3 | -import com.mumfrey.liteloader.core.runtime.Obf; | |
4 | -import com.mumfrey.liteloader.transformers.PacketTransformer; | |
5 | - | |
6 | -/** | |
7 | - * Transformer for S02PacketChat | |
8 | - * | |
9 | - * @author Adam Mummery-Smith | |
10 | - */ | |
11 | -public class ServerChatPacketTransformer extends PacketTransformer | |
12 | -{ | |
13 | - private static boolean injected = false; | |
14 | - | |
15 | - public ServerChatPacketTransformer() | |
16 | - { | |
17 | - super(Obf.C01PacketChatMessage, Obf.CallbackProxyServer.name, "handleServerChatPacket", 1000); | |
18 | - } | |
19 | - | |
20 | - @Override | |
21 | - protected void notifyInjectionFailed() | |
22 | - { | |
23 | - } | |
24 | - | |
25 | - @Override | |
26 | - protected void notifyInjected() | |
27 | - { | |
28 | - ServerChatPacketTransformer.injected = true; | |
29 | - } | |
30 | - | |
31 | - public static boolean isInjected() | |
32 | - { | |
33 | - return ServerChatPacketTransformer.injected; | |
34 | - } | |
35 | -} |
java/server/com/mumfrey/liteloader/server/transformers/ServerCustomPayloadPacketTransformer.java deleted
100644 → 0
1 | -package com.mumfrey.liteloader.server.transformers; | |
2 | - | |
3 | -import com.mumfrey.liteloader.core.runtime.Obf; | |
4 | -import com.mumfrey.liteloader.transformers.PacketTransformer; | |
5 | - | |
6 | -/** | |
7 | - * Transformer for C17PacketCustomPayload | |
8 | - * | |
9 | - * @author Adam Mummery-Smith | |
10 | - */ | |
11 | -public class ServerCustomPayloadPacketTransformer extends PacketTransformer | |
12 | -{ | |
13 | - private static boolean injected = false; | |
14 | - | |
15 | - public ServerCustomPayloadPacketTransformer() | |
16 | - { | |
17 | - super(Obf.C17PacketCustomPayload, Obf.CallbackProxyServer.name, "handleCustomPayloadPacket", 1000); | |
18 | - } | |
19 | - | |
20 | - @Override | |
21 | - protected void notifyInjectionFailed() | |
22 | - { | |
23 | - } | |
24 | - | |
25 | - @Override | |
26 | - protected void notifyInjected() | |
27 | - { | |
28 | - ServerCustomPayloadPacketTransformer.injected = true; | |
29 | - } | |
30 | - | |
31 | - public static boolean isInjected() | |
32 | - { | |
33 | - return ServerCustomPayloadPacketTransformer.injected; | |
34 | - } | |
35 | -} |