Updated FML, updated patches

This commit is contained in:
LexManos 2012-08-10 20:30:59 -07:00
parent f374723610
commit 55636eabab
14 changed files with 50 additions and 129 deletions

View file

@ -232,7 +232,7 @@ public class ForgeHooksClient
Minecraft mc = ModLoader.getMinecraftInstance();
if (mc.ingameGUI != null)
{
mc.ingameGUI.func_73827_b().func_73765_a(msg);
mc.ingameGUI.getChatGUI().printChatMessage(msg);
}
}
}

View file

@ -90,7 +90,7 @@ public class DimensionManager
tmp[x++] = entry.getValue();
}
MinecraftServer.getServer().dimensionServerList = tmp;
MinecraftServer.getServer().theWorldServer = tmp;
MinecraftServer.getServer().worldTickTimes.put(id, new long[100]);
}

View file

@ -0,0 +1 @@
/*.xmi

View file

@ -0,0 +1 @@
/*.xml

Binary file not shown.

BIN
fml-src-2.9.129.225.zip Normal file

Binary file not shown.

View file

@ -16,41 +16,32 @@
public abstract class MinecraftServer implements Runnable, IPlayerUsage, ICommandSender
{
@@ -81,6 +83,9 @@
private String hostname;
private int serverPort = -1;
public WorldServer[] dimensionServerList;
+ public List<WorldServer> worlds = new ArrayList<WorldServer>();
+ public Hashtable<Integer, long[]> worldTickTimes = new Hashtable<Integer, long[]>();
+ public int spawnProtectionSize = 16;
/** The ServerConfigurationManager instance. */
private ServerConfigurationManager serverConfigManager;
@@ -127,7 +132,7 @@
@@ -129,7 +131,10 @@
public final long[] tickTimeArray = new long[100];
/** stats are [dimension][tick%100] system.nanoTime is stored. */
- public long[][] timeOfLastDimenstionTick;
+ //public long[][] timeOfLastDimenstionTick;
+ public List<WorldServer> worlds = new ArrayList<WorldServer>();
+ public Hashtable<Integer, long[]> worldTickTimes = new Hashtable<Integer, long[]>();
+ public int spawnProtectionSize = 16;
private KeyPair serverKeyPair;
/** Username of the server owner (for integrated servers) */
@@ -194,8 +199,8 @@
@@ -196,8 +201,6 @@
{
this.convertMapIfNeeded(par1Str);
this.setUserMessage("menu.loadingLevel");
- this.dimensionServerList = new WorldServer[3];
- this.timeOfLastDimenstionTick = new long[this.dimensionServerList.length][100];
+ //this.dimensionServerList = new WorldServer[3];
+ //this.timeOfLastDimenstionTick = new long[this.dimensionServerList.length][100];
- this.theWorldServer = new WorldServer[3];
- this.timeOfLastDimenstionTick = new long[this.theWorldServer.length][100];
ISaveHandler var6 = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true);
WorldInfo var8 = var6.loadWorldInfo();
WorldSettings var7;
@@ -214,46 +219,20 @@
@@ -216,46 +219,18 @@
var7.enableBonusChest();
}
- for (int var9 = 0; var9 < this.dimensionServerList.length; ++var9)
- for (int var9 = 0; var9 < this.theWorldServer.length; ++var9)
- {
- byte var10 = 0;
-
@ -68,32 +59,31 @@
- {
- if (this.isDemo())
- {
- this.dimensionServerList[var9] = new DemoWorldServer(this, var6, par2Str, var10, this.theProfiler);
- this.theWorldServer[var9] = new DemoWorldServer(this, var6, par2Str, var10, this.theProfiler);
- }
- else
- {
- this.dimensionServerList[var9] = new WorldServer(this, var6, par2Str, var10, var7, this.theProfiler);
- this.theWorldServer[var9] = new WorldServer(this, var6, par2Str, var10, var7, this.theProfiler);
- }
- }
- else
- {
- this.dimensionServerList[var9] = new WorldServerMulti(this, var6, par2Str, var10, var7, this.dimensionServerList[0], this.theProfiler);
- this.theWorldServer[var9] = new WorldServerMulti(this, var6, par2Str, var10, var7, this.theWorldServer[0], this.theProfiler);
- }
-
- this.dimensionServerList[var9].addWorldAccess(new WorldManager(this, this.dimensionServerList[var9]));
- this.theWorldServer[var9].addWorldAccess(new WorldManager(this, this.theWorldServer[var9]));
-
+ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, var6, par2Str, 0, theProfiler) : new WorldServer(this, var6, par2Str, 0, var7, theProfiler));
+ for (int dim : DimensionManager.getIDs())
+ {
+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, var6, par2Str, dim, var7, overWorld, theProfiler));
+
+ world.addWorldAccess(new WorldManager(this, world));
if (!this.isSinglePlayer())
{
- this.dimensionServerList[var9].getWorldInfo().setGameType(this.getGameType());
- this.theWorldServer[var9].getWorldInfo().setGameType(this.getGameType());
- }
-
- this.serverConfigManager.setPlayerManager(this.dimensionServerList);
- this.serverConfigManager.setPlayerManager(this.theWorldServer);
- }
-
+ world.getWorldInfo().setGameType(this.getGameType());
@ -104,95 +94,26 @@
this.setDifficultyForAllDimensions(this.getDifficulty());
this.initialWorldChunkLoad();
}
@@ -264,10 +243,10 @@
long var2 = System.currentTimeMillis();
this.setUserMessage("menu.generatingTerrain");
- for (int var4 = 0; var4 < 1; ++var4)
- {
- logger.info("Preparing start region for level " + var4);
- WorldServer var5 = this.dimensionServerList[var4];
+ for (Integer id : DimensionManager.getIDs())
+ {
+ logger.info("Preparing start region for level " + id);
+ WorldServer var5 = (WorldServer)DimensionManager.getWorld(id);
ChunkCoordinates var6 = var5.getSpawnPoint();
for (int var7 = -var1; var7 <= var1 && this.isServerRunning(); var7 += 16)
@@ -342,7 +321,7 @@
{
if (!this.worldIsBeingDeleted)
{
- WorldServer[] var2 = this.dimensionServerList;
+ WorldServer[] var2 = DimensionManager.getWorlds();
int var3 = var2.length;
for (int var4 = 0; var4 < var3; ++var4)
@@ -392,7 +371,7 @@
logger.info("Saving worlds");
this.saveAllDimensions(false);
- WorldServer[] var1 = this.dimensionServerList;
+ WorldServer[] var1 = DimensionManager.getWorlds();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3)
@@ -440,7 +419,7 @@
FMLCommonHandler.instance().handleServerStarted();
long var1 = System.currentTimeMillis();
- FMLCommonHandler.instance().onWorldLoadTick(dimensionServerList);
+ FMLCommonHandler.instance().onWorldLoadTick(DimensionManager.getWorlds());
for (long var50 = 0L; this.serverShouldContinueRunning; this.serverIsRunning = true)
{
@@ -463,7 +442,7 @@
var50 += var7;
var1 = var5;
- if (this.dimensionServerList[0].areAllPlayersAsleep())
+ if (DimensionManager.getWorld(0).areAllPlayersAsleep())
{
this.tick();
var50 = 0L;
@@ -609,13 +588,13 @@
{
this.theProfiler.startSection("levels");
- for (int var1 = 0; var1 < this.dimensionServerList.length; ++var1)
+ for (Integer id : DimensionManager.getIDs())
{
long var2 = System.nanoTime();
- if (var1 == 0 || this.getAllowNether())
- {
- WorldServer var4 = this.dimensionServerList[var1];
+ if (id == 0 || this.getAllowNether())
+ {
+ WorldServer var4 = DimensionManager.getWorld(id);
this.theProfiler.startSection(var4.getWorldInfo().getWorldName());
if (this.tickCounter % 20 == 0)
@@ -651,7 +630,7 @@
@@ -653,7 +628,7 @@
}
}
- this.timeOfLastDimenstionTick[var1][this.tickCounter % 100] = System.nanoTime() - var2;
+ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - var2;
+ worldTickTimes.get(var1)[this.tickCounter % 100] = System.nanoTime() - var2;
}
this.theProfiler.endStartSection("connection");
@@ -700,7 +679,8 @@
@@ -702,7 +677,8 @@
public WorldServer worldServerForDimension(int par1)
{
- return par1 == -1 ? this.dimensionServerList[1] : (par1 == 1 ? this.dimensionServerList[2] : this.dimensionServerList[0]);
- return par1 == -1 ? this.theWorldServer[1] : (par1 == 1 ? this.theWorldServer[2] : this.theWorldServer[0]);
+ WorldServer ret = DimensionManager.getWorld(par1);
+ return (ret != null ? ret : DimensionManager.getWorld(0));
}
@SideOnly(Side.SERVER)
@@ -789,7 +769,7 @@
@@ -791,7 +767,7 @@
public String getServerModName()
{

View file

@ -10,7 +10,7 @@
@@ -10,6 +11,7 @@
/** The list of smelting results. */
private Map smeltingList = new HashMap();
private Map field_77605_c = new HashMap();
private Map experienceList = new HashMap();
+ private Map metaSmeltingList = new HashMap();
/**
@ -27,7 +27,7 @@
return (ItemStack)this.smeltingList.get(Integer.valueOf(par1));
@@ -65,4 +69,34 @@
{
return this.field_77605_c.containsKey(Integer.valueOf(par1)) ? ((Float)this.field_77605_c.get(Integer.valueOf(par1))).floatValue() : 0.0F;
return this.experienceList.containsKey(Integer.valueOf(par1)) ? ((Float)this.experienceList.get(Integer.valueOf(par1))).floatValue() : 0.0F;
}
+
+ /**

View file

@ -9,7 +9,7 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -134,7 +136,7 @@
@@ -136,7 +138,7 @@
var47 = var7 - 39;
var22 = var47 - 10;

View file

@ -16,22 +16,22 @@
long var1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
System.gc();
this.displayStrings[0] = "Memory use: " + var1 / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
@@ -51,14 +53,17 @@
@@ -51,14 +53,18 @@
if (this.field_79017_e.dimensionServerList != null)
if (this.field_79017_e.theWorldServer != null)
{
- for (int var3 = 0; var3 < this.field_79017_e.dimensionServerList.length; ++var3)
+ int x = 0;
+ for (Integer id : DimensionManager.getIDs())
for (int var3 = 0; var3 < this.field_79017_e.theWorldServer.length; ++var3)
{
- this.displayStrings[5 + var3] = "Lvl " + var3 + " tick: " + field_79020_a.format(this.func_79015_a(this.field_79017_e.timeOfLastDimenstionTick[var3]) * 1.0E-6D) + " ms";
+ this.displayStrings[5 + x] = "Lvl " + id + " tick: " + field_79020_a.format(this.func_79015_a(this.field_79017_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms";
- if (this.field_79017_e.dimensionServerList[var3] != null && this.field_79017_e.dimensionServerList[var3].theChunkProviderServer != null)
- if (this.field_79017_e.theWorldServer[var3] != null && this.field_79017_e.theWorldServer[var3].theChunkProviderServer != null)
+ WorldServer world = DimensionManager.getWorld(id);
+ if (world != null && world.theChunkProviderServer != null)
{
- this.displayStrings[5 + var3] = this.displayStrings[5 + var3] + ", " + this.field_79017_e.dimensionServerList[var3].theChunkProviderServer.makeString();
- this.displayStrings[5 + var3] = this.displayStrings[5 + var3] + ", " + this.field_79017_e.theWorldServer[var3].theChunkProviderServer.makeString();
+ this.displayStrings[5 + x] = this.displayStrings[5 + x] + ", " + world.theChunkProviderServer.makeString();
}
+ x++;

View file

@ -8,15 +8,15 @@
public class IntegratedServer extends MinecraftServer
{
@@ -43,44 +44,22 @@
@@ -43,44 +44,20 @@
protected void loadAllDimensions(String par1Str, String par2Str, long par3, WorldType par5WorldType)
{
this.convertMapIfNeeded(par1Str);
- this.dimensionServerList = new WorldServer[3];
- this.timeOfLastDimenstionTick = new long[this.dimensionServerList.length][100];
- this.theWorldServer = new WorldServer[3];
- this.timeOfLastDimenstionTick = new long[this.theWorldServer.length][100];
ISaveHandler var6 = this.getActiveAnvilConverter().getSaveLoader(par1Str, true);
- for (int var7 = 0; var7 < this.dimensionServerList.length; ++var7)
- for (int var7 = 0; var7 < this.theWorldServer.length; ++var7)
- {
- byte var8 = 0;
-
@ -25,9 +25,7 @@
+ for (int dim : DimensionManager.getIDs())
+ {
+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, var6, par2Str, dim, field_71350_m, overWorld, theProfiler));
+
+ world.addWorldAccess(new WorldManager(this, world));
+
+ if (!this.isSinglePlayer())
{
- var8 = -1;
@ -43,20 +41,20 @@
- {
- if (this.isDemo())
- {
- this.dimensionServerList[var7] = new DemoWorldServer(this, var6, par2Str, var8, this.theProfiler);
- this.theWorldServer[var7] = new DemoWorldServer(this, var6, par2Str, var8, this.theProfiler);
- }
- else
- {
- this.dimensionServerList[var7] = new WorldServer(this, var6, par2Str, var8, this.field_71350_m, this.theProfiler);
- this.theWorldServer[var7] = new WorldServer(this, var6, par2Str, var8, this.field_71350_m, this.theProfiler);
- }
- }
- else
- {
- this.dimensionServerList[var7] = new WorldServerMulti(this, var6, par2Str, var8, this.field_71350_m, this.dimensionServerList[0], this.theProfiler);
- this.theWorldServer[var7] = new WorldServerMulti(this, var6, par2Str, var8, this.field_71350_m, this.theWorldServer[0], this.theProfiler);
- }
-
- this.dimensionServerList[var7].addWorldAccess(new WorldManager(this, this.dimensionServerList[var7]));
- this.getConfigurationManager().setPlayerManager(this.dimensionServerList);
- this.theWorldServer[var7].addWorldAccess(new WorldManager(this, this.theWorldServer[var7]));
- this.getConfigurationManager().setPlayerManager(this.theWorldServer);
- }
-
+ }

View file

@ -25,11 +25,11 @@
public void handleChat(Packet3Chat par1Packet3Chat)
{
- this.mc.ingameGUI.func_73827_b().func_73765_a(par1Packet3Chat.message);
- this.mc.ingameGUI.getChatGUI().printChatMessage(par1Packet3Chat.message);
+ ClientChatReceivedEvent event = new ClientChatReceivedEvent(par1Packet3Chat.message);
+ if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null)
+ {
+ this.mc.ingameGUI.func_73827_b().func_73765_a(event.message);
+ this.mc.ingameGUI.getChatGUI().printChatMessage(par1Packet3Chat.message);
+ }
}

View file

@ -16,22 +16,22 @@
long var1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
System.gc();
this.displayStrings[0] = "Memory use: " + var1 / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
@@ -52,14 +54,17 @@
@@ -52,14 +54,18 @@
if (this.field_79017_e.dimensionServerList != null)
if (this.field_79017_e.theWorldServer != null)
{
- for (int var3 = 0; var3 < this.field_79017_e.dimensionServerList.length; ++var3)
+ int x = 0;
+ for (Integer id : DimensionManager.getIDs())
for (int var3 = 0; var3 < this.field_79017_e.theWorldServer.length; ++var3)
{
- this.displayStrings[5 + var3] = "Lvl " + var3 + " tick: " + field_79020_a.format(this.func_79015_a(this.field_79017_e.timeOfLastDimenstionTick[var3]) * 1.0E-6D) + " ms";
+ this.displayStrings[5 + x] = "Lvl " + id + " tick: " + field_79020_a.format(this.func_79015_a(this.field_79017_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms";
- if (this.field_79017_e.dimensionServerList[var3] != null && this.field_79017_e.dimensionServerList[var3].theChunkProviderServer != null)
- if (this.field_79017_e.theWorldServer[var3] != null && this.field_79017_e.theWorldServer[var3].theChunkProviderServer != null)
+ WorldServer world = DimensionManager.getWorld(id);
+ if (world != null && world.theChunkProviderServer != null)
{
- this.displayStrings[5 + var3] = this.displayStrings[5 + var3] + ", " + this.field_79017_e.dimensionServerList[var3].theChunkProviderServer.makeString();
- this.displayStrings[5 + var3] = this.displayStrings[5 + var3] + ", " + this.field_79017_e.theWorldServer[var3].theChunkProviderServer.makeString();
+ this.displayStrings[5 + x] = this.displayStrings[5 + x] + ", " + world.theChunkProviderServer.makeString();
}
+ x++;

View file

@ -11,7 +11,7 @@ from forge import setup_forge_mcp, apply_forge_patches
def main():
print '=================================== Setup Start ================================='
dont_gen_conf = '-no_gen_conf' in sys.argv
dont_gen_conf = True #'-no_gen_conf' in sys.argv
setup_fml(dont_gen_conf)
base_dir = os.path.join(mcp_dir, 'src_base')