mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24d72852e7 | ||
|
|
cedf3d55d5 | ||
|
|
d915f39996 | ||
|
|
346691c298 | ||
|
|
6dadc1d889 | ||
|
|
8a55f68a18 | ||
|
|
5645fa5847 | ||
|
|
ff0f00f64f | ||
|
|
7a34246dc9 | ||
|
|
62a6b52487 | ||
|
|
b845cde73d | ||
|
|
2c36dfbb34 | ||
|
|
acd880dd2a | ||
|
|
e6f57e5d94 | ||
|
|
b1de0fc17c | ||
|
|
ad4461932f | ||
|
|
3a94211377 | ||
|
|
9386e23b1f | ||
|
|
10b318c71d | ||
|
|
995d5b7b3a | ||
|
|
bbb12c84fd | ||
|
|
b50058ee47 | ||
|
|
4a0bfa937a | ||
|
|
4d1ec666dd | ||
|
|
b52e3d0e7d | ||
|
|
a1011c99a9 | ||
|
|
0ebd4f3d94 | ||
|
|
89c68c46a2 | ||
|
|
e4702cb09d | ||
|
|
6e64fd7a11 | ||
|
|
014b3f4ad5 | ||
|
|
7628c67883 | ||
|
|
54a322c09f | ||
|
|
aadf396244 | ||
|
|
81e18552e3 | ||
|
|
5686fd40a4 | ||
|
|
989ab3e96b | ||
|
|
88f1dc97b6 | ||
|
|
470a18522c | ||
|
|
002951804a | ||
|
|
fe7a832fad | ||
|
|
a2bc30b356 | ||
|
|
bae1f74681 | ||
|
|
887aa277a4 | ||
|
|
e17f2677c7 | ||
|
|
3b9972af39 | ||
|
|
5c96afec70 | ||
|
|
1bca393ecb | ||
|
|
27cf731552 | ||
|
|
94c84cd994 | ||
|
|
c2d3195e76 | ||
|
|
d0e7c9e2ea | ||
|
|
f3e1cac5a1 | ||
|
|
51fb513213 | ||
|
|
65c9fdd8d7 | ||
|
|
c1d4458acc | ||
|
|
ca1ca4f944 | ||
|
|
15ee8bf5a1 | ||
|
|
a08b5b19d5 | ||
|
|
8dac58ffc1 | ||
|
|
f0837070d6 | ||
|
|
dd7502a051 | ||
|
|
b36d4471e6 | ||
|
|
efb1066a88 | ||
|
|
dd39ae540b | ||
|
|
b39f808618 | ||
|
|
a2c059e562 | ||
|
|
19316a0d38 | ||
|
|
fbc7a5c063 | ||
|
|
e9cfd10e39 | ||
|
|
1424883773 | ||
|
|
6c746ec6d9 | ||
|
|
aacbfeb66e | ||
|
|
1513b369d3 | ||
|
|
35852a69fb | ||
|
|
96537dc091 | ||
|
|
e88ddc56ca | ||
|
|
f24ff07b30 | ||
|
|
3420ea7a2d | ||
|
|
87104f0e2d | ||
|
|
640446b868 | ||
|
|
2cf4917ded | ||
|
|
6394ee8714 | ||
|
|
7299e05fe1 | ||
|
|
c4bd0405fd | ||
|
|
89b8236a9c |
No files matched your search
+7
-1
@@ -1 +1,7 @@
|
||||
* text=auto
|
||||
* text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.patch text
|
||||
*.png binary
|
||||
*.exe binary
|
||||
*.dll binary
|
||||
*.zip binary
|
||||
@@ -4,8 +4,6 @@
|
||||
/fmlbuild.properties
|
||||
/fmlversion.properties
|
||||
/difflist.txt
|
||||
/.metadata/
|
||||
/eclipse/.metadata/
|
||||
/target
|
||||
fmlbranding.properties
|
||||
/fernflower.zip
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
<jar destfile="${basedir}/target/${universal.jarname}.zip" duplicate="preserve">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="net.minecraft.server.MinecraftServer"/>
|
||||
<attribute name="Class-Path" value="minecraft_server.jar"/>
|
||||
</manifest>
|
||||
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" />
|
||||
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import cpw.mods.fml.common.IFMLHandledException;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
import net.minecraft.src.FontRenderer;
|
||||
import net.minecraft.src.GuiErrorScreen;
|
||||
|
||||
/**
|
||||
* If a mod throws this exception during loading, it will be called back to render
|
||||
* the error screen through the methods below. This error will not be cleared, and will
|
||||
* not allow the game to carry on, but might be useful if your mod wishes to report
|
||||
* a fatal configuration error in a pretty way.
|
||||
*
|
||||
* Throw this through a proxy. It won't work on the dedicated server environment.
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class CustomModLoadingErrorDisplayException extends RuntimeException implements IFMLHandledException
|
||||
{
|
||||
/**
|
||||
* Called after the GUI is inited by the parent code. You can do extra stuff here, maybe?
|
||||
*
|
||||
* @param errorScreen The error screen we're painting
|
||||
* @param fontRenderer A font renderer for you
|
||||
*/
|
||||
public abstract void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer);
|
||||
|
||||
/**
|
||||
* Draw your error to the screen.
|
||||
*
|
||||
* <br/><em>Warning: Minecraft is in a deep error state.</em> <strong>All</strong> it can do is stop.
|
||||
* Do not try and do anything involving complex user interaction here.
|
||||
*
|
||||
* @param errorScreen The error screen to draw to
|
||||
* @param fontRenderer A font renderer for you
|
||||
* @param mouseRelX Mouse X
|
||||
* @param mouseRelY Mouse Y
|
||||
* @param tickTime tick time
|
||||
*/
|
||||
public abstract void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime);
|
||||
}
|
||||
@@ -43,6 +43,7 @@ import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.DummyModContainer;
|
||||
import cpw.mods.fml.common.DuplicateModsFoundException;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.IFMLSidedHandler;
|
||||
@@ -54,6 +55,7 @@ import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
||||
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||
import cpw.mods.fml.common.network.ModMissingPacket;
|
||||
@@ -66,8 +68,8 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
/**
|
||||
* Handles primary communication from hooked code into the system
|
||||
*
|
||||
* The FML entry point is {@link #beginMinecraftLoading(MinecraftServer)} called from
|
||||
* {@link MinecraftServer}
|
||||
* The FML entry point is {@link #beginMinecraftLoading(Minecraft)} called from
|
||||
* {@link Minecraft}
|
||||
*
|
||||
* Obfuscated code should focus on this class and other members of the "server"
|
||||
* (or "client") code
|
||||
@@ -94,13 +96,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
*/
|
||||
private Minecraft client;
|
||||
|
||||
/**
|
||||
* Called to start the whole game off from
|
||||
* {@link MinecraftServer#startServer}
|
||||
*
|
||||
* @param minecraftServer
|
||||
*/
|
||||
|
||||
private DummyModContainer optifineContainer;
|
||||
|
||||
private boolean guiLoaded;
|
||||
@@ -111,6 +106,18 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
|
||||
private boolean loading;
|
||||
|
||||
private WrongMinecraftVersionException wrongMC;
|
||||
|
||||
private CustomModLoadingErrorDisplayException customError;
|
||||
|
||||
private DuplicateModsFoundException dupesFound;
|
||||
|
||||
/**
|
||||
* Called to start the whole game off from
|
||||
* {@link MinecraftServer#startServer}
|
||||
*
|
||||
* @param minecraftServer
|
||||
*/
|
||||
public void beginMinecraftLoading(Minecraft minecraft)
|
||||
{
|
||||
if (minecraft.func_71355_q())
|
||||
@@ -143,10 +150,23 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
{
|
||||
Loader.instance().loadMods();
|
||||
}
|
||||
catch (WrongMinecraftVersionException wrong)
|
||||
{
|
||||
wrongMC = wrong;
|
||||
}
|
||||
catch (DuplicateModsFoundException dupes)
|
||||
{
|
||||
dupesFound = dupes;
|
||||
}
|
||||
catch (MissingModsException missing)
|
||||
{
|
||||
modsMissing = missing;
|
||||
}
|
||||
catch (CustomModLoadingErrorDisplayException custom)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
|
||||
customError = custom;
|
||||
}
|
||||
catch (LoaderException le)
|
||||
{
|
||||
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
|
||||
@@ -168,7 +188,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
@SuppressWarnings("deprecation")
|
||||
public void finishMinecraftLoading()
|
||||
{
|
||||
if (modsMissing != null)
|
||||
if (modsMissing != null || wrongMC != null || customError!=null || dupesFound!=null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -176,6 +196,12 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
{
|
||||
Loader.instance().initializeMods();
|
||||
}
|
||||
catch (CustomModLoadingErrorDisplayException custom)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, custom, "A custom exception was thrown by a mod, the game will now halt");
|
||||
customError = custom;
|
||||
return;
|
||||
}
|
||||
catch (LoaderException le)
|
||||
{
|
||||
haltGame("There was a severe problem during mod loading that has caused the game to fail", le);
|
||||
@@ -190,10 +216,22 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
|
||||
public void onInitializationComplete()
|
||||
{
|
||||
if (modsMissing != null)
|
||||
if (wrongMC != null)
|
||||
{
|
||||
client.func_71373_a(new GuiWrongMinecraft(wrongMC));
|
||||
}
|
||||
else if (modsMissing != null)
|
||||
{
|
||||
client.func_71373_a(new GuiModsMissing(modsMissing));
|
||||
}
|
||||
else if (dupesFound != null)
|
||||
{
|
||||
client.func_71373_a(new GuiDupesFound(dupesFound));
|
||||
}
|
||||
else if (customError != null)
|
||||
{
|
||||
client.func_71373_a(new GuiCustomModLoadingErrorScreen(customError));
|
||||
}
|
||||
else
|
||||
{
|
||||
TextureFXManager.instance().loadTextures(client.field_71418_C.func_77292_e());
|
||||
@@ -201,8 +239,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
}
|
||||
/**
|
||||
* Get the server instance
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Minecraft getClient()
|
||||
{
|
||||
@@ -308,7 +344,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
|
||||
if (entity instanceof IThrowableEntity)
|
||||
{
|
||||
Entity thrower = client.field_71439_g.field_70157_k == packet.throwerId ? client.field_71439_g : wc.func_73024_a(packet.throwerId);
|
||||
Entity thrower = client.field_71439_g.field_70157_k == packet.throwerId ? client.field_71439_g : wc.func_73045_a(packet.throwerId);
|
||||
((IThrowableEntity)entity).setThrower(thrower);
|
||||
}
|
||||
|
||||
@@ -352,7 +388,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
@Override
|
||||
public void adjustEntityLocationOnClient(EntitySpawnAdjustmentPacket packet)
|
||||
{
|
||||
Entity ent = client.field_71441_e.func_73024_a(packet.entityId);
|
||||
Entity ent = client.field_71441_e.func_73045_a(packet.entityId);
|
||||
if (ent != null)
|
||||
{
|
||||
ent.field_70118_ct = packet.serverX;
|
||||
@@ -386,7 +422,10 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
@Override
|
||||
public void sendPacket(Packet packet)
|
||||
{
|
||||
client.field_71439_g.field_71174_a.func_72552_c(packet);
|
||||
if(client.field_71439_g != null)
|
||||
{
|
||||
client.field_71439_g.field_71174_a.func_72552_c(packet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -397,7 +436,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
|
||||
/**
|
||||
* If the client is in the midst of loading, we disable saving so that custom settings aren't wiped out
|
||||
* @return
|
||||
*/
|
||||
public boolean isLoading()
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import net.minecraft.src.RenderEngine;
|
||||
import net.minecraft.src.TextureFX;
|
||||
import net.minecraft.src.TexturePackBase;
|
||||
import net.minecraft.src.ITexturePack;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class FMLTextureFX extends TextureFX implements ITextureFX
|
||||
@Override public void setErrored(boolean err){ errored = err; }
|
||||
@Override public boolean getErrored(){ return errored; }
|
||||
@Override
|
||||
public void onTexturePackChanged(RenderEngine engine, TexturePackBase texturepack, Dimension dimensions)
|
||||
public void onTexturePackChanged(RenderEngine engine, ITexturePack texturepack, Dimension dimensions)
|
||||
{
|
||||
onTextureDimensionsUpdate(dimensions.width, dimensions.height);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
||||
import net.minecraft.src.GuiErrorScreen;
|
||||
|
||||
public class GuiCustomModLoadingErrorScreen extends GuiErrorScreen
|
||||
{
|
||||
private CustomModLoadingErrorDisplayException customException;
|
||||
public GuiCustomModLoadingErrorScreen(CustomModLoadingErrorDisplayException customException)
|
||||
{
|
||||
this.customException = customException;
|
||||
}
|
||||
@Override
|
||||
public void func_73866_w_()
|
||||
{
|
||||
super.func_73866_w_();
|
||||
this.customException.initGui(this, field_73886_k);
|
||||
}
|
||||
@Override
|
||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||
{
|
||||
this.func_73873_v_();
|
||||
this.customException.drawScreen(this, field_73886_k, p_73863_1_, p_73863_2_, p_73863_3_);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import cpw.mods.fml.common.DuplicateModsFoundException;
|
||||
import cpw.mods.fml.common.MissingModsException;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import net.minecraft.src.GuiErrorScreen;
|
||||
|
||||
public class GuiDupesFound extends GuiErrorScreen
|
||||
{
|
||||
|
||||
private DuplicateModsFoundException dupes;
|
||||
|
||||
public GuiDupesFound(DuplicateModsFoundException dupes)
|
||||
{
|
||||
this.dupes = dupes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_73866_w_()
|
||||
{
|
||||
super.func_73866_w_();
|
||||
}
|
||||
@Override
|
||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||
{
|
||||
this.func_73873_v_();
|
||||
int offset = Math.max(85 - dupes.dupes.size() * 10, 10);
|
||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, "You have mod sources that are duplicate within your system", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, "Mod Id : File name", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=5;
|
||||
for (Entry<ModContainer, File> mc : dupes.dupes.entries())
|
||||
{
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, String.format("%s : %s", mc.getKey().getModId(), mc.getValue().getName()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ import net.minecraft.src.Tessellator;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
|
||||
@@ -44,7 +46,7 @@ public class GuiModList extends GuiScreen
|
||||
private ArrayList<ModContainer> mods;
|
||||
|
||||
/**
|
||||
* @param guiMainMenu
|
||||
* @param mainMenu
|
||||
*/
|
||||
public GuiModList(GuiScreen mainMenu)
|
||||
{
|
||||
@@ -52,8 +54,15 @@ public class GuiModList extends GuiScreen
|
||||
this.mods=new ArrayList<ModContainer>();
|
||||
FMLClientHandler.instance().addSpecialModEntries(mods);
|
||||
for (ModContainer mod : Loader.instance().getModList()) {
|
||||
if (mod.getMetadata()!=null && mod.getMetadata().parentMod != null) {
|
||||
continue;
|
||||
if (mod.getMetadata()!=null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) {
|
||||
String parentMod = mod.getMetadata().parent;
|
||||
ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod);
|
||||
if (parentContainer != null)
|
||||
{
|
||||
mod.getMetadata().parentMod = parentContainer;
|
||||
parentContainer.getMetadata().childMods.add(mod);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
mods.add(mod);
|
||||
}
|
||||
@@ -166,10 +175,6 @@ public class GuiModList extends GuiScreen
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param var1
|
||||
* @return
|
||||
*/
|
||||
public boolean modIndexSelected(int var1)
|
||||
{
|
||||
return var1==selected;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class GuiModsMissing extends GuiErrorScreen
|
||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||
{
|
||||
this.func_73873_v_();
|
||||
int offset = 85 - modsMissing.missingMods.size() * 10;
|
||||
int offset = Math.max(85 - modsMissing.missingMods.size() * 10, 10);
|
||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, "The mods and versions listed below could not be found", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class GuiModsMissingForServer extends GuiScreen
|
||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||
{
|
||||
this.func_73873_v_();
|
||||
int offset = 85 - modsMissing.getModList().size() * 10;
|
||||
int offset = Math.max(85 - modsMissing.getModList().size() * 10, 10);
|
||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader could not connect to this server", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset += 10;
|
||||
this.func_73732_a(this.field_73886_k, "The mods and versions listed below could not be found", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import net.minecraft.src.GuiErrorScreen;
|
||||
import net.minecraft.src.GuiScreen;
|
||||
|
||||
public class GuiWrongMinecraft extends GuiErrorScreen
|
||||
{
|
||||
private WrongMinecraftVersionException wrongMC;
|
||||
public GuiWrongMinecraft(WrongMinecraftVersionException wrongMC)
|
||||
{
|
||||
this.wrongMC = wrongMC;
|
||||
}
|
||||
@Override
|
||||
public void func_73866_w_()
|
||||
{
|
||||
super.func_73866_w_();
|
||||
}
|
||||
@Override
|
||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||
{
|
||||
this.func_73873_v_();
|
||||
int offset = 75;
|
||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, String.format("The mod listed below does not want to run in Minecraft version %s", Loader.instance().getMinecraftModContainer().getVersion()), this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
offset+=5;
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, String.format("%s (%s) wants Minecraft %s", wrongMC.mod.getName(), wrongMC.mod.getModId(), wrongMC.mod.acceptableMinecraftVersionRange()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||
offset+=20;
|
||||
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,11 @@ package cpw.mods.fml.client;
|
||||
import java.awt.Dimension;
|
||||
|
||||
import net.minecraft.src.RenderEngine;
|
||||
import net.minecraft.src.TexturePackBase;
|
||||
import net.minecraft.src.ITexturePack;
|
||||
|
||||
public interface ITextureFX
|
||||
{
|
||||
public void onTexturePackChanged(RenderEngine engine, TexturePackBase texturepack, Dimension dimensions);
|
||||
public void onTexturePackChanged(RenderEngine engine, ITexturePack texturepack, Dimension dimensions);
|
||||
|
||||
public void onTextureDimensionsUpdate(int width, int height);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SpriteHelper
|
||||
SpriteHelper.toBitSet(
|
||||
"0000000000000000" +
|
||||
"0000000000110000" +
|
||||
"0000000001100000" +
|
||||
"0000000000100000" +
|
||||
"0000000001100000" +
|
||||
"0000000000000000" +
|
||||
"0000000000000000" +
|
||||
@@ -43,10 +43,10 @@ public class SpriteHelper
|
||||
"0000000000000000" +
|
||||
"0000000000000000" +
|
||||
"0000000000000000" +
|
||||
"0000000011111111" +
|
||||
"0000000011111000" +
|
||||
"0000000111111100" +
|
||||
"0000000111111000" +
|
||||
"0000000000011111" +
|
||||
"0000000000000000" +
|
||||
"0000000001111100" +
|
||||
"0000000001111000" +
|
||||
"0000000000000000");
|
||||
spriteInfo.put("/terrain.png", slots);
|
||||
|
||||
@@ -57,15 +57,15 @@ public class SpriteHelper
|
||||
"0000000000000000" +
|
||||
"0000000000000000" +
|
||||
"0000000000000000" +
|
||||
"0000001000000000" +
|
||||
"0000001110000000" +
|
||||
"0000001000000000" +
|
||||
"1111101010000000" +
|
||||
"1111101010000000" +
|
||||
"1111101110000000" +
|
||||
"1111111111110000" +
|
||||
"1111111111111111" +
|
||||
"1111111111111111" +
|
||||
"0000000000000000" +
|
||||
"0000000000000000" +
|
||||
"0000000000000000" +
|
||||
"0111100000000000" +
|
||||
"1111100010000000" +
|
||||
"0000101110000000" +
|
||||
"0111000000000000" +
|
||||
"1100001100001111" +
|
||||
"0000000000001111" +
|
||||
"0000000000000000");
|
||||
spriteInfo.put("/gui/items.png", slots);
|
||||
}
|
||||
@@ -130,10 +130,6 @@ public class SpriteHelper
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param textureToOverride
|
||||
* @return
|
||||
*/
|
||||
public static int freeSlotCount(String textureToOverride)
|
||||
{
|
||||
return spriteInfo.get(textureToOverride).cardinality();
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.src.ModTextureStatic;
|
||||
import net.minecraft.src.RenderEngine;
|
||||
import net.minecraft.src.TextureFX;
|
||||
import net.minecraft.src.TexturePackBase;
|
||||
import net.minecraft.src.ITexturePack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -171,7 +171,7 @@ public class TextureFXManager
|
||||
return id;
|
||||
}
|
||||
|
||||
public void onTexturePackChange(RenderEngine engine, TexturePackBase texturepack, List<TextureFX> effects)
|
||||
public void onTexturePackChange(RenderEngine engine, ITexturePack texturepack, List<TextureFX> effects)
|
||||
{
|
||||
pruneOldTextureFX(texturepack, effects);
|
||||
|
||||
@@ -188,7 +188,7 @@ public class TextureFXManager
|
||||
|
||||
private HashMap<Integer, Dimension> textureDims = new HashMap<Integer, Dimension>();
|
||||
private IdentityHashMap<TextureFX, Integer> effectTextures = new IdentityHashMap<TextureFX, Integer>();
|
||||
private TexturePackBase earlyTexturePack;
|
||||
private ITexturePack earlyTexturePack;
|
||||
public void setTextureDimensions(int id, int width, int height, List<TextureFX> effects)
|
||||
{
|
||||
Dimension dim = new Dimension(width, height);
|
||||
@@ -213,9 +213,6 @@ public class TextureFXManager
|
||||
return textureDims.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param anim
|
||||
*/
|
||||
public void addAnimation(TextureFX anim)
|
||||
{
|
||||
OverrideInfo info=new OverrideInfo();
|
||||
@@ -229,10 +226,7 @@ public class TextureFXManager
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param p_6531_1_
|
||||
*/
|
||||
public void loadTextures(TexturePackBase texturePack)
|
||||
public void loadTextures(ITexturePack texturePack)
|
||||
{
|
||||
registerTextureOverrides(client.field_71446_o);
|
||||
}
|
||||
@@ -263,17 +257,11 @@ public class TextureFXManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mod
|
||||
*/
|
||||
protected void registerAnimatedTexturesFor(ModContainer mod)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param field_6539_c
|
||||
*/
|
||||
public void onEarlyTexturePackLoad(TexturePackBase fallback)
|
||||
public void onEarlyTexturePackLoad(ITexturePack fallback)
|
||||
{
|
||||
if (client==null) {
|
||||
// We're far too early- let's wait
|
||||
@@ -284,7 +272,7 @@ public class TextureFXManager
|
||||
}
|
||||
|
||||
|
||||
public void pruneOldTextureFX(TexturePackBase var1, List<TextureFX> effects)
|
||||
public void pruneOldTextureFX(ITexturePack var1, List<TextureFX> effects)
|
||||
{
|
||||
ListIterator<TextureFX> li = addedTextureFX.listIterator();
|
||||
while (li.hasNext())
|
||||
@@ -313,11 +301,6 @@ public class TextureFXManager
|
||||
FMLLog.fine("Overriding %s @ %d with %s. %d slots remaining",textureToOverride, location, overridingTexturePath, SpriteHelper.freeSlotCount(textureToOverride));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param renderEngine
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException
|
||||
{
|
||||
InputStream image=client.field_71418_C.func_77292_e().func_77532_a(path);
|
||||
|
||||
@@ -12,6 +12,9 @@ import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityClientPlayerMP;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.KeyBinding;
|
||||
import net.minecraft.src.NetClientHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.Render;
|
||||
import net.minecraft.src.RenderManager;
|
||||
@@ -23,6 +26,7 @@ import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.collect.MapDifference.ValueDifference;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
@@ -41,12 +45,6 @@ import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
|
||||
public class ModLoaderClientHelper implements IModLoaderSidedHelper
|
||||
{
|
||||
|
||||
/**
|
||||
* @param mod
|
||||
* @param inventoryRenderer
|
||||
* @return
|
||||
*/
|
||||
public static int obtainBlockModelIdFor(BaseMod mod, boolean inventoryRenderer)
|
||||
{
|
||||
int renderId=RenderingRegistry.getNextAvailableRenderId();
|
||||
@@ -156,4 +154,24 @@ public class ModLoaderClientHelper implements IModLoaderSidedHelper
|
||||
{
|
||||
((net.minecraft.src.BaseMod)mod).clientCustomPayload(client.field_71439_g.field_71174_a, packet);
|
||||
}
|
||||
|
||||
private Map<INetworkManager,NetHandler> managerLookups = new MapMaker().weakKeys().weakValues().makeMap();
|
||||
@Override
|
||||
public void clientConnectionOpened(NetHandler netClientHandler, INetworkManager manager, BaseModProxy mod)
|
||||
{
|
||||
managerLookups.put(manager, netClientHandler);
|
||||
((BaseMod)mod).clientConnect((NetClientHandler)netClientHandler);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod)
|
||||
{
|
||||
if (managerLookups.containsKey(manager))
|
||||
{
|
||||
((BaseMod)mod).clientDisconnect((NetClientHandler) managerLookups.get(manager));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -40,9 +40,6 @@ public class ModLoaderKeyBindingHandler extends KeyBindingRegistry.KeyHandler
|
||||
private boolean[] mlRepeats = new boolean[0];
|
||||
private boolean[] armed = new boolean[0];
|
||||
|
||||
/**
|
||||
* @param keyHandler
|
||||
*/
|
||||
public ModLoaderKeyBindingHandler()
|
||||
{
|
||||
super(new KeyBinding[0], new boolean[0]);
|
||||
|
||||
@@ -129,7 +129,7 @@ public class KeyBindingRegistry
|
||||
* Called when the key is first in the down position on any tick from the {@link #ticks()}
|
||||
* set. Will be called subsequently with isRepeat set to true
|
||||
*
|
||||
* @see #keyUp(EnumSet, boolean)
|
||||
* @see #keyUp(EnumSet, KeyBinding, boolean)
|
||||
*
|
||||
* @param types the type(s) of tick that fired when this key was first down
|
||||
* @param tickEnd was it an end or start tick which fired the key
|
||||
@@ -139,7 +139,7 @@ public class KeyBindingRegistry
|
||||
/**
|
||||
* Fired once when the key changes state from down to up
|
||||
*
|
||||
* @see #keyDown(EnumSet, boolean, boolean)
|
||||
* @see #keyDown(EnumSet, KeyBinding, boolean, boolean)
|
||||
*
|
||||
* @param types the type(s) of tick that fired when this key was first down
|
||||
* @param tickEnd was it an end or start tick which fired the key
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.IBlockAccess;
|
||||
import net.minecraft.src.Render;
|
||||
import net.minecraft.src.RenderBiped;
|
||||
import net.minecraft.src.RenderBlocks;
|
||||
import net.minecraft.src.RenderManager;
|
||||
import net.minecraft.src.RenderPlayer;
|
||||
@@ -26,7 +27,7 @@ public class RenderingRegistry
|
||||
{
|
||||
private static final RenderingRegistry INSTANCE = new RenderingRegistry();
|
||||
|
||||
private int nextRenderId = 32;
|
||||
private int nextRenderId = 36;
|
||||
|
||||
private Map<Integer, ISimpleBlockRenderingHandler> blockRenderers = Maps.newHashMap();
|
||||
|
||||
@@ -36,11 +37,11 @@ public class RenderingRegistry
|
||||
* Add a new armour prefix to the RenderPlayer
|
||||
*
|
||||
* @param armor
|
||||
* @return
|
||||
*/
|
||||
public static int addNewArmourRendererPrefix(String armor)
|
||||
{
|
||||
RenderPlayer.field_77110_j = ObjectArrays.concat(RenderPlayer.field_77110_j, armor);
|
||||
RenderBiped.field_82424_k = RenderPlayer.field_77110_j;
|
||||
return RenderPlayer.field_77110_j.length - 1;
|
||||
}
|
||||
|
||||
@@ -80,8 +81,6 @@ public class RenderingRegistry
|
||||
}
|
||||
/**
|
||||
* Get the next available renderId from the block render ID list
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static int getNextAvailableRenderId()
|
||||
{
|
||||
@@ -93,7 +92,6 @@ public class RenderingRegistry
|
||||
*
|
||||
* @param fileToOverride
|
||||
* @param fileToAdd
|
||||
* @return
|
||||
*/
|
||||
public static int addTextureOverride(String fileToOverride, String fileToAdd)
|
||||
{
|
||||
@@ -118,7 +116,6 @@ public class RenderingRegistry
|
||||
* Get and reserve a unique texture index for the supplied path
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public static int getUniqueTextureIndex(String path)
|
||||
{
|
||||
@@ -141,16 +138,6 @@ public class RenderingRegistry
|
||||
private Render renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param renderer
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param block
|
||||
* @param modelId
|
||||
* @return
|
||||
*/
|
||||
public boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId)
|
||||
{
|
||||
if (!blockRenderers.containsKey(modelId)) { return false; }
|
||||
@@ -158,12 +145,6 @@ public class RenderingRegistry
|
||||
return bri.renderWorldBlock(world, x, y, z, block, modelId, renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param renderer
|
||||
* @param block
|
||||
* @param metadata
|
||||
* @param modelID
|
||||
*/
|
||||
public void renderInventoryBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
|
||||
{
|
||||
if (!blockRenderers.containsKey(modelID)) { return; }
|
||||
@@ -171,10 +152,6 @@ public class RenderingRegistry
|
||||
bri.renderInventoryBlock(block, metadata, modelID, renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param p_1219_0_
|
||||
* @return
|
||||
*/
|
||||
public boolean renderItemAsFull3DBlock(int modelId)
|
||||
{
|
||||
ISimpleBlockRenderingHandler bri = blockRenderers.get(modelId);
|
||||
|
||||
@@ -51,23 +51,12 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param minecraftInstance
|
||||
* @return
|
||||
*//*
|
||||
|
||||
*//**
|
||||
* @param renderers
|
||||
*//*
|
||||
/*
|
||||
public final void onRenderHarvest(Map renderers)
|
||||
{
|
||||
addRenderer((Map<Class<? extends Entity>,Render>)renderers);
|
||||
|
||||
}
|
||||
|
||||
*//**
|
||||
*
|
||||
*//*
|
||||
public final void onRegisterAnimations()
|
||||
{
|
||||
registerAnimation(FMLClientHandler.instance().getClient());
|
||||
@@ -156,22 +145,19 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* NO-OP on client side
|
||||
*//*
|
||||
@Override
|
||||
public final boolean handleCommand(String command, Object... data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
*/ // BASEMOD API
|
||||
*/
|
||||
// BASEMOD API
|
||||
/**
|
||||
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
|
||||
*
|
||||
* @param id
|
||||
* @param metadata
|
||||
* @return
|
||||
*/
|
||||
public int addFuel(int id, int metadata)
|
||||
{
|
||||
@@ -193,7 +179,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
* @param xVel
|
||||
* @param zVel
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int dispenseEntity(World world, ItemStack item, Random rnd, int x, int y, int z, int xVel, int zVel, double entX, double entY, double entZ)
|
||||
@@ -232,7 +217,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public GuiContainer getContainerGUI(EntityClientPlayerMP player, int containerID, int x, int y, int z)
|
||||
@@ -242,8 +226,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
|
||||
/**
|
||||
* Return the name of your mod. Defaults to the class name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
@@ -252,8 +234,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
|
||||
/**
|
||||
* Get your mod priorities
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPriorities()
|
||||
{
|
||||
@@ -262,8 +242,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
|
||||
/**
|
||||
* Return the version of your mod
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String getVersion();
|
||||
|
||||
@@ -328,9 +306,27 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
@Override
|
||||
public void clientChat(String text)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a client connects
|
||||
* @param handler
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public void clientConnect(NetClientHandler handler)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the client disconnects
|
||||
* @param handler
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public void clientDisconnect(NetClientHandler handler)
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* Called client side to receive a custom payload for this mod
|
||||
*
|
||||
@@ -339,7 +335,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
@Override
|
||||
public void receiveCustomPacket(Packet250CustomPayload packet)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
@@ -408,10 +403,6 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
|
||||
/**
|
||||
* Called when a chat message is received. Return true to stop further processing
|
||||
*
|
||||
* @param source
|
||||
* @param chat
|
||||
* @return true if you want to consume the message so it is not available for further processing
|
||||
*/
|
||||
@Override
|
||||
public void serverChat(NetServerHandler source, String message)
|
||||
@@ -429,24 +420,15 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
||||
|
||||
/**
|
||||
* Called when a client logs out of the server.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
@Override
|
||||
public void onClientLogout(NetworkManager mgr)
|
||||
public void onClientLogout(INetworkManager mgr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Spawn the entity of the supplied type, if it is your mod's
|
||||
* @param entityId
|
||||
* @param world
|
||||
* @param scaledX
|
||||
* @param scaledY
|
||||
* @param scaledZ
|
||||
* @return
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public Entity spawnEntity(int entityId, World world, double scaledX, double scaledY, double scaledZ)
|
||||
|
||||
@@ -67,7 +67,7 @@ public class FMLRenderAccessLibrary
|
||||
return TextureFXManager.instance().getTextureDimensions(textureFX);
|
||||
}
|
||||
|
||||
public static void onTexturePackChange(RenderEngine engine, TexturePackBase texturePack, List<TextureFX> textureFXList)
|
||||
public static void onTexturePackChange(RenderEngine engine, ITexturePack texturePack, List<TextureFX> textureFXList)
|
||||
{
|
||||
TextureFXManager.instance().onTexturePackChange(engine, texturePack, textureFXList);
|
||||
}
|
||||
|
||||
@@ -45,22 +45,19 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.server.FMLServerHandler;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class ModLoader
|
||||
{
|
||||
public static final String fmlMarker = "This is an FML marker";
|
||||
// TODO dirty workaround for millinaire
|
||||
@Deprecated
|
||||
public static final Map<String,Map<String,String>> localizedStrings=Collections.emptyMap();
|
||||
|
||||
/**
|
||||
* Not used on the server.
|
||||
* Adds localization info for an achievement, Not used on the server.
|
||||
*
|
||||
* @param achievement
|
||||
* @param name
|
||||
* @param description
|
||||
* @param achievement The achievement to name
|
||||
* @param name The name
|
||||
* @param description The description
|
||||
*/
|
||||
public static void addAchievementDesc(Achievement achievement, String name, String description)
|
||||
{
|
||||
@@ -72,11 +69,11 @@ public class ModLoader
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
*
|
||||
* {@link FMLCommonHandler#fuelLookup(int, int)}
|
||||
* {@link GameRegistry#getFuelValue(ItemStack))}
|
||||
*
|
||||
* @param id
|
||||
* @param metadata
|
||||
* @return
|
||||
* @param id The Item ID
|
||||
* @param metadata The Item Metadata
|
||||
* @return The fuel strength, in ticks, 0 if unhandled
|
||||
*/
|
||||
@Deprecated
|
||||
public static int addAllFuel(int id, int metadata)
|
||||
@@ -97,9 +94,12 @@ public class ModLoader
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param armor
|
||||
* @return
|
||||
* Adds a new prefix to the armor texture list
|
||||
*
|
||||
* {@link RenderingRegistry#addNewArmourRendererPrefix(String))}
|
||||
*
|
||||
* @param armor The new armor prefix
|
||||
* @return The new armor index
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public static int addArmor(String armor)
|
||||
@@ -110,7 +110,7 @@ public class ModLoader
|
||||
/**
|
||||
* This method adds the supplied biome to the set of candidate biomes for the default world generator type.
|
||||
*
|
||||
* @param biome
|
||||
* @param biome The biome to add
|
||||
*/
|
||||
public static void addBiome(BiomeGenBase biome)
|
||||
{
|
||||
@@ -129,8 +129,8 @@ public class ModLoader
|
||||
/**
|
||||
* Add localization for the specified string
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @param key Key
|
||||
* @param value Value
|
||||
*/
|
||||
public static void addLocalization(String key, String value)
|
||||
{
|
||||
@@ -140,9 +140,9 @@ public class ModLoader
|
||||
/**
|
||||
* Add localization for the specified string
|
||||
*
|
||||
* @param key
|
||||
* @param lang
|
||||
* @param value
|
||||
* @param key Key
|
||||
* @param lang Language identifier
|
||||
* @param value Value
|
||||
*/
|
||||
public static void addLocalization(String key, String lang, String value)
|
||||
{
|
||||
@@ -152,8 +152,8 @@ public class ModLoader
|
||||
/**
|
||||
* Name the specified minecraft object with the supplied name
|
||||
*
|
||||
* @param instance
|
||||
* @param name
|
||||
* @param instance Item to name
|
||||
* @param name The name to give it
|
||||
*/
|
||||
public static void addName(Object instance, String name)
|
||||
{
|
||||
@@ -163,9 +163,9 @@ public class ModLoader
|
||||
/**
|
||||
* Unimplemented on the server as it does not generate names
|
||||
*
|
||||
* @param instance
|
||||
* @param lang
|
||||
* @param name
|
||||
* @param instance Item to name
|
||||
* @param lang Languge identifier
|
||||
* @param name Name to give it
|
||||
*/
|
||||
public static void addName(Object instance, String lang, String name)
|
||||
{
|
||||
@@ -173,11 +173,18 @@ public class ModLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to register a small image to be applied to a larger texture image,
|
||||
* typically how old ModLoader mods add custom Item/Block textures.
|
||||
*
|
||||
* Forge mods should use setTextureFile in Item/Block
|
||||
*
|
||||
* Will return the icon index it was applied to.
|
||||
*
|
||||
* Unimplemented on the server as it does not render textures
|
||||
*
|
||||
* @param fileToOverride
|
||||
* @param fileToAdd
|
||||
* @return
|
||||
* @param fileToOverride The texture to apply the new image to
|
||||
* @param fileToAdd The new image
|
||||
* @return The 'icon index' in the main image that the new image will be applied to
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public static int addOverride(String fileToOverride, String fileToAdd)
|
||||
@@ -186,11 +193,16 @@ public class ModLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to register a small image to be applied to a larger texture image,
|
||||
* typically how old ModLoader mods add custom Item/Block textures.
|
||||
*
|
||||
* Forge mods should use setTextureFile in Item/Block
|
||||
*
|
||||
* Unimplemented on the server as it does not render textures
|
||||
*
|
||||
* @param path
|
||||
* @param overlayPath
|
||||
* @param index
|
||||
* @param path The texture to apply the new image to
|
||||
* @param overlayPath The new image
|
||||
* @param index Where on the texture to apply it
|
||||
*/
|
||||
@SideOnly(CLIENT)
|
||||
public static void addOverride(String path, String overlayPath, int index)
|
||||
@@ -201,8 +213,8 @@ public class ModLoader
|
||||
/**
|
||||
* Add a Shaped Recipe
|
||||
*
|
||||
* @param output
|
||||
* @param params
|
||||
* @param output The result
|
||||
* @param params The input
|
||||
*/
|
||||
public static void addRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
@@ -212,8 +224,8 @@ public class ModLoader
|
||||
/**
|
||||
* Add a shapeless recipe
|
||||
*
|
||||
* @param output
|
||||
* @param params
|
||||
* @param output The result
|
||||
* @param params The input
|
||||
*/
|
||||
public static void addShapelessRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
@@ -322,7 +334,7 @@ public class ModLoader
|
||||
* @param xVel
|
||||
* @param zVel
|
||||
* @param item
|
||||
* @return
|
||||
* @return Always false, not implemented here
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
|
||||
@@ -392,7 +404,7 @@ public class ModLoader
|
||||
* Get a list of all BaseMod loaded into the system
|
||||
* {@link ModLoaderModContainer#findAll}
|
||||
*
|
||||
* @return
|
||||
* @return A list containing all loaded ModLoader mods
|
||||
*/
|
||||
public static List<BaseMod> getLoadedMods()
|
||||
{
|
||||
@@ -402,7 +414,7 @@ public class ModLoader
|
||||
/**
|
||||
* Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
|
||||
*
|
||||
* @return
|
||||
* @return The current logger
|
||||
*/
|
||||
public static Logger getLogger()
|
||||
{
|
||||
@@ -415,10 +427,6 @@ public class ModLoader
|
||||
return FMLClientHandler.instance().getClient();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static MinecraftServer getMinecraftServerInstance()
|
||||
{
|
||||
return FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
@@ -431,7 +439,7 @@ public class ModLoader
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param fieldindex
|
||||
* @return
|
||||
* @return The value in the specified field.
|
||||
*/
|
||||
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, int fieldindex)
|
||||
{
|
||||
@@ -440,12 +448,12 @@ public class ModLoader
|
||||
|
||||
/**
|
||||
* Get a value from a field using reflection
|
||||
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, String)}
|
||||
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, String[])}
|
||||
*
|
||||
* @param instanceclass
|
||||
* @param instance
|
||||
* @param field
|
||||
* @return
|
||||
* @return The value in the specified field.
|
||||
*/
|
||||
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, String field)
|
||||
{
|
||||
@@ -464,9 +472,9 @@ public class ModLoader
|
||||
|
||||
/**
|
||||
* Get a new unique entity id
|
||||
* {@link Entity#getNextId()}
|
||||
* {@link EntityRegistry#findGlobalUniqueEntityId()}
|
||||
*
|
||||
* @return
|
||||
* @return A unique entity ID
|
||||
*/
|
||||
public static int getUniqueEntityId()
|
||||
{
|
||||
@@ -485,7 +493,7 @@ public class ModLoader
|
||||
*
|
||||
* @param player
|
||||
* @param channel
|
||||
* @return
|
||||
* @return If the channel is registered to the current connection.
|
||||
*/
|
||||
public static boolean isChannelActive(EntityPlayer player, String channel)
|
||||
{
|
||||
@@ -503,7 +511,7 @@ public class ModLoader
|
||||
* {@link Loader#isModLoaded(String)}
|
||||
*
|
||||
* @param modname
|
||||
* @return
|
||||
* @return If the specified mod is loaded
|
||||
*/
|
||||
public static boolean isModLoaded(String modname)
|
||||
{
|
||||
@@ -555,7 +563,7 @@ public class ModLoader
|
||||
|
||||
/**
|
||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
||||
* {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)}
|
||||
* {@link FMLNetworkHandler#handlePacket250(Packet250CustomPayload, NetworkManager, NetHandler)}
|
||||
*
|
||||
* @param packet
|
||||
*/
|
||||
@@ -636,7 +644,7 @@ public class ModLoader
|
||||
|
||||
/**
|
||||
* Register the mod for packets on this channel.
|
||||
* {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)}
|
||||
* {@link NetworkRegistry#registerChannel(IPacketHandler, String)}
|
||||
*
|
||||
* @param mod
|
||||
* @param channel
|
||||
@@ -759,7 +767,7 @@ public class ModLoader
|
||||
}
|
||||
/**
|
||||
* Send a chat message to the server
|
||||
* {@link FMLClientHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
|
||||
* {@link FMLNetworkHandler#handleChatMessage(NetHandler, Packet3Chat)}
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
|
||||
@@ -18,11 +18,13 @@ import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.FMLTextureFX;
|
||||
|
||||
/**
|
||||
* A texture override for animations, it takes a vertical image of
|
||||
* A texture override for animations, it takes a vertical image of
|
||||
* texture frames and constantly rotates them in the texture.
|
||||
*/
|
||||
public class ModTextureAnimation extends FMLTextureFX
|
||||
@@ -31,45 +33,45 @@ public class ModTextureAnimation extends FMLTextureFX
|
||||
private byte[][] images;
|
||||
private int index = 0;
|
||||
private int ticks = 0;
|
||||
|
||||
|
||||
private String targetTex = null;
|
||||
private BufferedImage imgData = null;
|
||||
|
||||
|
||||
public ModTextureAnimation(int icon, int target, BufferedImage image, int tickCount)
|
||||
{
|
||||
this(icon, 1, target, image, tickCount);
|
||||
}
|
||||
|
||||
public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount)
|
||||
public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount)
|
||||
{
|
||||
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image, tickCount);
|
||||
}
|
||||
|
||||
|
||||
public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount)
|
||||
{
|
||||
super(icon);
|
||||
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
|
||||
|
||||
|
||||
targetTex = target;
|
||||
field_76849_e = size;
|
||||
field_76847_f = re.func_78341_b(target);
|
||||
|
||||
|
||||
tickRate = tickCount;
|
||||
ticks = tickCount;
|
||||
imgData = image;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
super.setup();
|
||||
|
||||
|
||||
int sWidth = imgData.getWidth();
|
||||
int sHeight = imgData.getHeight();
|
||||
int tWidth = tileSizeBase;
|
||||
int tHeight = tileSizeBase;
|
||||
|
||||
|
||||
|
||||
|
||||
int frames = (int)Math.floor((double)(sHeight / sWidth));
|
||||
|
||||
if (frames < 1)
|
||||
@@ -80,7 +82,7 @@ public class ModTextureAnimation extends FMLTextureFX
|
||||
{
|
||||
images = new byte[frames][];
|
||||
BufferedImage image = imgData;
|
||||
|
||||
|
||||
if (sWidth != tWidth)
|
||||
{
|
||||
BufferedImage b = new BufferedImage(tWidth, tHeight * frames, 6);
|
||||
@@ -107,8 +109,8 @@ public class ModTextureAnimation extends FMLTextureFX
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void func_783_a()
|
||||
|
||||
public void func_76846_a()
|
||||
{
|
||||
if (++ticks >= tickRate)
|
||||
{
|
||||
@@ -121,4 +123,17 @@ public class ModTextureAnimation extends FMLTextureFX
|
||||
ticks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void func_76845_a(RenderEngine renderEngine)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, field_76847_f);
|
||||
}
|
||||
|
||||
// TODO: REMOVE THIS - just for you dan200
|
||||
@Deprecated
|
||||
public void func_783_a()
|
||||
{
|
||||
func_76846_a();
|
||||
}
|
||||
|
||||
}
|
||||
+20
-2
@@ -200,10 +200,28 @@
|
||||
|
||||
# HINT: We need a table for the old md5 and the new ones
|
||||
md5table = {}
|
||||
@@ -1656,3 +1699,6 @@
|
||||
@@ -1646,6 +1689,7 @@
|
||||
# HINT: We extract the source files for the modified class files
|
||||
for in_class in trgclasses:
|
||||
src_file = os.path.normpath(os.path.join(src[side], in_class + '.java'))
|
||||
+ cmn_file = os.path.normpath(os.path.join(self.srcshared, in_class + '.java'))
|
||||
dest_file = os.path.normpath(os.path.join(outpathlk[side], in_class + '.java'))
|
||||
if os.path.isfile(src_file):
|
||||
if not os.path.exists(os.path.dirname(dest_file)):
|
||||
@@ -1655,4 +1699,15 @@
|
||||
self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
|
||||
except IOError:
|
||||
self.logger.error('* File %s copy failed', in_class)
|
||||
|
||||
-
|
||||
+ elif os.path.isfile(cmn_file):
|
||||
+ if not os.path.exists(os.path.dirname(dest_file)):
|
||||
+ os.makedirs(os.path.dirname(dest_file))
|
||||
+ try:
|
||||
+ shutil.copyfile(cmn_file, dest_file)
|
||||
+ self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
|
||||
+ except IOError:
|
||||
+ self.logger.error('* File %s copy failed', in_class)
|
||||
+
|
||||
+def commands_sanity_check():
|
||||
+ print 'Commands patch applied successfully'
|
||||
+
|
||||
@@ -0,0 +1,29 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Declare a variable to be populated by a Bukkit Plugin proxy instance if the bukkit coremod
|
||||
* is available. It can only be applied to field typed as {@link BukkitProxy}
|
||||
* Generally it should be used in conjunction with {@link Mod#bukkitPlugin()} specifying the
|
||||
* plugin to load.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface BukkitPluginRef
|
||||
{
|
||||
/**
|
||||
* A reference (possibly version specific) to a Bukkit Plugin by name, using the name@versionbound
|
||||
* specification. If this is a bukkit enabled environment the field annotated by this
|
||||
* will be populated with a {@link BukkitProxy} instance if possible. This proxy will be gotten by
|
||||
* reflectively calling the "getModProxy" method on the bukkit plugin instance.
|
||||
* @return
|
||||
*/
|
||||
String value();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
/**
|
||||
* A marker interface for retrieving a proxy to a bukkit plugin.
|
||||
* Fields associated with {@link BukkitPluginRef} annotations should be should probably
|
||||
* declare this type and cast down if the target is available (not null)
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public interface BukkitProxy
|
||||
{
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.google.common.eventbus.EventBus;
|
||||
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
|
||||
public class DummyModContainer implements ModContainer
|
||||
{
|
||||
@@ -132,4 +133,9 @@ public class DummyModContainer implements ModContainer
|
||||
{
|
||||
return md.version;
|
||||
}
|
||||
@Override
|
||||
public VersionRange acceptableMinecraftVersionRange()
|
||||
{
|
||||
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.SetMultimap;
|
||||
|
||||
public class DuplicateModsFoundException extends LoaderException {
|
||||
|
||||
public SetMultimap<ModContainer,File> dupes;
|
||||
|
||||
public DuplicateModsFoundException(SetMultimap<ModContainer, File> dupes) {
|
||||
this.dupes = dupes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,8 +15,9 @@ package cpw.mods.fml.common;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -25,18 +26,24 @@ import net.minecraft.src.DedicatedServer;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.NBTBase;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.Packet131MapData;
|
||||
import net.minecraft.src.SaveHandler;
|
||||
import net.minecraft.src.ServerListenThread;
|
||||
import net.minecraft.src.ThreadServerApplication;
|
||||
import net.minecraft.src.ThreadMinecraftServer;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.WorldInfo;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableList.Builder;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||
@@ -75,6 +82,8 @@ public class FMLCommonHandler
|
||||
private boolean noForge;
|
||||
private List<String> brandings;
|
||||
private List<ICrashCallable> crashCallables = Lists.newArrayList(Loader.instance().getCallableCrashInformation());
|
||||
private Set<SaveHandler> handlerSet = Sets.newSetFromMap(new MapMaker().weakKeys().<SaveHandler,Boolean>makeMap());
|
||||
|
||||
|
||||
|
||||
public void beginLoading(IFMLSidedHandler handler)
|
||||
@@ -138,7 +147,6 @@ public class FMLCommonHandler
|
||||
/**
|
||||
* Find the container that associates with the supplied mod object
|
||||
* @param mod
|
||||
* @return
|
||||
*/
|
||||
public ModContainer findContainerFor(Object mod)
|
||||
{
|
||||
@@ -153,16 +161,6 @@ public class FMLCommonHandler
|
||||
return FMLLog.getLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param lang
|
||||
* @param value
|
||||
*/
|
||||
/**
|
||||
* @param languagePack
|
||||
* @param lang
|
||||
*/
|
||||
|
||||
public Side getSide()
|
||||
{
|
||||
return sidedDelegate.getSide();
|
||||
@@ -172,13 +170,11 @@ public class FMLCommonHandler
|
||||
* Return the effective side for the context in the game. This is dependent
|
||||
* on thread analysis to try and determine whether the code is running in the
|
||||
* server or not. Use at your own risk
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Side getEffectiveSide()
|
||||
{
|
||||
Thread thr = Thread.currentThread();
|
||||
if ((thr instanceof ThreadServerApplication) || (thr instanceof ServerListenThread))
|
||||
if ((thr instanceof ThreadMinecraftServer) || (thr instanceof ServerListenThread))
|
||||
{
|
||||
return Side.SERVER;
|
||||
}
|
||||
@@ -187,10 +183,6 @@ public class FMLCommonHandler
|
||||
}
|
||||
/**
|
||||
* Raise an exception
|
||||
*
|
||||
* @param exception
|
||||
* @param message
|
||||
* @param stopGame
|
||||
*/
|
||||
public void raiseException(Throwable exception, String message, boolean stopGame)
|
||||
{
|
||||
@@ -229,10 +221,7 @@ public class FMLCommonHandler
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
|
||||
public void computeBranding()
|
||||
{
|
||||
if (brandings == null)
|
||||
@@ -268,9 +257,6 @@ public class FMLCommonHandler
|
||||
return ImmutableList.copyOf(brandings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public IFMLSidedHandler getSidedDelegate()
|
||||
{
|
||||
return sidedDelegate;
|
||||
@@ -408,4 +394,46 @@ public class FMLCommonHandler
|
||||
{
|
||||
sidedDelegate.handleTinyPacket(handler, mapData);
|
||||
}
|
||||
|
||||
public void handleWorldDataSave(SaveHandler handler, WorldInfo worldInfo, NBTTagCompound tagCompound)
|
||||
{
|
||||
for (ModContainer mc : Loader.instance().getModList())
|
||||
{
|
||||
if (mc instanceof InjectedModContainer)
|
||||
{
|
||||
WorldAccessContainer wac = ((InjectedModContainer)mc).getWrappedWorldAccessContainer();
|
||||
if (wac != null)
|
||||
{
|
||||
NBTTagCompound dataForWriting = wac.getDataForWriting(handler, worldInfo);
|
||||
tagCompound.func_74766_a(mc.getModId(), dataForWriting);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleWorldDataLoad(SaveHandler handler, WorldInfo worldInfo, NBTTagCompound tagCompound)
|
||||
{
|
||||
if (getEffectiveSide()!=Side.SERVER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (handlerSet.contains(handler))
|
||||
{
|
||||
return;
|
||||
}
|
||||
handlerSet.add(handler);
|
||||
Map<String,NBTBase> additionalProperties = Maps.newHashMap();
|
||||
worldInfo.setAdditionalProperties(additionalProperties);
|
||||
for (ModContainer mc : Loader.instance().getModList())
|
||||
{
|
||||
if (mc instanceof InjectedModContainer)
|
||||
{
|
||||
WorldAccessContainer wac = ((InjectedModContainer)mc).getWrappedWorldAccessContainer();
|
||||
if (wac != null)
|
||||
{
|
||||
wac.readData(handler, worldInfo, additionalProperties, tagCompound.func_74775_l(mc.getModId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,26 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import net.minecraft.src.NBTBase;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.NBTTagList;
|
||||
import net.minecraft.src.NBTTagString;
|
||||
import net.minecraft.src.SaveHandler;
|
||||
import net.minecraft.src.WorldInfo;
|
||||
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class FMLDummyContainer extends DummyModContainer
|
||||
public class FMLDummyContainer extends DummyModContainer implements WorldAccessContainer
|
||||
{
|
||||
public FMLDummyContainer()
|
||||
{
|
||||
@@ -49,4 +61,45 @@ public class FMLDummyContainer extends DummyModContainer
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info)
|
||||
{
|
||||
NBTTagCompound fmlData = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (ModContainer mc : Loader.instance().getActiveModList())
|
||||
{
|
||||
NBTTagCompound mod = new NBTTagCompound();
|
||||
mod.func_74778_a("ModId", mc.getModId());
|
||||
mod.func_74778_a("ModVersion", mc.getVersion());
|
||||
list.func_74742_a(mod);
|
||||
}
|
||||
fmlData.func_74782_a("ModList", list);
|
||||
return fmlData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag)
|
||||
{
|
||||
if (tag.func_74764_b("ModList"))
|
||||
{
|
||||
NBTTagList modList = tag.func_74761_m("ModList");
|
||||
for (int i = 0; i < modList.func_74745_c(); i++)
|
||||
{
|
||||
NBTTagCompound mod = (NBTTagCompound) modList.func_74743_b(i);
|
||||
String modId = mod.func_74779_i("ModId");
|
||||
String modVersion = mod.func_74779_i("ModVersion");
|
||||
ModContainer container = Loader.instance().getIndexedModList().get(modId);
|
||||
if (container == null)
|
||||
{
|
||||
FMLLog.severe("This world was saved with mod %s which appears to be missing, things may not work well", modId);
|
||||
continue;
|
||||
}
|
||||
if (!modVersion.equals(container.getVersion()))
|
||||
{
|
||||
FMLLog.info("This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -20,8 +21,12 @@ import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Strings;
|
||||
@@ -51,6 +56,8 @@ import cpw.mods.fml.common.event.FMLStateEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionParser;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
|
||||
public class FMLModContainer implements ModContainer
|
||||
{
|
||||
@@ -79,6 +86,7 @@ public class FMLModContainer implements ModContainer
|
||||
.build();
|
||||
private static final BiMap<Class<? extends Annotation>, Class<? extends FMLStateEvent>> modTypeAnnotations = modAnnotationTypes.inverse();
|
||||
private String annotationDependencies;
|
||||
private VersionRange minecraftAccepted;
|
||||
|
||||
|
||||
public FMLModContainer(String className, File modSource, Map<String,Object> modDescriptor)
|
||||
@@ -123,9 +131,9 @@ public class FMLModContainer implements ModContainer
|
||||
{
|
||||
modMetadata = mc.getMetadataForId(getModId(), descriptor);
|
||||
|
||||
if (descriptor.containsKey("usesMetadata"))
|
||||
if (descriptor.containsKey("useMetadata"))
|
||||
{
|
||||
overridesMetadata = !((Boolean)descriptor.get("usesMetadata")).booleanValue();
|
||||
overridesMetadata = !((Boolean)descriptor.get("useMetadata")).booleanValue();
|
||||
}
|
||||
|
||||
if (overridesMetadata || !modMetadata.useDependencyInformation)
|
||||
@@ -150,16 +158,74 @@ public class FMLModContainer implements ModContainer
|
||||
modMetadata.name = getModId();
|
||||
}
|
||||
internalVersion = (String) descriptor.get("version");
|
||||
if (Strings.isNullOrEmpty(internalVersion))
|
||||
{
|
||||
Properties versionProps = searchForVersionProperties();
|
||||
if (versionProps != null)
|
||||
{
|
||||
internalVersion = versionProps.getProperty(getModId()+".version");
|
||||
FMLLog.fine("Found version %s for mod %s in version.properties, using", internalVersion, getModId());
|
||||
}
|
||||
|
||||
}
|
||||
if (Strings.isNullOrEmpty(internalVersion) && !Strings.isNullOrEmpty(modMetadata.version))
|
||||
{
|
||||
FMLLog.warning("Mod %s is missing the required element 'version'. Falling back to metadata version %s", getModId(), modMetadata.version);
|
||||
modMetadata.version = internalVersion;
|
||||
FMLLog.warning("Mod %s is missing the required element 'version' and a version.properties file could not be found. Falling back to metadata version %s", getModId(), modMetadata.version);
|
||||
internalVersion = modMetadata.version;
|
||||
}
|
||||
if (Strings.isNullOrEmpty(internalVersion))
|
||||
{
|
||||
FMLLog.warning("Mod %s is missing the required element 'version' and no fallback can be found. Substituting '1.0'.", getModId());
|
||||
modMetadata.version = internalVersion = "1.0";
|
||||
}
|
||||
|
||||
String mcVersionString = (String) descriptor.get("acceptedMinecraftVersions");
|
||||
if (!Strings.isNullOrEmpty(mcVersionString))
|
||||
{
|
||||
minecraftAccepted = VersionParser.parseRange(mcVersionString);
|
||||
}
|
||||
else
|
||||
{
|
||||
minecraftAccepted = Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
||||
}
|
||||
}
|
||||
|
||||
public Properties searchForVersionProperties()
|
||||
{
|
||||
try
|
||||
{
|
||||
FMLLog.fine("Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId());
|
||||
Properties version = null;
|
||||
if (getSource().isFile())
|
||||
{
|
||||
ZipFile source = new ZipFile(getSource());
|
||||
ZipEntry versionFile = source.getEntry("version.properties");
|
||||
if (versionFile!=null)
|
||||
{
|
||||
version = new Properties();
|
||||
version.load(source.getInputStream(versionFile));
|
||||
}
|
||||
source.close();
|
||||
}
|
||||
else if (getSource().isDirectory())
|
||||
{
|
||||
File propsFile = new File(getSource(),"version.properties");
|
||||
if (propsFile.exists() && propsFile.isFile())
|
||||
{
|
||||
version = new Properties();
|
||||
FileInputStream fis = new FileInputStream(propsFile);
|
||||
version.load(fis);
|
||||
fis.close();
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Throwables.propagateIfPossible(e);
|
||||
FMLLog.fine("Failed to find a usable version.properties file");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -404,4 +470,10 @@ public class FMLModContainer implements ModContainer
|
||||
{
|
||||
return modMetadata.version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VersionRange acceptableMinecraftVersionRange()
|
||||
{
|
||||
return minecraftAccepted;
|
||||
}
|
||||
}
|
||||
@@ -29,15 +29,15 @@ public interface ICraftingHandler
|
||||
* The object array contains these three arguments
|
||||
*
|
||||
* @param player
|
||||
* @param craftedItem
|
||||
* @param craftingGrid
|
||||
* @param item
|
||||
* @param craftMatrix
|
||||
*/
|
||||
void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix);
|
||||
|
||||
/**
|
||||
* The object array contains these two arguments
|
||||
* @param player
|
||||
* @param smeltedItem
|
||||
* @param item
|
||||
*/
|
||||
void onSmelting(EntityPlayer player, ItemStack item);
|
||||
}
|
||||
@@ -35,7 +35,6 @@ public interface IDispenseHandler
|
||||
* @param entX
|
||||
* @param entY
|
||||
* @param entZ
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
int dispense(double x, double y, double z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
|
||||
|
||||
@@ -24,7 +24,6 @@ public interface IDispenserHandler
|
||||
* @param entX
|
||||
* @param entY
|
||||
* @param entZ
|
||||
* @return
|
||||
*/
|
||||
int dispense(int x, int y, int z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
public interface IFMLHandledException
|
||||
{
|
||||
|
||||
}
|
||||
@@ -6,8 +6,7 @@ public interface IScheduledTickHandler extends ITickHandler
|
||||
* Return the number of actual ticks that will pass
|
||||
* before your next tick will fire. This will be called
|
||||
* just after your last tick fired to compute the next delay.
|
||||
* @param tick
|
||||
* @return
|
||||
* @return Time until next tick
|
||||
*/
|
||||
public int nextTickSpacing();
|
||||
}
|
||||
@@ -51,14 +51,11 @@ public interface ITickHandler
|
||||
|
||||
/**
|
||||
* Returns the list of ticks this tick handler is interested in receiving at the minute
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public EnumSet<TickType> ticks();
|
||||
|
||||
/**
|
||||
* A profiling label for this tick handler
|
||||
* @return
|
||||
*/
|
||||
public String getLabel();
|
||||
}
|
||||
@@ -19,8 +19,7 @@ import net.minecraft.src.IChunkProvider;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
/**
|
||||
* This is called back during world generation. The {@link #generate(Random, int, int, Object...)} method passes in some additional data that
|
||||
* can be cast into minecraft objects.
|
||||
* This is called back during world generation.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
@@ -34,7 +33,7 @@ public interface IWorldGenerator
|
||||
* @param chunkX the chunk X coordinate of this chunk.
|
||||
* @param chunkZ the chunk Z coordinate of this chunk.
|
||||
* @param world : additionalData[0] The minecraft {@link World} we're generating for.
|
||||
* @param generator : additionalData[1] The {@link IChunkProvider} that is generating.
|
||||
* @param chunkGenerator : additionalData[1] The {@link IChunkProvider} that is generating.
|
||||
* @param chunkProvider : additionalData[2] {@link IChunkProvider} that is requesting the world generation.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Set;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
|
||||
public class InjectedModContainer implements ModContainer
|
||||
{
|
||||
@@ -110,4 +111,22 @@ public class InjectedModContainer implements ModContainer
|
||||
{
|
||||
return wrappedContainer.getDisplayVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VersionRange acceptableMinecraftVersionRange()
|
||||
{
|
||||
return wrappedContainer.acceptableMinecraftVersionRange();
|
||||
}
|
||||
|
||||
public WorldAccessContainer getWrappedWorldAccessContainer()
|
||||
{
|
||||
if (wrappedContainer instanceof WorldAccessContainer)
|
||||
{
|
||||
return (WorldAccessContainer) wrappedContainer;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -88,6 +89,7 @@ public class LoadController
|
||||
state = state.transition(!errors.isEmpty());
|
||||
if (state != desiredState)
|
||||
{
|
||||
Throwable toThrow = null;
|
||||
FMLLog.severe("Fatal errors were detected during the transition from %s to %s. Loading cannot continue", oldState, desiredState);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
printModStates(sb);
|
||||
@@ -96,10 +98,23 @@ public class LoadController
|
||||
for (Entry<String, Throwable> error : errors.entries())
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, error.getValue(), "Caught exception from %s", error.getKey());
|
||||
if (error.getValue() instanceof IFMLHandledException)
|
||||
{
|
||||
toThrow = error.getValue();
|
||||
}
|
||||
else if (toThrow == null)
|
||||
{
|
||||
toThrow = error.getValue();
|
||||
}
|
||||
}
|
||||
if (toThrow != null && toThrow instanceof RuntimeException)
|
||||
{
|
||||
throw (RuntimeException)toThrow;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new LoaderException(toThrow);
|
||||
}
|
||||
|
||||
// Throw embedding the first error (usually the only one)
|
||||
throw new LoaderException(errors.values().iterator().next());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,9 +135,9 @@ public class LoadController
|
||||
activeContainer = mc;
|
||||
String modId = mc.getModId();
|
||||
stateEvent.applyModContainer(activeContainer());
|
||||
FMLLog.finer("Posting state event %s to mod %s", stateEvent, modId);
|
||||
FMLLog.finer("Posting state event %s to mod %s", stateEvent.getEventType(), modId);
|
||||
eventChannels.get(modId).post(stateEvent);
|
||||
FMLLog.finer("State event %s delivered to mod %s", stateEvent, modId);
|
||||
FMLLog.finer("State event %s delivered to mod %s", stateEvent.getEventType(), modId);
|
||||
activeContainer = null;
|
||||
if (!errors.containsKey(modId))
|
||||
{
|
||||
@@ -158,7 +173,14 @@ public class LoadController
|
||||
|
||||
public void errorOccurred(ModContainer modContainer, Throwable exception)
|
||||
{
|
||||
errors.put(modContainer.getModId(), exception);
|
||||
if (exception instanceof InvocationTargetException)
|
||||
{
|
||||
errors.put(modContainer.getModId(), ((InvocationTargetException)exception).getCause());
|
||||
}
|
||||
else
|
||||
{
|
||||
errors.put(modContainer.getModId(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void printModStates(StringBuilder ret)
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -31,14 +32,17 @@ import com.google.common.base.CharMatcher;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableMultiset;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.LinkedHashMultimap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.SetMultimap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.Multiset.Entry;
|
||||
import com.google.common.collect.Multisets;
|
||||
@@ -132,6 +136,7 @@ public class Loader
|
||||
private Exception capturedError;
|
||||
private File canonicalModsDir;
|
||||
private LoadController modController;
|
||||
private MinecraftDummyContainer minecraft;
|
||||
|
||||
private static File minecraftDir;
|
||||
private static List<String> injectedContainers;
|
||||
@@ -167,6 +172,8 @@ public class Loader
|
||||
FMLLog.severe("This version of FML is built for Minecraft %s, we have detected Minecraft %s in your minecraft jar file", mccversion, actualMCVersion);
|
||||
throw new LoaderException();
|
||||
}
|
||||
|
||||
minecraft = new MinecraftDummyContainer(actualMCVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,6 +194,11 @@ public class Loader
|
||||
|
||||
for (ModContainer mod : getActiveModList())
|
||||
{
|
||||
if (!mod.acceptableMinecraftVersionRange().containsVersion(minecraft.getProcessedVersion()))
|
||||
{
|
||||
FMLLog.severe("The mod %s does not wish to run in Minecraft version %s. You will have to remove it to play.", mod.getModId(), getMCVersionString());
|
||||
throw new WrongMinecraftVersionException(mod);
|
||||
}
|
||||
Map<String,ArtifactVersion> names = Maps.uniqueIndex(mod.getRequirements(), new Function<ArtifactVersion, String>()
|
||||
{
|
||||
public String apply(ArtifactVersion v)
|
||||
@@ -194,8 +206,8 @@ public class Loader
|
||||
return v.getLabel();
|
||||
}
|
||||
});
|
||||
Set<String> missingMods = Sets.difference(names.keySet(), modVersions.keySet());
|
||||
Set<ArtifactVersion> versionMissingMods = Sets.newHashSet();
|
||||
Set<String> missingMods = Sets.difference(names.keySet(), modVersions.keySet());
|
||||
if (!missingMods.isEmpty())
|
||||
{
|
||||
FMLLog.severe("The mod %s (%s) requires mods %s to be available", mod.getModId(), mod.getName(), missingMods);
|
||||
@@ -333,7 +345,6 @@ public class Loader
|
||||
|
||||
private void identifyDuplicates(List<ModContainer> mods)
|
||||
{
|
||||
boolean foundDupe = false;
|
||||
TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
|
||||
for (ModContainer mc : mods)
|
||||
{
|
||||
@@ -344,15 +355,19 @@ public class Loader
|
||||
}
|
||||
|
||||
ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
|
||||
SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
|
||||
for (Entry<ModContainer> e : duplist.entrySet())
|
||||
{
|
||||
if (e.getCount() > 1)
|
||||
{
|
||||
FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
|
||||
foundDupe = true;
|
||||
dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
|
||||
}
|
||||
}
|
||||
if (foundDupe) { throw new LoaderException(); }
|
||||
if (!dupes.isEmpty())
|
||||
{
|
||||
throw new DuplicateModsFoundException(dupes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,12 +434,12 @@ public class Loader
|
||||
|
||||
public List<ModContainer> getModList()
|
||||
{
|
||||
return ImmutableList.copyOf(instance().mods);
|
||||
return instance().mods != null ? ImmutableList.copyOf(instance().mods) : ImmutableList.<ModContainer>of();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from the hook to start mod loading. We trigger the
|
||||
* {@link #identifyMods()} and {@link #preModInit()} phases here. Finally,
|
||||
* {@link #identifyMods()} and Constructing, Preinitalization, and Initalization phases here. Finally,
|
||||
* the mod list is frozen completely and is consider immutable from then on.
|
||||
*/
|
||||
public void loadMods()
|
||||
@@ -443,7 +458,7 @@ public class Loader
|
||||
{
|
||||
if (nonMod.isFile())
|
||||
{
|
||||
FMLLog.severe("FML has found a non-mod file %s in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.", nonMod.getName());
|
||||
FMLLog.info("FML has found a non-mod file %s in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.", nonMod.getName());
|
||||
try
|
||||
{
|
||||
modClassLoader.addFile(nonMod);
|
||||
@@ -512,16 +527,13 @@ public class Loader
|
||||
* Query if we know of a mod named modname
|
||||
*
|
||||
* @param modname
|
||||
* @return
|
||||
* @return If the mod is loaded
|
||||
*/
|
||||
public static boolean isModLoaded(String modname)
|
||||
{
|
||||
return instance().namedMods.containsKey(modname) && instance().modController.getModState(instance.namedMods.get(modname))!=ModState.DISABLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public File getConfigDir()
|
||||
{
|
||||
return canonicalConfigDir;
|
||||
@@ -540,17 +552,11 @@ public class Loader
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getFMLVersionString()
|
||||
{
|
||||
return String.format("%s.%s.%s.%s", major, minor, rev, build);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public ClassLoader getModClassLoader()
|
||||
{
|
||||
return modClassLoader;
|
||||
@@ -664,7 +670,7 @@ public class Loader
|
||||
|
||||
public List<ModContainer> getActiveModList()
|
||||
{
|
||||
return modController.getActiveModList();
|
||||
return modController != null ? modController.getActiveModList() : ImmutableList.<ModContainer>of();
|
||||
}
|
||||
|
||||
public ModState getModState(ModContainer selectedMod)
|
||||
@@ -716,4 +722,9 @@ public class Loader
|
||||
{
|
||||
return modController.isInState(state);
|
||||
}
|
||||
|
||||
public MinecraftDummyContainer getMinecraftModContainer()
|
||||
{
|
||||
return minecraft;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionParser;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
|
||||
public class MinecraftDummyContainer extends DummyModContainer
|
||||
{
|
||||
|
||||
private VersionRange staticRange;
|
||||
public MinecraftDummyContainer(String actualMCVersion)
|
||||
{
|
||||
super(new ModMetadata());
|
||||
getMetadata().modId = "Minecraft";
|
||||
getMetadata().name = "Minecraft";
|
||||
getMetadata().version = actualMCVersion;
|
||||
staticRange = VersionParser.parseRange("["+actualMCVersion+"]");
|
||||
}
|
||||
|
||||
|
||||
public VersionRange getStaticVersionRange()
|
||||
{
|
||||
return staticRange;
|
||||
}
|
||||
}
|
||||
@@ -32,31 +32,40 @@ public @interface Mod
|
||||
{
|
||||
/**
|
||||
* The unique mod identifier for this mod
|
||||
* @return
|
||||
*/
|
||||
String modid();
|
||||
/**
|
||||
* A user friendly name for the mod
|
||||
* @return
|
||||
*/
|
||||
String name() default "";
|
||||
/**
|
||||
* A version string for this mod
|
||||
* @return
|
||||
*/
|
||||
String version() default "";
|
||||
/**
|
||||
* A simple dependency string for this mod (see modloader's "priorities" string specification)
|
||||
* @return
|
||||
*/
|
||||
String dependencies() default "";
|
||||
/**
|
||||
* Whether to use the mcmod.info metadata by default for this mod.
|
||||
* If true, settings in the mcmod.info file will override settings in these annotations.
|
||||
* @return
|
||||
*/
|
||||
boolean useMetadata() default false;
|
||||
|
||||
/**
|
||||
* The acceptable range of minecraft versions that this mod will load and run in
|
||||
* The default ("empty string") indicates that only the current minecraft version is acceptable.
|
||||
* FML will refuse to run with an error if the minecraft version is not in this range across all mods.
|
||||
* @return A version range as specified by the maven version range specification or the empty string
|
||||
*/
|
||||
String acceptedMinecraftVersions() default "";
|
||||
/**
|
||||
* An optional bukkit plugin that will be injected into the bukkit plugin framework if
|
||||
* this mod is loaded into the FML framework and the bukkit coremod is present.
|
||||
* Instances of the bukkit plugin can be obtained via the {@link BukkitPluginRef} annotation on fields.
|
||||
* @return
|
||||
*/
|
||||
String bukkitPlugin() default "";
|
||||
/**
|
||||
* Mark the designated method as being called at the "pre-initialization" phase
|
||||
* @author cpw
|
||||
@@ -115,7 +124,6 @@ public @interface Mod
|
||||
public @interface Instance {
|
||||
/**
|
||||
* The mod object to inject into this field
|
||||
* @return
|
||||
*/
|
||||
String value() default "";
|
||||
}
|
||||
@@ -129,7 +137,6 @@ public @interface Mod
|
||||
public @interface Metadata {
|
||||
/**
|
||||
* The mod id specifying the metadata to load here
|
||||
* @return
|
||||
*/
|
||||
String value() default "";
|
||||
}
|
||||
@@ -143,12 +150,10 @@ public @interface Mod
|
||||
public @interface Block {
|
||||
/**
|
||||
* The block's name
|
||||
* @return
|
||||
*/
|
||||
String name();
|
||||
/**
|
||||
* The associated ItemBlock subtype for the item (can be null for an ItemBlock)
|
||||
* @return
|
||||
*/
|
||||
Class<?> itemTypeClass() default ItemBlock.class;
|
||||
}
|
||||
@@ -162,12 +167,10 @@ public @interface Mod
|
||||
public @interface Item {
|
||||
/**
|
||||
* The name of the item
|
||||
* @return
|
||||
*/
|
||||
String name();
|
||||
/**
|
||||
* The type of the item
|
||||
* @return
|
||||
*/
|
||||
String typeClass();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.Set;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
|
||||
/**
|
||||
* The container that wraps around mods in the system.
|
||||
@@ -38,66 +39,48 @@ public interface ModContainer
|
||||
{
|
||||
/**
|
||||
* The globally unique modid for this mod
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getModId();
|
||||
|
||||
/**
|
||||
* A human readable name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* A human readable version identifier
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getVersion();
|
||||
|
||||
/**
|
||||
* The location on the file system which this mod came from
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
File getSource();
|
||||
|
||||
/**
|
||||
* The metadata for this mod
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ModMetadata getMetadata();
|
||||
|
||||
/**
|
||||
* Attach this mod to it's metadata from the supplied metadata collection
|
||||
*
|
||||
* @param mc
|
||||
*/
|
||||
void bindMetadata(MetadataCollection mc);
|
||||
|
||||
/**
|
||||
* Set the enabled/disabled state of this mod
|
||||
*
|
||||
* @param enabled
|
||||
*/
|
||||
void setEnabledState(boolean enabled);
|
||||
|
||||
/**
|
||||
* A list of the modids that this mod requires loaded prior to loading
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Set<ArtifactVersion> getRequirements();
|
||||
|
||||
/**
|
||||
* A list of modids that should be loaded prior to this one. The special
|
||||
* value <strong>*</strong> indicates to load <em>before</em> any other mod.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ArtifactVersion> getDependencies();
|
||||
|
||||
@@ -105,16 +88,12 @@ public interface ModContainer
|
||||
* A list of modids that should be loaded <em>after</em> this one. The
|
||||
* special value <strong>*</strong> indicates to load <em>after</em> any
|
||||
* other mod.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ArtifactVersion> getDependants();
|
||||
|
||||
/**
|
||||
* A representative string encapsulating the sorting preferences for this
|
||||
* mod
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getSortingRules();
|
||||
|
||||
@@ -126,7 +105,6 @@ public interface ModContainer
|
||||
*
|
||||
* @param bus
|
||||
* @param controller
|
||||
* @return
|
||||
*/
|
||||
boolean registerBus(EventBus bus, LoadController controller);
|
||||
|
||||
@@ -134,14 +112,11 @@ public interface ModContainer
|
||||
* Does this mod match the supplied mod
|
||||
*
|
||||
* @param mod
|
||||
* @return
|
||||
*/
|
||||
boolean matches(Object mod);
|
||||
|
||||
/**
|
||||
* Get the actual mod object
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Object getMod();
|
||||
|
||||
@@ -152,4 +127,6 @@ public interface ModContainer
|
||||
boolean isNetworkMod();
|
||||
|
||||
String getDisplayVersion();
|
||||
|
||||
VersionRange acceptableMinecraftVersionRange();
|
||||
}
|
||||
@@ -91,10 +91,6 @@ public class ModMetadata
|
||||
public List<ArtifactVersion> dependants;
|
||||
public boolean autogenerated;
|
||||
|
||||
/**
|
||||
* @param mod2
|
||||
* @param type2
|
||||
*/
|
||||
public ModMetadata(JsonNode node)
|
||||
{
|
||||
Map<JsonStringNode, Object> processedFields = Maps.transformValues(node.getFields(), new JsonStringConverter());
|
||||
@@ -145,9 +141,7 @@ public class ModMetadata
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
||||
public String getChildModCountString()
|
||||
{
|
||||
return String.format("%d child mod%s", childMods.size(), childMods.size() != 1 ? "s" : "");
|
||||
@@ -158,9 +152,6 @@ public class ModMetadata
|
||||
return Joiner.on(", ").join(authorList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getChildModList()
|
||||
{
|
||||
return Joiner.on(", ").join(Lists.transform(childMods, new ModNameFunction()));
|
||||
|
||||
@@ -18,7 +18,7 @@ public enum Side {
|
||||
CLIENT, SERVER, BUKKIT;
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return If this is the server environment
|
||||
*/
|
||||
public boolean isServer()
|
||||
{
|
||||
@@ -26,7 +26,7 @@ public enum Side {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return if this is the Client environment
|
||||
*/
|
||||
public boolean isClient()
|
||||
{
|
||||
|
||||
@@ -29,13 +29,11 @@ public @interface SidedProxy
|
||||
{
|
||||
/**
|
||||
* The name of the client side class to load and populate
|
||||
* @return
|
||||
*/
|
||||
String clientSide() default "";
|
||||
|
||||
/**
|
||||
* The name of the server side class to load and populate
|
||||
* @return
|
||||
*/
|
||||
String serverSide() default "";
|
||||
|
||||
|
||||
@@ -69,8 +69,6 @@ public enum TickType {
|
||||
|
||||
/**
|
||||
* Partner ticks that are also cancelled by returning false from onTickInGame
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public EnumSet<TickType> partnerTicks()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.src.NBTBase;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.SaveHandler;
|
||||
import net.minecraft.src.WorldInfo;
|
||||
|
||||
public interface WorldAccessContainer
|
||||
{
|
||||
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info);
|
||||
public void readData(SaveHandler handler, WorldInfo info, Map<String,NBTBase> propertyMap, NBTTagCompound tag);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
public class WrongMinecraftVersionException extends RuntimeException
|
||||
{
|
||||
|
||||
public ModContainer mod;
|
||||
|
||||
public WrongMinecraftVersionException(ModContainer mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -145,6 +145,7 @@ public class AccessTransformer implements IClassTransformer
|
||||
@Override
|
||||
public byte[] transform(String name, byte[] bytes)
|
||||
{
|
||||
if (bytes == null) { return null; }
|
||||
if (!modifiers.containsKey(name)) { return bytes; }
|
||||
|
||||
ClassNode classNode = new ClassNode();
|
||||
|
||||
@@ -51,7 +51,7 @@ public class MCPMerger
|
||||
{
|
||||
if (args.length != 3)
|
||||
{
|
||||
System.out.println("Usage: AccessTransformer <MapFile> <minecraft.jar> <minecraft_server.jar>");
|
||||
System.out.println("Usage: MCPMerger <MapFile> <minecraft.jar> <minecraft_server.jar>");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ public class MCPMerger
|
||||
|
||||
reader.accept(classNode, 0);
|
||||
|
||||
if (!classNode.name.equals("ayn")) //Special case CodecMus so I dont have to make a new patch, anyone who uses this in production code is.. bad.
|
||||
if (!classNode.name.equals("bct")) //Special case CodecMus so I dont have to make a new patch, anyone who uses this in production code is.. bad.
|
||||
{
|
||||
if (classNode.visibleAnnotations == null) classNode.visibleAnnotations = new ArrayList<AnnotationNode>();
|
||||
classNode.visibleAnnotations.add(getSideAnn(isClientOnly));
|
||||
|
||||
@@ -89,6 +89,7 @@ public class MarkerTransformer implements IClassTransformer
|
||||
@Override
|
||||
public byte[] transform(String name, byte[] bytes)
|
||||
{
|
||||
if (bytes == null) { return null; }
|
||||
if (!markers.containsKey(name)) { return bytes; }
|
||||
|
||||
ClassNode classNode = new ClassNode();
|
||||
|
||||
@@ -23,6 +23,8 @@ public class SideTransformer implements IClassTransformer
|
||||
@Override
|
||||
public byte[] transform(String name, byte[] bytes)
|
||||
{
|
||||
if (bytes == null) { return null; }
|
||||
|
||||
ClassNode classNode = new ClassNode();
|
||||
ClassReader classReader = new ClassReader(bytes);
|
||||
classReader.accept(classNode, 0);
|
||||
@@ -33,7 +35,7 @@ public class SideTransformer implements IClassTransformer
|
||||
{
|
||||
System.out.println(String.format("Attempted to load class %s for invalid side %s", classNode.name, SIDE));
|
||||
}
|
||||
return null;
|
||||
throw new RuntimeException(String.format("Attempted to load class %s for invalid side %s", classNode.name, SIDE));
|
||||
}
|
||||
|
||||
Iterator<FieldNode> fields = classNode.fields.iterator();
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package cpw.mods.fml.common.event;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
import cpw.mods.fml.common.LoaderState.ModState;
|
||||
import cpw.mods.fml.common.FMLModContainer;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||
@@ -14,6 +16,7 @@ public class FMLPreInitializationEvent extends FMLStateEvent
|
||||
private File configurationDir;
|
||||
private File suggestedConfigFile;
|
||||
private ASMDataTable asmData;
|
||||
private ModContainer modContainer;
|
||||
|
||||
public FMLPreInitializationEvent(Object... data)
|
||||
{
|
||||
@@ -31,6 +34,7 @@ public class FMLPreInitializationEvent extends FMLStateEvent
|
||||
@Override
|
||||
public void applyModContainer(ModContainer activeContainer)
|
||||
{
|
||||
this.modContainer = activeContainer;
|
||||
this.modMetadata = activeContainer.getMetadata();
|
||||
this.sourceFile = activeContainer.getSource();
|
||||
this.suggestedConfigFile = new File(configurationDir, activeContainer.getModId()+".cfg");
|
||||
@@ -60,4 +64,14 @@ public class FMLPreInitializationEvent extends FMLStateEvent
|
||||
{
|
||||
return asmData;
|
||||
}
|
||||
|
||||
public Properties getVersionProperties()
|
||||
{
|
||||
if (this.modContainer instanceof FMLModContainer)
|
||||
{
|
||||
return ((FMLModContainer)this.modContainer).searchForVersionProperties();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,10 @@ import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.GuiScreen;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NetClientHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetServerHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.WorldClient;
|
||||
@@ -40,29 +41,14 @@ import cpw.mods.fml.common.asm.SideOnly;
|
||||
*/
|
||||
public interface BaseModProxy
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void modsLoaded();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void load();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getPriorities();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getVersion();
|
||||
|
||||
boolean doTickInGUI(TickType type, boolean end, Object... tickData);
|
||||
@@ -73,7 +59,7 @@ public interface BaseModProxy
|
||||
void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix);
|
||||
void takenFromFurnace(EntityPlayer player, ItemStack item);
|
||||
|
||||
public abstract void onClientLogout(NetworkManager manager);
|
||||
public abstract void onClientLogout(INetworkManager manager);
|
||||
|
||||
public abstract void onClientLogin(EntityPlayer player);
|
||||
|
||||
|
||||
@@ -122,9 +122,6 @@ public class BaseModTicker implements ITickHandler
|
||||
return mod.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mod2
|
||||
*/
|
||||
public void setMod(BaseModProxy mod)
|
||||
{
|
||||
this.mod = mod;
|
||||
|
||||
@@ -4,6 +4,8 @@ import cpw.mods.fml.common.network.EntitySpawnPacket;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
|
||||
public interface IModLoaderSidedHelper
|
||||
@@ -17,4 +19,8 @@ public interface IModLoaderSidedHelper
|
||||
|
||||
void sendClientPacket(BaseModProxy mod, Packet250CustomPayload packet);
|
||||
|
||||
void clientConnectionOpened(NetHandler netClientHandler, INetworkManager manager, BaseModProxy mod);
|
||||
|
||||
boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod);
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetLoginHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet1Login;
|
||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
@@ -19,40 +19,43 @@ public class ModLoaderConnectionHandler implements IConnectionHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerLoggedIn(Player player, NetHandler netHandler, NetworkManager manager)
|
||||
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
mod.onClientLogin((EntityPlayer)player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String connectionReceived(NetLoginHandler netHandler, NetworkManager manager)
|
||||
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, String server, int port, NetworkManager manager)
|
||||
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
|
||||
{
|
||||
// noop
|
||||
ModLoaderHelper.sidedHelper.clientConnectionOpened(netClientHandler, manager, mod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionClosed(NetworkManager manager)
|
||||
public void connectionClosed(INetworkManager manager)
|
||||
{
|
||||
mod.serverDisconnect();
|
||||
mod.onClientLogout(manager);
|
||||
if (!ModLoaderHelper.sidedHelper.clientConnectionClosed(manager, mod))
|
||||
{
|
||||
mod.serverDisconnect();
|
||||
mod.onClientLogout(manager);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientLoggedIn(NetHandler nh, NetworkManager manager, Packet1Login login)
|
||||
public void clientLoggedIn(NetHandler nh, INetworkManager manager, Packet1Login login)
|
||||
{
|
||||
mod.serverConnect(nh);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, NetworkManager manager)
|
||||
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
|
||||
{
|
||||
// noop
|
||||
ModLoaderHelper.sidedHelper.clientConnectionOpened(netClientHandler, manager, mod);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -65,6 +65,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
|
||||
public class ModLoaderModContainer implements ModContainer
|
||||
{
|
||||
@@ -357,7 +358,6 @@ public class ModLoaderModContainer implements ModContainer
|
||||
/**
|
||||
* Find all the BaseMods in the system
|
||||
* @param <A>
|
||||
* @return
|
||||
*/
|
||||
public static <A extends BaseModProxy> List<A> findAll(Class<A> clazz)
|
||||
{
|
||||
@@ -426,16 +426,11 @@ public class ModLoaderModContainer implements ModContainer
|
||||
return mod.getVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public BaseModTicker getGameTickHandler()
|
||||
{
|
||||
return this.gameTickHandler;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
||||
public BaseModTicker getGUITickHandler()
|
||||
{
|
||||
return this.guiTickHandler;
|
||||
@@ -615,4 +610,10 @@ public class ModLoaderModContainer implements ModContainer
|
||||
{
|
||||
serverCommands .add(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VersionRange acceptableMinecraftVersionRange()
|
||||
{
|
||||
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package cpw.mods.fml.common.modloader;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
@@ -17,7 +17,7 @@ public class ModLoaderPacketHandler implements IPacketHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketData(NetworkManager manager, Packet250CustomPayload packet, Player player)
|
||||
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
|
||||
{
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
|
||||
@@ -41,30 +41,22 @@ public class ModProperty
|
||||
{
|
||||
this(field, (String)annotationInfo.get("info"), (Double)annotationInfo.get("min"), (Double)annotationInfo.get("max"), (String)annotationInfo.get("name"));
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
||||
public String name()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
||||
public double min()
|
||||
{
|
||||
return min;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
||||
public double max()
|
||||
{
|
||||
return max;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
||||
public String info()
|
||||
{
|
||||
return info;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
@@ -45,7 +45,7 @@ public class EntitySpawnAdjustmentPacket extends FMLPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
FMLCommonHandler.instance().adjustEntityLocationOnClient(this);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
@@ -168,7 +168,7 @@ public class EntitySpawnPacket extends FMLPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
NetworkModHandler nmh = handler.findNetworkModHandler(networkId);
|
||||
ModContainer mc = nmh.getContainer();
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraft.src.Item;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetLoginHandler;
|
||||
import net.minecraft.src.NetServerHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.Packet131MapData;
|
||||
import net.minecraft.src.Packet1Login;
|
||||
@@ -61,7 +61,7 @@ public class FMLNetworkHandler
|
||||
|
||||
private Map<Integer, NetworkModHandler> networkIdLookup = Maps.newHashMap();
|
||||
|
||||
public static void handlePacket250Packet(Packet250CustomPayload packet, NetworkManager network, NetHandler handler)
|
||||
public static void handlePacket250Packet(Packet250CustomPayload packet, INetworkManager network, NetHandler handler)
|
||||
{
|
||||
String target = packet.field_73630_a;
|
||||
|
||||
@@ -79,12 +79,12 @@ public class FMLNetworkHandler
|
||||
}
|
||||
}
|
||||
|
||||
public static void onConnectionEstablishedToServer(NetHandler clientHandler, NetworkManager manager, Packet1Login login)
|
||||
public static void onConnectionEstablishedToServer(NetHandler clientHandler, INetworkManager manager, Packet1Login login)
|
||||
{
|
||||
NetworkRegistry.instance().clientLoggedIn(clientHandler, manager, login);
|
||||
}
|
||||
|
||||
private void handleFMLPacket(Packet250CustomPayload packet, NetworkManager network, NetHandler netHandler)
|
||||
private void handleFMLPacket(Packet250CustomPayload packet, INetworkManager network, NetHandler netHandler)
|
||||
{
|
||||
FMLPacket pkt = FMLPacket.readPacket(packet.field_73629_c);
|
||||
String userName = "";
|
||||
@@ -120,6 +120,12 @@ public class FMLNetworkHandler
|
||||
netLoginHandler.completeConnection("You don't have FML installed, you cannot connect to this server");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Vanilla kicked us for some reason - bye now!
|
||||
FMLLog.fine("Connection from %s was closed by vanilla minecraft", userName);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
switch (loginStates.get(netLoginHandler))
|
||||
@@ -272,7 +278,7 @@ public class FMLNetworkHandler
|
||||
return networkModHandlers.keySet();
|
||||
}
|
||||
|
||||
public static void handlePlayerLogin(EntityPlayerMP player, NetServerHandler netHandler, NetworkManager manager)
|
||||
public static void handlePlayerLogin(EntityPlayerMP player, NetServerHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
NetworkRegistry.instance().playerLoggedIn(player, netHandler, manager);
|
||||
GameRegistry.onPlayerLogin(player);
|
||||
@@ -294,19 +300,19 @@ public class FMLNetworkHandler
|
||||
}
|
||||
}
|
||||
|
||||
public static void onClientConnectionToRemoteServer(NetHandler netClientHandler, String server, int port, NetworkManager networkManager)
|
||||
public static void onClientConnectionToRemoteServer(NetHandler netClientHandler, String server, int port, INetworkManager networkManager)
|
||||
{
|
||||
NetworkRegistry.instance().connectionOpened(netClientHandler, server, port, networkManager);
|
||||
}
|
||||
|
||||
public static void onClientConnectionToIntegratedServer(NetHandler netClientHandler, MinecraftServer server, NetworkManager networkManager)
|
||||
public static void onClientConnectionToIntegratedServer(NetHandler netClientHandler, MinecraftServer server, INetworkManager networkManager)
|
||||
{
|
||||
NetworkRegistry.instance().connectionOpened(netClientHandler, server, networkManager);
|
||||
}
|
||||
|
||||
public static void onConnectionClosed(NetworkManager manager)
|
||||
public static void onConnectionClosed(INetworkManager manager, EntityPlayer player)
|
||||
{
|
||||
NetworkRegistry.instance().connectionClosed(manager);
|
||||
NetworkRegistry.instance().connectionClosed(manager, player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.primitives.Bytes;
|
||||
@@ -91,7 +91,7 @@ public abstract class FMLPacket
|
||||
|
||||
public abstract FMLPacket consumePacket(byte[] data);
|
||||
|
||||
public abstract void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName);
|
||||
public abstract void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName);
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ public interface IChatListener
|
||||
*
|
||||
* @param handler
|
||||
* @param message
|
||||
* @return
|
||||
*/
|
||||
public Packet3Chat clientChat(NetHandler handler, Packet3Chat message);
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package cpw.mods.fml.common.network;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetLoginHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet1Login;
|
||||
|
||||
public interface IConnectionHandler
|
||||
@@ -16,7 +16,7 @@ public interface IConnectionHandler
|
||||
* @param netHandler
|
||||
* @param manager
|
||||
*/
|
||||
void playerLoggedIn(Player player, NetHandler netHandler, NetworkManager manager);
|
||||
void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager);
|
||||
|
||||
/**
|
||||
* If you don't want the connection to continue, return a non-empty string here
|
||||
@@ -27,9 +27,8 @@ public interface IConnectionHandler
|
||||
*
|
||||
* @param netHandler
|
||||
* @param manager
|
||||
* @return
|
||||
*/
|
||||
String connectionReceived(NetLoginHandler netHandler, NetworkManager manager);
|
||||
String connectionReceived(NetLoginHandler netHandler, INetworkManager manager);
|
||||
|
||||
/**
|
||||
* Fired when a remote connection is opened
|
||||
@@ -39,7 +38,7 @@ public interface IConnectionHandler
|
||||
* @param server
|
||||
* @param port
|
||||
*/
|
||||
void connectionOpened(NetHandler netClientHandler, String server, int port, NetworkManager manager);
|
||||
void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager);
|
||||
/**
|
||||
*
|
||||
* Fired when a local connection is opened
|
||||
@@ -49,7 +48,7 @@ public interface IConnectionHandler
|
||||
* @param netClientHandler
|
||||
* @param server
|
||||
*/
|
||||
void connectionOpened(NetHandler netClientHandler, MinecraftServer server, NetworkManager manager);
|
||||
void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager);
|
||||
|
||||
/**
|
||||
* Fired when a connection closes
|
||||
@@ -58,7 +57,7 @@ public interface IConnectionHandler
|
||||
*
|
||||
* @param manager
|
||||
*/
|
||||
void connectionClosed(NetworkManager manager);
|
||||
void connectionClosed(INetworkManager manager);
|
||||
|
||||
/**
|
||||
* Fired when the client established the connection to the server
|
||||
@@ -68,6 +67,6 @@ public interface IConnectionHandler
|
||||
* @param manager
|
||||
* @param login
|
||||
*/
|
||||
void clientLoggedIn(NetHandler clientHandler, NetworkManager manager, Packet1Login login);
|
||||
void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
|
||||
public interface IPacketHandler
|
||||
@@ -11,5 +11,5 @@ public interface IPacketHandler
|
||||
* @param packet The packet itself
|
||||
* @param player A dummy interface representing the player - it can be cast into a real player instance if needed
|
||||
*/
|
||||
public void onPacketData(NetworkManager manager, Packet250CustomPayload packet, Player player);
|
||||
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player);
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
@@ -56,7 +56,7 @@ public class ModIdentifiersPacket extends FMLPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
for (Entry<String,Integer> idEntry : modIds.entrySet())
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -73,10 +73,10 @@ public class ModListRequestPacket extends FMLPacket
|
||||
* This packet is executed on the client to evaluate the server's mod list against
|
||||
* the client
|
||||
*
|
||||
* @see cpw.mods.fml.common.network.FMLPacket#execute()
|
||||
* @see cpw.mods.fml.common.network.FMLPacket#execute(INetworkManager, FMLNetworkHandler, NetHandler, String)
|
||||
*/
|
||||
@Override
|
||||
public void execute(NetworkManager mgr, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
public void execute(INetworkManager mgr, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
List<String> missingMods = Lists.newArrayList();
|
||||
Map<String,String> modVersions = Maps.newHashMap();
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetLoginHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -78,7 +78,7 @@ public class ModListResponsePacket extends FMLPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
Map<String, ModContainer> indexedModList = Maps.newHashMap(Loader.instance().getIndexedModList());
|
||||
List<String> missingClientMods = Lists.newArrayList();
|
||||
|
||||
@@ -17,7 +17,7 @@ import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.VersionRange;
|
||||
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
|
||||
public class ModMissingPacket extends FMLPacket
|
||||
{
|
||||
@@ -86,7 +86,7 @@ public class ModMissingPacket extends FMLPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
FMLCommonHandler.instance().getSidedDelegate().displayMissingMods(this);
|
||||
}
|
||||
|
||||
@@ -13,25 +13,19 @@ public @interface NetworkMod
|
||||
{
|
||||
/**
|
||||
* Does this mod require the client side to be present when installed on a server?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean clientSideRequired() default false;
|
||||
/**
|
||||
* Does this mod require the server side to be present when installed on a client?
|
||||
* @return
|
||||
*/
|
||||
boolean serverSideRequired() default false;
|
||||
/**
|
||||
* A list of Packet250 network channels to register for this mod - these channels
|
||||
* will be universal and will require a universal packethandler to handle them
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String[] channels() default {};
|
||||
/**
|
||||
* An optional range check for client to server communication version compatibility
|
||||
* @return
|
||||
*/
|
||||
String versionBounds() default "";
|
||||
|
||||
@@ -39,34 +33,25 @@ public @interface NetworkMod
|
||||
* A packet handler implementation for channels registered through this annotation
|
||||
* - this packet handler will be universal and handle both client and server
|
||||
* requests.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Class<? extends IPacketHandler> packetHandler() default NULL.class;
|
||||
|
||||
/**
|
||||
* A tiny packet handler implementation based on {@link Packet131MapData} for "small"
|
||||
* data packet loads.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Class<? extends ITinyPacketHandler> tinyPacketHandler() default NULL.class;
|
||||
/**
|
||||
* A connection handler implementation for this network mod
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Class<? extends IConnectionHandler> connectionHandler() default NULL.class;
|
||||
/**
|
||||
* A packet handler and channels to register for the client side
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
SidedPacketHandler clientPacketHandlerSpec() default @SidedPacketHandler(channels = {}, packetHandler = NULL.class );
|
||||
|
||||
/**
|
||||
* A packet handler and channels to register for the server side
|
||||
* @return
|
||||
*/
|
||||
SidedPacketHandler serverPacketHandlerSpec() default @SidedPacketHandler(channels = {}, packetHandler = NULL.class );
|
||||
|
||||
|
||||
@@ -100,15 +100,15 @@ public class NetworkModHandler
|
||||
}
|
||||
}
|
||||
|
||||
FMLLog.finest("Testing mod %s to very it can accept it's own version in a remote connection", container.getModId());
|
||||
FMLLog.finest("Testing mod %s to verify it accepts its own version in a remote connection", container.getModId());
|
||||
boolean acceptsSelf = acceptVersion(container.getVersion());
|
||||
if (!acceptsSelf)
|
||||
{
|
||||
FMLLog.severe("The mod %s appears to reject it's own version number (%s) in it's version handling. This is likely a severe bug in the mod!", container.getModId(), container.getVersion());
|
||||
FMLLog.severe("The mod %s appears to reject its own version number (%s) in its version handling. This is likely a severe bug in the mod!", container.getModId(), container.getVersion());
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.finest("The mod %s accepts it's own version (%s)", container.getModId(), container.getVersion());
|
||||
FMLLog.finest("The mod %s accepts its own version (%s)", container.getModId(), container.getVersion());
|
||||
}
|
||||
|
||||
tryCreatingPacketHandler(container, mod.packetHandler(), mod.channels(), null);
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetLoginHandler;
|
||||
import net.minecraft.src.NetServerHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet131MapData;
|
||||
import net.minecraft.src.Packet1Login;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
@@ -80,7 +80,6 @@ public class NetworkRegistry
|
||||
* Is the specified channel active for the player?
|
||||
* @param channel
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean isChannelActive(String channel, Player player)
|
||||
{
|
||||
@@ -160,7 +159,7 @@ public class NetworkRegistry
|
||||
chatListeners.add(listener);
|
||||
}
|
||||
|
||||
void playerLoggedIn(EntityPlayerMP player, NetServerHandler netHandler, NetworkManager manager)
|
||||
void playerLoggedIn(EntityPlayerMP player, NetServerHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
generateChannelRegistration(player, netHandler, manager);
|
||||
for (IConnectionHandler handler : connectionHandlers)
|
||||
@@ -169,7 +168,7 @@ public class NetworkRegistry
|
||||
}
|
||||
}
|
||||
|
||||
String connectionReceived(NetLoginHandler netHandler, NetworkManager manager)
|
||||
String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
for (IConnectionHandler handler : connectionHandlers)
|
||||
{
|
||||
@@ -182,7 +181,7 @@ public class NetworkRegistry
|
||||
return null;
|
||||
}
|
||||
|
||||
void connectionOpened(NetHandler netClientHandler, String server, int port, NetworkManager networkManager)
|
||||
void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager networkManager)
|
||||
{
|
||||
for (IConnectionHandler handler : connectionHandlers)
|
||||
{
|
||||
@@ -190,7 +189,7 @@ public class NetworkRegistry
|
||||
}
|
||||
}
|
||||
|
||||
void connectionOpened(NetHandler netClientHandler, MinecraftServer server, NetworkManager networkManager)
|
||||
void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager networkManager)
|
||||
{
|
||||
for (IConnectionHandler handler : connectionHandlers)
|
||||
{
|
||||
@@ -198,7 +197,7 @@ public class NetworkRegistry
|
||||
}
|
||||
}
|
||||
|
||||
void clientLoggedIn(NetHandler clientHandler, NetworkManager manager, Packet1Login login)
|
||||
void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login)
|
||||
{
|
||||
generateChannelRegistration(clientHandler.getPlayer(), clientHandler, manager);
|
||||
for (IConnectionHandler handler : connectionHandlers)
|
||||
@@ -207,15 +206,16 @@ public class NetworkRegistry
|
||||
}
|
||||
}
|
||||
|
||||
void connectionClosed(NetworkManager manager)
|
||||
void connectionClosed(INetworkManager manager, EntityPlayer player)
|
||||
{
|
||||
for (IConnectionHandler handler : connectionHandlers)
|
||||
{
|
||||
handler.connectionClosed(manager);
|
||||
}
|
||||
activeChannels.removeAll(player);
|
||||
}
|
||||
|
||||
void generateChannelRegistration(EntityPlayer player, NetHandler netHandler, NetworkManager manager)
|
||||
void generateChannelRegistration(EntityPlayer player, NetHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
Packet250CustomPayload pkt = new Packet250CustomPayload();
|
||||
pkt.field_73630_a = "REGISTER";
|
||||
@@ -224,7 +224,7 @@ public class NetworkRegistry
|
||||
manager.func_74429_a(pkt);
|
||||
}
|
||||
|
||||
void handleCustomPacket(Packet250CustomPayload packet, NetworkManager network, NetHandler handler)
|
||||
void handleCustomPacket(Packet250CustomPayload packet, INetworkManager network, NetHandler handler)
|
||||
{
|
||||
if ("REGISTER".equals(packet.field_73630_a))
|
||||
{
|
||||
@@ -241,7 +241,7 @@ public class NetworkRegistry
|
||||
}
|
||||
|
||||
|
||||
private void handlePacket(Packet250CustomPayload packet, NetworkManager network, Player player)
|
||||
private void handlePacket(Packet250CustomPayload packet, INetworkManager network, Player player)
|
||||
{
|
||||
String channel = packet.field_73630_a;
|
||||
for (IPacketHandler handler : Iterables.concat(universalPacketHandlers.get(channel), player instanceof EntityPlayerMP ? serverPacketHandlers.get(channel) : clientPacketHandlers.get(channel)))
|
||||
@@ -266,10 +266,7 @@ public class NetworkRegistry
|
||||
deactivateChannel(player, channel);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param packet
|
||||
* @return
|
||||
*/
|
||||
|
||||
private List<String> extractChannelList(Packet250CustomPayload packet)
|
||||
{
|
||||
String request = new String(packet.field_73629_c, Charsets.UTF_8);
|
||||
|
||||
@@ -2,7 +2,7 @@ package cpw.mods.fml.common.network;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
@@ -49,7 +49,7 @@ public class OpenGuiPacket extends FMLPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(NetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
|
||||
{
|
||||
EntityPlayer player = netHandler.getPlayer();
|
||||
player.openGui(networkId, modGuiId, player.field_70170_p, x, y, z);
|
||||
|
||||
@@ -363,7 +363,6 @@ public class EntityRegistry
|
||||
* @param updateRange
|
||||
* @param updateInterval
|
||||
* @param sendVelocityInfo
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static EntityRegistration registerModLoaderEntity(Object mod, Class<? extends Entity> entityClass, int entityTypeId, int updateRange, int updateInterval,
|
||||
|
||||
@@ -118,7 +118,6 @@ public class GameRegistry
|
||||
* @param xVelocity
|
||||
* @param zVelocity
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
public static int tryDispense(World world, int x, int y, int z, int xVelocity, int zVelocity, ItemStack item, Random random, double entX, double entY, double entZ)
|
||||
{
|
||||
@@ -137,7 +136,6 @@ public class GameRegistry
|
||||
* @param container
|
||||
* @param type
|
||||
* @param annotation
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Object buildBlock(ModContainer container, Class<?> type, Block annotation) throws Exception
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package cpw.mods.fml.common.registry;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -20,6 +23,25 @@ public class LanguageRegistry
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public String getStringLocalization(String key)
|
||||
{
|
||||
return getStringLocalization(key, StringTranslate.func_74808_a().func_74811_c());
|
||||
}
|
||||
|
||||
public String getStringLocalization(String key, String lang)
|
||||
{
|
||||
String localizedString = "";
|
||||
Properties langPack = modLanguageData.get(lang);
|
||||
|
||||
if (langPack != null) {
|
||||
if (langPack.getProperty(key) != null) {
|
||||
localizedString = langPack.getProperty(key);
|
||||
}
|
||||
}
|
||||
|
||||
return localizedString;
|
||||
}
|
||||
|
||||
public void addStringLocalization(String key, String value)
|
||||
{
|
||||
addStringLocalization(key, "en_US", value);
|
||||
@@ -34,6 +56,21 @@ public class LanguageRegistry
|
||||
langPack.put(key,value);
|
||||
}
|
||||
|
||||
public void addStringLocalization(Properties langPackAdditions) {
|
||||
addStringLocalization(langPackAdditions, "en_US");
|
||||
}
|
||||
|
||||
public void addStringLocalization(Properties langPackAdditions, String lang) {
|
||||
Properties langPack = modLanguageData.get(lang);
|
||||
if (langPack == null) {
|
||||
langPack = new Properties();
|
||||
modLanguageData.put(lang, langPack);
|
||||
}
|
||||
if (langPackAdditions != null) {
|
||||
langPack.putAll(langPackAdditions);
|
||||
}
|
||||
}
|
||||
|
||||
public static void reloadLanguageTable()
|
||||
{
|
||||
// reload language table by forcing lang to null and reloading the properties file
|
||||
@@ -58,7 +95,7 @@ public class LanguageRegistry
|
||||
objectName+=".name";
|
||||
addStringLocalization(objectName, lang, name);
|
||||
}
|
||||
|
||||
|
||||
public static void addName(Object objectToName, String name)
|
||||
{
|
||||
instance().addNameForObject(objectToName, "en_US", name);
|
||||
@@ -76,4 +113,41 @@ public class LanguageRegistry
|
||||
}
|
||||
languagePack.putAll(langPack);
|
||||
}
|
||||
|
||||
public void loadLocalization(String localizationFile, String lang, boolean isXML)
|
||||
{
|
||||
loadLocalization(this.getClass().getResource(localizationFile), lang, isXML);
|
||||
}
|
||||
|
||||
public void loadLocalization(URL localizationFile, String lang, boolean isXML)
|
||||
{
|
||||
InputStream langStream = null;
|
||||
Properties langPack = new Properties();
|
||||
|
||||
try {
|
||||
langStream = localizationFile.openStream();
|
||||
|
||||
if (isXML) {
|
||||
langPack.loadFromXML(langStream);
|
||||
}
|
||||
else {
|
||||
langPack.load(langStream);
|
||||
}
|
||||
|
||||
addStringLocalization(langPack, lang);
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
if (langStream != null) {
|
||||
langStream.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.src.StructureVillagePieces;
|
||||
import net.minecraft.src.Tuple;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
@@ -33,6 +34,7 @@ public class VillagerRegistry
|
||||
private Multimap<Integer, IVillageTradeHandler> tradeHandlers = ArrayListMultimap.create();
|
||||
private Map<Class<?>, IVillageCreationHandler> villageCreationHandlers = Maps.newHashMap();
|
||||
private Map<Integer, String> newVillagers = Maps.newHashMap();
|
||||
private List<Integer> newVillagerIds = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* Allow access to the {@link StructureVillagePieces} array controlling new village
|
||||
@@ -48,13 +50,11 @@ public class VillagerRegistry
|
||||
*
|
||||
* @param random
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
StructureVillagePieceWeight getVillagePieceWeight(Random random, int i);
|
||||
|
||||
/**
|
||||
* The class of the root structure component to add to the village
|
||||
* @return
|
||||
*/
|
||||
Class<?> getComponentClass();
|
||||
|
||||
@@ -70,7 +70,6 @@ public class VillagerRegistry
|
||||
* @param p3
|
||||
* @param p4
|
||||
* @param p5
|
||||
* @return
|
||||
*/
|
||||
Object buildComponent(StructureVillagePieceWeight villagePiece, ComponentVillageStartPiece startPiece, List pieces, Random random, int p1,
|
||||
int p2, int p3, int p4, int p5);
|
||||
@@ -90,7 +89,6 @@ public class VillagerRegistry
|
||||
*
|
||||
* @param villager
|
||||
* @param recipeList
|
||||
* @param random
|
||||
*/
|
||||
void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random);
|
||||
}
|
||||
@@ -114,6 +112,7 @@ public class VillagerRegistry
|
||||
throw new RuntimeException();
|
||||
}
|
||||
newVillagers.put(villagerId, villagerSkin);
|
||||
newVillagerIds.add(villagerId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +141,6 @@ public class VillagerRegistry
|
||||
*
|
||||
* @param villagerType
|
||||
* @param defaultSkin
|
||||
* @return
|
||||
*/
|
||||
public static String getVillagerSkin(int villagerType, String defaultSkin)
|
||||
{
|
||||
@@ -202,4 +200,11 @@ public class VillagerRegistry
|
||||
}
|
||||
villager.func_70949_b(list, item.func_77612_l(), random, chance);
|
||||
}
|
||||
|
||||
public static void applyRandomTrade(EntityVillager villager, Random rand)
|
||||
{
|
||||
int extra = instance().newVillagerIds.size();
|
||||
int trade = rand.nextInt(5 + extra);
|
||||
villager.func_70938_b(trade < 5 ? trade : instance().newVillagerIds.get(trade - 5));
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class TopologicalSort
|
||||
*
|
||||
* Uses the reverse depth first search as outlined in ...
|
||||
* @param graph
|
||||
* @return
|
||||
* @return The sorted mods list.
|
||||
*/
|
||||
public static <T> List<T> topologicalSort(DirectedGraph<T> graph)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ import javax.swing.JProgressBar;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class Downloader extends JOptionPane
|
||||
public class Downloader extends JOptionPane implements IDownloadDisplay
|
||||
{
|
||||
private JDialog container;
|
||||
private JLabel currentActivity;
|
||||
@@ -45,7 +45,7 @@ public class Downloader extends JOptionPane
|
||||
return box;
|
||||
}
|
||||
|
||||
JDialog makeDialog()
|
||||
public JDialog makeDialog()
|
||||
{
|
||||
setMessageType(JOptionPane.INFORMATION_MESSAGE);
|
||||
setMessage(makeProgressPanel());
|
||||
@@ -94,7 +94,7 @@ public class Downloader extends JOptionPane
|
||||
}
|
||||
}
|
||||
|
||||
void updateProgressString(String progressUpdate, Object... data)
|
||||
public void updateProgressString(String progressUpdate, Object... data)
|
||||
{
|
||||
FMLLog.finest(progressUpdate, data);
|
||||
if (currentActivity!=null)
|
||||
@@ -103,7 +103,7 @@ public class Downloader extends JOptionPane
|
||||
}
|
||||
}
|
||||
|
||||
void resetProgress(int sizeGuess)
|
||||
public void resetProgress(int sizeGuess)
|
||||
{
|
||||
if (progress!=null)
|
||||
{
|
||||
@@ -111,7 +111,7 @@ public class Downloader extends JOptionPane
|
||||
}
|
||||
}
|
||||
|
||||
void updateProgress(int fullLength)
|
||||
public void updateProgress(int fullLength)
|
||||
{
|
||||
if (progress!=null)
|
||||
{
|
||||
@@ -119,10 +119,22 @@ public class Downloader extends JOptionPane
|
||||
}
|
||||
}
|
||||
|
||||
void makeHeadless()
|
||||
public void makeHeadless()
|
||||
{
|
||||
container = null;
|
||||
progress = null;
|
||||
currentActivity = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPokeThread(Thread currentThread)
|
||||
{
|
||||
this.pokeThread = currentThread;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldStopIt()
|
||||
{
|
||||
return stopIt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cpw.mods.fml.relauncher;
|
||||
|
||||
public class DummyDownloader implements IDownloadDisplay
|
||||
{
|
||||
|
||||
@Override
|
||||
public void resetProgress(int sizeGuess)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPokeThread(Thread currentThread)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(int fullLength)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldStopIt()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressString(String string, Object... data)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object makeDialog()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeHeadless()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,13 +22,18 @@ public class FMLRelaunchLog
|
||||
@Override
|
||||
public void publish(LogRecord record)
|
||||
{
|
||||
boolean currInt = Thread.interrupted();
|
||||
try
|
||||
{
|
||||
ConsoleLogThread.recordQueue.put(record);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
Thread.interrupted();
|
||||
e.printStackTrace(errCache);
|
||||
}
|
||||
if (currInt)
|
||||
{
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +66,7 @@ public class FMLRelaunchLog
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace(errCache);
|
||||
Thread.interrupted();
|
||||
// Stupid
|
||||
}
|
||||
@@ -89,14 +95,14 @@ public class FMLRelaunchLog
|
||||
record = this.toString();
|
||||
super.reset();
|
||||
|
||||
currentMessage.append(record);
|
||||
if (currentMessage.lastIndexOf(FMLLogFormatter.LINE_SEPARATOR)>=0)
|
||||
currentMessage.append(record.replace(FMLLogFormatter.LINE_SEPARATOR, "\n"));
|
||||
if (currentMessage.lastIndexOf("\n")>=0)
|
||||
{
|
||||
// Are we longer than just the line separator?
|
||||
if (currentMessage.length()>FMLLogFormatter.LINE_SEPARATOR.length())
|
||||
if (currentMessage.length()>1)
|
||||
{
|
||||
// Trim the line separator
|
||||
currentMessage.setLength(currentMessage.length()-FMLLogFormatter.LINE_SEPARATOR.length());
|
||||
currentMessage.setLength(currentMessage.length()-1);
|
||||
log.log(Level.INFO, currentMessage.toString());
|
||||
}
|
||||
currentMessage.setLength(0);
|
||||
@@ -114,6 +120,8 @@ public class FMLRelaunchLog
|
||||
private static boolean configured;
|
||||
|
||||
private static Thread consoleLogThread;
|
||||
|
||||
private static PrintStream errCache;
|
||||
private Logger myLog;
|
||||
|
||||
private FMLRelaunchLog()
|
||||
@@ -157,6 +165,8 @@ public class FMLRelaunchLog
|
||||
}
|
||||
|
||||
// Set system out to a log stream
|
||||
errCache = System.err;
|
||||
|
||||
System.setOut(new PrintStream(new LoggingOutStream(stdOut), true));
|
||||
System.setErr(new PrintStream(new LoggingOutStream(stdErr), true));
|
||||
|
||||
|
||||
@@ -56,16 +56,28 @@ public class FMLRelauncher
|
||||
if (RelaunchLibraryManager.downloadMonitor != null) { return; }
|
||||
try
|
||||
{
|
||||
RelaunchLibraryManager.downloadMonitor = new Downloader();
|
||||
if (showIt)
|
||||
{
|
||||
popupWindow = RelaunchLibraryManager.downloadMonitor.makeDialog();
|
||||
RelaunchLibraryManager.downloadMonitor = new Downloader();
|
||||
popupWindow = (JDialog) RelaunchLibraryManager.downloadMonitor.makeDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
RelaunchLibraryManager.downloadMonitor = new DummyDownloader();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Throwable e)
|
||||
{
|
||||
if (RelaunchLibraryManager.downloadMonitor == null)
|
||||
{
|
||||
RelaunchLibraryManager.downloadMonitor = new DummyDownloader();
|
||||
e.printStackTrace();
|
||||
}
|
||||
else
|
||||
{
|
||||
RelaunchLibraryManager.downloadMonitor.makeHeadless();
|
||||
}
|
||||
popupWindow = null;
|
||||
RelaunchLibraryManager.downloadMonitor.makeHeadless();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +102,7 @@ public class FMLRelauncher
|
||||
}
|
||||
}
|
||||
|
||||
if (RelaunchLibraryManager.downloadMonitor.stopIt)
|
||||
if (RelaunchLibraryManager.downloadMonitor.shouldStopIt())
|
||||
{
|
||||
System.exit(1);
|
||||
}
|
||||
@@ -108,7 +120,7 @@ public class FMLRelauncher
|
||||
private Class<? super Object> setupNewClientHome(File minecraftHome)
|
||||
{
|
||||
Class<? super Object> client = ReflectionHelper.getClass(classLoader, "net.minecraft.client.Minecraft");
|
||||
ReflectionHelper.setPrivateValue(client, null, minecraftHome, "field_71463_am", "am", "minecraftDir");
|
||||
ReflectionHelper.setPrivateValue(client, null, minecraftHome, "field_71463_am", "an", "minecraftDir");
|
||||
return client;
|
||||
}
|
||||
|
||||
@@ -176,7 +188,7 @@ public class FMLRelauncher
|
||||
if (str != null)
|
||||
{
|
||||
str = str.replace('/', File.separatorChar);
|
||||
ReflectionHelper.setPrivateValue(mcMaster, null, new File(str), "minecraftDir", "am", "minecraftDir");
|
||||
ReflectionHelper.setPrivateValue(mcMaster, null, new File(str), "minecraftDir", "an", "minecraftDir");
|
||||
}
|
||||
// We force minecraft to setup it's homedir very early on so we can
|
||||
// inject stuff into it
|
||||
@@ -189,7 +201,7 @@ public class FMLRelauncher
|
||||
{
|
||||
// Hmmm
|
||||
}
|
||||
File minecraftHome = ReflectionHelper.getPrivateValue(mcMaster, null, "field_71463_am", "am", "minecraftDir");
|
||||
File minecraftHome = ReflectionHelper.getPrivateValue(mcMaster, null, "field_71463_am", "an", "minecraftDir");
|
||||
return minecraftHome;
|
||||
}
|
||||
|
||||
@@ -280,7 +292,7 @@ public class FMLRelauncher
|
||||
popupWindow.setVisible(false);
|
||||
popupWindow.dispose();
|
||||
}
|
||||
if (RelaunchLibraryManager.downloadMonitor.stopIt)
|
||||
if (RelaunchLibraryManager.downloadMonitor.shouldStopIt())
|
||||
{
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package cpw.mods.fml.relauncher;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
|
||||
public interface IDownloadDisplay
|
||||
{
|
||||
|
||||
void resetProgress(int sizeGuess);
|
||||
|
||||
void setPokeThread(Thread currentThread);
|
||||
|
||||
void updateProgress(int fullLength);
|
||||
|
||||
boolean shouldStopIt();
|
||||
|
||||
void updateProgressString(String string, Object ... data);
|
||||
|
||||
Object makeDialog();
|
||||
|
||||
void makeHeadless();
|
||||
|
||||
}
|
||||
@@ -18,12 +18,12 @@ public interface IFMLLoadingPlugin
|
||||
/**
|
||||
* Return a list of classes that implement the ILibrarySet interface
|
||||
*
|
||||
* @return
|
||||
* @return a list of classes that implement the ILibrarySet interface
|
||||
*/
|
||||
String[] getLibraryRequestClass();
|
||||
/**
|
||||
* Return a list of classes that implements the IClassTransformer interface
|
||||
* @return
|
||||
* @return a list of classes that implements the IClassTransformer interface
|
||||
*/
|
||||
String[] getASMTransformerClass();
|
||||
|
||||
|
||||
@@ -12,19 +12,19 @@ public interface ILibrarySet
|
||||
/**
|
||||
* Return a list of libraries available from a common location
|
||||
*
|
||||
* @return
|
||||
* @return a list of libraries available from a common location
|
||||
*/
|
||||
String[] getLibraries();
|
||||
/**
|
||||
* Return the string encoded sha1 hash for each library in the returned list
|
||||
*
|
||||
* @return
|
||||
* @return the string encoded sha1 hash for each library in the returned list
|
||||
*/
|
||||
String[] getHashes();
|
||||
/**
|
||||
* Return the root URL format string from which this library set can be obtained
|
||||
* There needs to be a single %s string substitution which is the library name
|
||||
* @return
|
||||
* @return the root URL format string from which this library set can be obtained
|
||||
*/
|
||||
String getRootURL();
|
||||
}
|
||||
@@ -49,9 +49,10 @@ public class RelaunchClassLoader extends URLClassLoader
|
||||
|
||||
// standard transformer exclusions
|
||||
addTransformerExclusion("javax.");
|
||||
addTransformerExclusion("cpw.mods.fml.");
|
||||
addTransformerExclusion("org.objectweb.asm.");
|
||||
addTransformerExclusion("com.google.common.");
|
||||
addTransformerExclusion("cpw.mods.fml.common.asm.SideOnly");
|
||||
addTransformerExclusion("cpw.mods.fml.common.Side");
|
||||
}
|
||||
|
||||
public void registerTransformer(String transformerClassName)
|
||||
@@ -126,11 +127,6 @@ public class RelaunchClassLoader extends URLClassLoader
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public byte[] getClassBytes(String name) throws IOException
|
||||
{
|
||||
InputStream classStream = null;
|
||||
|
||||
@@ -63,6 +63,42 @@ public class RelaunchLibraryManager
|
||||
|
||||
downloadMonitor.updateProgressString("All core mods are successfully located");
|
||||
// Now that we have the root plugins loaded - lets see what else might be around
|
||||
String commandLineCoremods = System.getProperty("fml.coreMods.load","");
|
||||
for (String s : commandLineCoremods.split(","))
|
||||
{
|
||||
if (s.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
FMLRelaunchLog.info("Found a command line coremod : %s", s);
|
||||
try
|
||||
{
|
||||
actualClassLoader.addTransformerExclusion(s);
|
||||
Class<?> coreModClass = Class.forName(s, true, actualClassLoader);
|
||||
TransformerExclusions trExclusions = coreModClass.getAnnotation(IFMLLoadingPlugin.TransformerExclusions.class);
|
||||
if (trExclusions!=null)
|
||||
{
|
||||
for (String st : trExclusions.value())
|
||||
{
|
||||
actualClassLoader.addTransformerExclusion(st);
|
||||
}
|
||||
}
|
||||
IFMLLoadingPlugin plugin = (IFMLLoadingPlugin) coreModClass.newInstance();
|
||||
loadPlugins.add(plugin);
|
||||
if (plugin.getLibraryRequestClass()!=null)
|
||||
{
|
||||
for (String libName : plugin.getLibraryRequestClass())
|
||||
{
|
||||
libraries.add((ILibrarySet) Class.forName(libName, true, actualClassLoader).newInstance());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
FMLRelaunchLog.log(Level.SEVERE,e,"Exception occured trying to load coremod %s",s);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
discoverCoreMods(mcDir, actualClassLoader, loadPlugins, libraries);
|
||||
|
||||
List<Throwable> caughtErrors = new ArrayList<Throwable>();
|
||||
@@ -85,13 +121,14 @@ public class RelaunchLibraryManager
|
||||
{
|
||||
boolean download = false;
|
||||
String libName = lib.getLibraries()[i];
|
||||
String targFileName = libName.lastIndexOf('/')>=0 ? libName.substring(libName.lastIndexOf('/')) : libName;
|
||||
String checksum = lib.getHashes()[i];
|
||||
File libFile = new File(libDir, libName);
|
||||
File libFile = new File(libDir, targFileName);
|
||||
if (!libFile.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
downloadFile(libFile, lib.getRootURL(), checksum);
|
||||
downloadFile(libFile, lib.getRootURL(), libName, checksum);
|
||||
download = true;
|
||||
}
|
||||
catch (Throwable e)
|
||||
@@ -154,7 +191,7 @@ public class RelaunchLibraryManager
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (downloadMonitor.stopIt)
|
||||
if (downloadMonitor.shouldStopIt())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -414,11 +451,14 @@ public class RelaunchLibraryManager
|
||||
return coreModDir;
|
||||
}
|
||||
|
||||
private static void downloadFile(File libFile, String rootUrl, String hash)
|
||||
private static void downloadFile(File libFile, String rootUrl,String realFilePath, String hash)
|
||||
{
|
||||
try
|
||||
{
|
||||
URL libDownload = new URL(String.format(rootUrl,libFile.getName()));
|
||||
//rootUrl.replace("%s", libFile.getPath())
|
||||
URL libDownload = new URL(String.format(rootUrl,realFilePath));
|
||||
System.out.println("Downloading file: " + libDownload.getHost() + libDownload.getPath());
|
||||
System.out.println("The libFile's path is " + libFile.getAbsolutePath());
|
||||
String infoString = String.format("Downloading file %s", libDownload.toString());
|
||||
downloadMonitor.updateProgressString(infoString);
|
||||
FMLRelaunchLog.info(infoString);
|
||||
@@ -433,7 +473,7 @@ public class RelaunchLibraryManager
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (downloadMonitor.stopIt)
|
||||
if (downloadMonitor.shouldStopIt())
|
||||
{
|
||||
FMLRelaunchLog.warning("You have stopped the downloading operation before it could complete");
|
||||
return;
|
||||
@@ -454,7 +494,7 @@ public class RelaunchLibraryManager
|
||||
|
||||
private static final String HEXES = "0123456789abcdef";
|
||||
private static ByteBuffer downloadBuffer = ByteBuffer.allocateDirect(1 << 22);
|
||||
static Downloader downloadMonitor;
|
||||
static IDownloadDisplay downloadMonitor;
|
||||
|
||||
private static void performDownload(InputStream is, int sizeGuess, String validationHash, File target)
|
||||
{
|
||||
@@ -469,19 +509,19 @@ public class RelaunchLibraryManager
|
||||
downloadMonitor.resetProgress(sizeGuess);
|
||||
try
|
||||
{
|
||||
downloadMonitor.pokeThread = Thread.currentThread();
|
||||
downloadMonitor.setPokeThread(Thread.currentThread());
|
||||
byte[] smallBuffer = new byte[1024];
|
||||
while ((bytesRead = is.read(smallBuffer)) >= 0) {
|
||||
downloadBuffer.put(smallBuffer, 0, bytesRead);
|
||||
fullLength += bytesRead;
|
||||
if (downloadMonitor.stopIt)
|
||||
if (downloadMonitor.shouldStopIt())
|
||||
{
|
||||
break;
|
||||
}
|
||||
downloadMonitor.updateProgress(fullLength);
|
||||
}
|
||||
is.close();
|
||||
downloadMonitor.pokeThread = null;
|
||||
downloadMonitor.setPokeThread(null);
|
||||
downloadBuffer.limit(fullLength);
|
||||
downloadBuffer.position(0);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
/**
|
||||
* Handles primary communication from hooked code into the system
|
||||
*
|
||||
* The FML entry point is {@link #onPreLoad(MinecraftServer)} called from
|
||||
* {@link MinecraftServer}
|
||||
* The FML entry point is {@link #beginServerLoading(MinecraftServer)} called from
|
||||
* {@link DedicatedServer}
|
||||
*
|
||||
* Obfuscated code should focus on this class and other members of the "server"
|
||||
* (or "client") code
|
||||
@@ -97,8 +97,6 @@ public class FMLServerHandler implements IFMLSidedHandler
|
||||
|
||||
/**
|
||||
* Get the server instance
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public MinecraftServer getServer()
|
||||
{
|
||||
|
||||
+56
-60
@@ -1,75 +1,71 @@
|
||||
#Main FML Access Transformer configuration file
|
||||
# TileEntity addMapping
|
||||
public aji.a(Ljava/lang/Class;Ljava/lang/String;)V
|
||||
public amm.a(Ljava/lang/Class;Ljava/lang/String;)V # TileEntity/func_70306_a
|
||||
# EntityList addMappings
|
||||
public jr.a(Ljava/lang/Class;Ljava/lang/String;I)V
|
||||
public jr.a(Ljava/lang/Class;Ljava/lang/String;III)V
|
||||
# EntityList nameToClassMap and idToClassMap and classToNameMap
|
||||
public jr.b
|
||||
public jr.d
|
||||
public jr.c
|
||||
public lf.a(Ljava/lang/Class;Ljava/lang/String;I)V # EntityList/func_75618_a
|
||||
public lf.a(Ljava/lang/Class;Ljava/lang/String;III)V # EntityList/func_75614_a
|
||||
public lf.b # EntityList/field_75625_b nameToClassMap
|
||||
public lf.c # EntityList/field_75626_c classToNameMap
|
||||
public lf.d # EntityList/field_75623_d idToClassMap
|
||||
# RenderEngine
|
||||
public avf.k # texturePack
|
||||
# RenderManager renderers
|
||||
public avy.o
|
||||
public azc.h # RenderEngine/field_78367_h textureList
|
||||
public azc.k # RenderEngine/field_78366_k texturePack
|
||||
# RenderManager
|
||||
public azw.o # RenderManager/field_78729_o renderers
|
||||
# RenderBlocks - everything
|
||||
public avg.*
|
||||
public avg.*()
|
||||
#RenderEngine - make TextureFX list public
|
||||
public avf.h
|
||||
public avf.k # texturePack
|
||||
#RenderPlayer - make armorlist public and not final
|
||||
public-f awr.j
|
||||
#StringTranslate - make the current table and language public
|
||||
public ak.b
|
||||
public ak.d
|
||||
# TileEntityRenderer - make the list of renderers public
|
||||
public axs.m
|
||||
public azd.*
|
||||
public azd.*()
|
||||
#RenderPlayer
|
||||
public-f baq.h # RenderPlayer/field_77110_j armorlist
|
||||
#RenderBiped
|
||||
public-f bae.k # RenderBiped/field_82424_k armorlist
|
||||
#StringTranslate
|
||||
public be.b # StringTranslate/field_74815_b
|
||||
public be.d # StringTranslate/field_74813_d
|
||||
# TileEntityRenderer
|
||||
public bby.m # TileEntityRenderer/field_76966_m
|
||||
# CraftingManager - make the add recipe methods public
|
||||
public td.a(Lrj;[Ljava/lang/Object;)V
|
||||
public td.b(Lrj;[Ljava/lang/Object;)V
|
||||
# WeightedRandomItem - make the "probability" public
|
||||
public is.a
|
||||
# ItemStack - make itemId final
|
||||
#public+f rj.c
|
||||
# StatBase - Make statName public, no server side getter
|
||||
public hp.a
|
||||
# NetLoginHandler make the "complete connection" callback public so I can reset it during FML negotiation
|
||||
public gx.a(Lgx;Z)Z
|
||||
# NetLoginHandler userName field
|
||||
public gx.h
|
||||
public vq.a(Ltv;[Ljava/lang/Object;)V # CraftingManager/func_77595_a
|
||||
public vq.b(Ltv;[Ljava/lang/Object;)V # CraftingManager/func_77596_b
|
||||
# WeightedRandomItem
|
||||
public kg.a # WeightedRandomItem/field_76292_a probability
|
||||
# ItemStack
|
||||
#public+f tv.c # ItemStack/field_77993_c itemId
|
||||
# StatBase
|
||||
public jc.a # StatBase/field_75978_a statName
|
||||
# NetLoginHandler
|
||||
public ik.a(Lik;Z)Z # NetLoginHandler/func_72531_a 'complete connection'
|
||||
public ik.h # NetLoginHandler/field_72543_h userName
|
||||
# EntityPlayerMP getNextWindowId
|
||||
public gu.bO()V
|
||||
public gu.cq
|
||||
# EntityAITaskEntry class -> public
|
||||
public kx
|
||||
# EntityAITasks taskList
|
||||
public kw.a
|
||||
# BlockChest isOcelotBlockingChest (a bounding box check actually)
|
||||
public afe.n(Lup;III)Z
|
||||
public ih.cd()V # EntityPlayerMP/func_71117_bO
|
||||
public ih.cv # EntityPlayerMP/field_71139_cq
|
||||
# EntityAITaskEntry
|
||||
public mo
|
||||
# EntityAITasks
|
||||
public mn.a # EntityAITasks/field_75782_a taskList
|
||||
# BlockChest
|
||||
public ahy.n(Lxd;III)Z # BlockChest/func_72292_n isOcelotBlockingChest
|
||||
# EntityLiving
|
||||
public jw.aM # carryoverDamage
|
||||
# EntityLiving tasks
|
||||
public jw.bg
|
||||
# EntityAIOcelotSit nearestSittableBlock and isblocksittable
|
||||
protected li.a(Lup;III)Z
|
||||
protected li.f()Z
|
||||
public ln.aS # EntityLiving/field_70736_aM carryoverDamage
|
||||
public ln.bn # EntityLiving/field_70714_bg tasks
|
||||
public ln.bG # EntityLiving/field_70703_bu isJumping
|
||||
# EntityAIOcelotSit
|
||||
protected na.a(Lxe;III)Z # EntityAIOcelotSit/func_75398_a nearestSittableBlock
|
||||
protected na.f()Z # EntityAIOcelotSit/func_75399_f isblocksittable
|
||||
# CallableMinecraftVersion - sanity check the MC version
|
||||
public b
|
||||
public b.<init>(La;)V # constructor
|
||||
# EntityAnimal
|
||||
public mn.d # inLove
|
||||
# EntityLiving
|
||||
public jw.bu # isJumping
|
||||
public oh.d # EntityAnimal/field_70881_d inLove
|
||||
# WorldType
|
||||
public va.<init>(ILjava/lang/String;)V
|
||||
public va.<init>(ILjava/lang/String;I)V
|
||||
public xp.<init>(ILjava/lang/String;)V
|
||||
public xp.<init>(ILjava/lang/String;I)V
|
||||
# ComponentVillage
|
||||
public aby
|
||||
# EntityVillager - addbuy and addsell and minmax lists
|
||||
public od.a(Luj;ILjava/util/Random;F)V
|
||||
public od.b(Luj;ILjava/util/Random;F)V
|
||||
public od.bB
|
||||
public od.bC
|
||||
public aeq
|
||||
# EntityVillager - minmax lists
|
||||
public qd.a(Lww;ILjava/util/Random;F)V # EntityVillager/func_70948_a addBuy
|
||||
public qd.b(Lww;ILjava/util/Random;F)V # EntityVillager/func_70949_b addSell
|
||||
public qd.bP # EntityVillager/field_70958_bB
|
||||
public qd.bQ # EntityVillager/field_70960_bC
|
||||
# GuiButtonMerchant
|
||||
public aqw
|
||||
public aum
|
||||
@@ -2,11 +2,11 @@
|
||||
# Only runs at runtime because it's not necessary at compile time
|
||||
# has deobf and obf mappings so it runs OK in mcp
|
||||
# entityplayer -> network/player
|
||||
og cpw/mods/fml/common/network/Player
|
||||
qg cpw/mods/fml/common/network/Player
|
||||
net.minecraft.src.EntityPlayer cpw/mods/fml/common/network/Player
|
||||
# block -> blockproxy
|
||||
aig cpw/mods/fml/common/registry/BlockProxy
|
||||
alf cpw/mods/fml/common/registry/BlockProxy
|
||||
net.minecraft.src.Block cpw/mods/fml/common/registry/BlockProxy
|
||||
# item -> itemproxy
|
||||
rh cpw/mods/fml/common/registry/ItemProxy
|
||||
tt cpw/mods/fml/common/registry/ItemProxy
|
||||
net.minecraft.src.Item cpw/mods/fml/common/registry/ItemProxy
|
||||
+317
-57
File diff suppressed because it is too large.
Load diff
+812
-204
File diff suppressed because it is too large.
Load diff
+15519
-14140
File diff suppressed because it is too large.
Load diff
+4
-4
@@ -36,8 +36,8 @@ DirNatives = %(DirJars)s/bin/natives
|
||||
Client = %(DirJars)s/bin/minecraft.jar
|
||||
Server = %(DirJars)s/minecraft_server.jar
|
||||
LWJGL = %(DirJars)s/bin/jinput.jar,%(DirJars)s/bin/lwjgl.jar,%(DirJars)s/bin/lwjgl_util.jar
|
||||
MD5Client = 969699f13e5bbe7f12e40ac4f32b7d9a
|
||||
MD5Server = c047f82522e53f2ec3c6b64304dfad0f
|
||||
MD5Client = 771175c01778ea67395bc6919a5a9dc5
|
||||
MD5Server = a726380b5546635662d8706dae0586c7
|
||||
|
||||
[RETROGUARD]
|
||||
Location = %(DirRuntime)s/bin/retroguard.jar
|
||||
@@ -123,8 +123,8 @@ LogFile = %(DirLogs)s/mcp.log
|
||||
LogFileErr = %(DirLogs)s/mcperr.log
|
||||
UpdateUrl =
|
||||
IgnoreUpdate = %(DirBin)s,%(DirLib)s,%(DirLogs)s,%(DirModSrc)s,%(DirReobf)s,%(DirSrc)s,%(DirTemp)s,%(DirEclipse)s/Client/bin,%(DirEclipse)s/Server/bin,%(DirJars)s/world,%(DirJars)s/saves,%(DirJars)s/resources
|
||||
RGIndex = 80000
|
||||
ParamIndex = 4000
|
||||
RGIndex = 82000
|
||||
ParamIndex = 5000
|
||||
|
||||
[ASTYLE]
|
||||
AstyleConfig = %(DirConf)s/astyle.cfg
|
||||
|
||||
+299
-103
File diff suppressed because it is too large.
Load diff
+927
-177
File diff suppressed because it is too large.
Load diff
Loaded 100 of 199 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user