LiteLoaderCoreAPIClient.java
4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package com.mumfrey.liteloader.client.api;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.server.integrated.IntegratedServer;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ObjectArrays;
import com.mumfrey.liteloader.api.CoreProvider;
import com.mumfrey.liteloader.api.CustomisationProvider;
import com.mumfrey.liteloader.api.InterfaceProvider;
import com.mumfrey.liteloader.api.Observer;
import com.mumfrey.liteloader.client.LiteLoaderCoreProviderClient;
import com.mumfrey.liteloader.client.ResourceObserver;
import com.mumfrey.liteloader.client.Translator;
import com.mumfrey.liteloader.core.LiteLoader;
import com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI;
import com.mumfrey.liteloader.interfaces.ObjectFactory;
import com.mumfrey.liteloader.messaging.MessageBus;
import com.mumfrey.liteloader.transformers.event.json.ModEvents;
/**
* Client side of the core API
*
* @author Adam Mummery-Smith
*/
public class LiteLoaderCoreAPIClient extends LiteLoaderCoreAPI
{
private static final String PKG_LITELOADER_CLIENT = LiteLoaderCoreAPI.PKG_LITELOADER + ".client";
private static final String[] requiredTransformers = {
LiteLoaderCoreAPI.PKG_LITELOADER + ".transformers.event.EventProxyTransformer",
LiteLoaderCoreAPI.PKG_LITELOADER + ".launch.LiteLoaderTransformer",
LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.CrashReportTransformer"
};
private static final String[] requiredDownstreamTransformers = {
LiteLoaderCoreAPI.PKG_LITELOADER_COMMON + ".transformers.LiteLoaderPacketTransformer",
LiteLoaderCoreAPIClient.PKG_LITELOADER_CLIENT + ".transformers.MinecraftTransformer",
LiteLoaderCoreAPI.PKG_LITELOADER + ".transformers.event.json.ModEventInjectionTransformer"
};
private ObjectFactory<Minecraft, IntegratedServer> objectFactory;
@Override
public String[] getMixinConfigs()
{
String[] commonConfigs = super.getMixinConfigs();
return ObjectArrays.concat(commonConfigs, new String[] {
"mixins.liteloader.client.json"
}, String.class);
}
/* (non-Javadoc)
* @see com.mumfrey.liteloader.api.LiteAPI#getRequiredTransformers()
*/
@Override
public String[] getRequiredTransformers()
{
return LiteLoaderCoreAPIClient.requiredTransformers;
}
/* (non-Javadoc)
* @see com.mumfrey.liteloader.api.LiteAPI
* #getRequiredDownstreamTransformers()
*/
@Override
public String[] getRequiredDownstreamTransformers()
{
return LiteLoaderCoreAPIClient.requiredDownstreamTransformers;
}
/* (non-Javadoc)
* @see com.mumfrey.liteloader.api.LiteAPI#getCustomisationProviders()
*/
@Override
public List<CustomisationProvider> getCustomisationProviders()
{
return ImmutableList.<CustomisationProvider>of
(
new LiteLoaderBrandingProvider(),
new LiteLoaderModInfoDecorator(),
new Translator()
);
}
/* (non-Javadoc)
* @see com.mumfrey.liteloader.api.LiteAPI#getCoreProviders()
*/
@Override
public List<CoreProvider> getCoreProviders()
{
return ImmutableList.<CoreProvider>of
(
new LiteLoaderCoreProviderClient(this.properties),
LiteLoader.getInput()
);
}
/* (non-Javadoc)
* @see com.mumfrey.liteloader.api.LiteAPI#getInterfaceProviders()
*/
@Override
public List<InterfaceProvider> getInterfaceProviders()
{
ObjectFactory<?, ?> objectFactory = this.getObjectFactory();
return ImmutableList.<InterfaceProvider>of
(
objectFactory.getEventBroker(),
objectFactory.getPacketEventBroker(),
objectFactory.getClientPluginChannels(),
objectFactory.getServerPluginChannels(),
MessageBus.getInstance()
);
}
/* (non-Javadoc)
* @see com.mumfrey.liteloader.api.LiteAPI#getPreInitObservers()
*/
@Override
public List<Observer> getPreInitObservers()
{
return ImmutableList.<Observer>of
(
new ModEvents()
);
}
/* (non-Javadoc)
* @see com.mumfrey.liteloader.api.LiteAPI#getObservers()
*/
@Override
public List<Observer> getObservers()
{
ObjectFactory<?, ?> objectFactory = this.getObjectFactory();
return ImmutableList.<Observer>of
(
new ResourceObserver(),
objectFactory.getPanelManager(),
objectFactory.getEventBroker()
);
}
/* (non-Javadoc)
* @see com.mumfrey.liteloader.core.api.LiteLoaderCoreAPI#getObjectFactory()
*/
@Override
public ObjectFactory<?, ?> getObjectFactory()
{
if (this.objectFactory == null)
{
this.objectFactory = new ObjectFactoryClient(this.environment, this.properties);
}
return this.objectFactory;
}
}