diff --git a/.project b/.project
index f57ac6e95d..2ff4e42e85 100644
--- a/.project
+++ b/.project
@@ -18,7 +18,7 @@
minecraft_server2
- /home/cpw/projects/mcworkspace/vanillamcp/src-work/minecraft_server
+ /home/cpw/projects/mcworkspace/vanilla125/src-work/minecraft_server
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
index 739944c4fd..9dca800d56 100644
--- a/.settings/org.eclipse.jdt.ui.prefs
+++ b/.settings/org.eclipse.jdt.ui.prefs
@@ -1,3 +1,3 @@
eclipse.preferences.version=1
-org.eclipse.jdt.ui.javadoc=false
+org.eclipse.jdt.ui.javadoc=true
org.eclipse.jdt.ui.text.custom_code_templates=/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//*\n * The FML Forge Mod Loader suite.\n * Copyright (C) 2012 cpw\n * \n * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free\n * Software Foundation; either version 2.1 of the License, or any later version.\n * \n * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.\n * \n * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51\n * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n *//**\n * @author ${user}\n *\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-Javadoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
diff --git a/build.xml b/build.xml
index 7516b1e148..a4dd5a8545 100644
--- a/build.xml
+++ b/build.xml
@@ -31,8 +31,8 @@
-
-
+
+
@@ -67,8 +67,9 @@
-
-
+
+
+
@@ -140,9 +141,7 @@
-
-
diff --git a/common/fml/FMLHooks.java b/common/cpw/mods/fml/common/FMLHooks.java
similarity index 97%
rename from common/fml/FMLHooks.java
rename to common/cpw/mods/fml/common/FMLHooks.java
index 936a1705ab..b5f1331af2 100644
--- a/common/fml/FMLHooks.java
+++ b/common/cpw/mods/fml/common/FMLHooks.java
@@ -11,7 +11,8 @@
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package fml;
+package cpw.mods.fml.common;
+
public enum FMLHooks {
diff --git a/common/fml/FMLModContainer.java b/common/cpw/mods/fml/common/FMLModContainer.java
similarity index 74%
rename from common/fml/FMLModContainer.java
rename to common/cpw/mods/fml/common/FMLModContainer.java
index de6e654b00..f1b90f6dad 100644
--- a/common/fml/FMLModContainer.java
+++ b/common/cpw/mods/fml/common/FMLModContainer.java
@@ -1,6 +1,5 @@
/*
- * The FML Forge Mod Loader suite.
- * Copyright (C) 2012 cpw
+ * The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
@@ -11,17 +10,17 @@
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package fml;
-
+package cpw.mods.fml.common;
public class FMLModContainer implements ModContainer {
private Mod modDescriptor;
private Object modInstance;
+
public FMLModContainer(Class> clazz) {
- modDescriptor=clazz.getAnnotation(Mod.class);
-
+ modDescriptor = clazz.getAnnotation(Mod.class);
+
try {
- modInstance=clazz.newInstance();
+ modInstance = clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -39,7 +38,7 @@ public class FMLModContainer implements ModContainer {
@Override
public void preInit() {
-
+
}
@Override
@@ -67,13 +66,13 @@ public class FMLModContainer implements ModContainer {
@Override
public void tickStart() {
// TODO Auto-generated method stub
-
+
}
@Override
public void tickEnd() {
// TODO Auto-generated method stub
-
+
}
@Override
@@ -112,4 +111,34 @@ public class FMLModContainer implements ModContainer {
return 0;
}
+ @Override
+ public boolean wantsPickupNotification() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public IPickupNotifier getPickupNotifier() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see cpw.mods.fml.common.ModContainer#wantsToDispense()
+ */
+ @Override
+ public boolean wantsToDispense() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see cpw.mods.fml.common.ModContainer#getDispenseHandler()
+ */
+ @Override
+ public IDispenseHandler getDispenseHandler() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
diff --git a/common/cpw/mods/fml/common/IDispenseHandler.java b/common/cpw/mods/fml/common/IDispenseHandler.java
new file mode 100644
index 0000000000..fa6b0b542a
--- /dev/null
+++ b/common/cpw/mods/fml/common/IDispenseHandler.java
@@ -0,0 +1,19 @@
+/*
+ * The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package cpw.mods.fml.common;
+
+
+public interface IDispenseHandler {
+ boolean dispense(double x, double y, double z, byte xVelocity, byte zVelocity, Object... data);
+
+}
diff --git a/common/cpw/mods/fml/common/IPickupNotifier.java b/common/cpw/mods/fml/common/IPickupNotifier.java
new file mode 100644
index 0000000000..91fecf0a49
--- /dev/null
+++ b/common/cpw/mods/fml/common/IPickupNotifier.java
@@ -0,0 +1,18 @@
+/*
+ * The FML Forge Mod Loader suite.
+ * Copyright (C) 2012 cpw
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package cpw.mods.fml.common;
+
+public interface IPickupNotifier {
+ void notifyPickup(Object... pickupData);
+}
diff --git a/common/cpw/mods/fml/common/IWorldGenerator.java b/common/cpw/mods/fml/common/IWorldGenerator.java
new file mode 100644
index 0000000000..07dd028f99
--- /dev/null
+++ b/common/cpw/mods/fml/common/IWorldGenerator.java
@@ -0,0 +1,20 @@
+/*
+ * The FML Forge Mod Loader suite.
+ * Copyright (C) 2012 cpw
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package cpw.mods.fml.common;
+
+import java.util.Random;
+
+public interface IWorldGenerator {
+ public void generate(Random random, int chunkX, int chunkZ, Object...additionalData);
+}
diff --git a/common/fml/Loader.java b/common/cpw/mods/fml/common/Loader.java
similarity index 95%
rename from common/fml/Loader.java
rename to common/cpw/mods/fml/common/Loader.java
index 96e04b0180..b0c9562f19 100644
--- a/common/fml/Loader.java
+++ b/common/cpw/mods/fml/common/Loader.java
@@ -11,7 +11,7 @@
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package fml;
+package cpw.mods.fml.common;
import java.io.File;
import java.io.FilenameFilter;
@@ -26,15 +26,12 @@ import java.util.Map;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
-import java.util.logging.SimpleFormatter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import net.minecraft.src.BaseMod;
-import fml.ml.ModLoaderModContainer;
-import fml.obf.FMLHandler;
+import cpw.mods.fml.server.FMLHandler;
public class Loader {
private enum State {
@@ -210,11 +207,9 @@ public class Loader {
if (clazz.isAnnotationPresent(Mod.class)) {
// an FML mod
mods.add(FMLModContainer.buildFor(clazz));
- } else if (BaseMod.class.isAssignableFrom(clazz)) {
+ } else if (FMLHandler.INSTANCE.isModLoaderMod(clazz)) {
log.fine(String.format("ModLoader BaseMod class %s found, loading", clazzName));
- @SuppressWarnings("unchecked")
- Class extends BaseMod> bmClazz = (Class extends BaseMod>) clazz;
- ModContainer mc=new ModLoaderModContainer(bmClazz,classSource.getCanonicalPath());
+ ModContainer mc=FMLHandler.INSTANCE.loadBaseModMod(clazz,classSource.getCanonicalPath());
mods.add(mc);
log.fine(String.format("ModLoader BaseMod class %s loaded", clazzName));
} else {
diff --git a/common/fml/LoaderException.java b/common/cpw/mods/fml/common/LoaderException.java
similarity index 97%
rename from common/fml/LoaderException.java
rename to common/cpw/mods/fml/common/LoaderException.java
index 04adb4b975..0cfc8b0074 100644
--- a/common/fml/LoaderException.java
+++ b/common/cpw/mods/fml/common/LoaderException.java
@@ -11,7 +11,7 @@
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package fml;
+package cpw.mods.fml.common;
public class LoaderException extends RuntimeException {
/**
diff --git a/common/fml/Mod.java b/common/cpw/mods/fml/common/Mod.java
similarity index 97%
rename from common/fml/Mod.java
rename to common/cpw/mods/fml/common/Mod.java
index ac498e3b64..47f8a53d43 100644
--- a/common/fml/Mod.java
+++ b/common/cpw/mods/fml/common/Mod.java
@@ -11,7 +11,7 @@
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package fml;
+package cpw.mods.fml.common;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/common/fml/ModClassLoader.java b/common/cpw/mods/fml/common/ModClassLoader.java
similarity index 97%
rename from common/fml/ModClassLoader.java
rename to common/cpw/mods/fml/common/ModClassLoader.java
index d0826fc78b..6b5e976e12 100644
--- a/common/fml/ModClassLoader.java
+++ b/common/cpw/mods/fml/common/ModClassLoader.java
@@ -11,7 +11,7 @@
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package fml;
+package cpw.mods.fml.common;
import java.io.File;
import java.net.MalformedURLException;
diff --git a/common/fml/ModContainer.java b/common/cpw/mods/fml/common/ModContainer.java
similarity index 86%
rename from common/fml/ModContainer.java
rename to common/cpw/mods/fml/common/ModContainer.java
index c8ed9efe5b..29fc16a704 100644
--- a/common/fml/ModContainer.java
+++ b/common/cpw/mods/fml/common/ModContainer.java
@@ -11,7 +11,9 @@
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package fml;
+package cpw.mods.fml.common;
+
+
public interface ModContainer {
boolean wantsPreInit();
@@ -28,4 +30,8 @@ public interface ModContainer {
boolean generatesWorld();
IWorldGenerator getWorldGenerator();
int lookupFuelValue(int itemId, int itemDamage);
+ boolean wantsPickupNotification();
+ IPickupNotifier getPickupNotifier();
+ boolean wantsToDispense();
+ IDispenseHandler getDispenseHandler();
}
diff --git a/common/fml/IWorldGenerator.java b/common/fml/IWorldGenerator.java
deleted file mode 100644
index 42c7c8462c..0000000000
--- a/common/fml/IWorldGenerator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package fml;
-
-import java.util.Random;
-
-public interface IWorldGenerator {
- public void generate(Random random, int chunkX, int chunkZ, Object...additionalData);
-}
diff --git a/common/net/minecraft/src/CommonRegistry.java b/common/net/minecraft/src/CommonRegistry.java
index 8a3d571abb..c036debf02 100644
--- a/common/net/minecraft/src/CommonRegistry.java
+++ b/common/net/minecraft/src/CommonRegistry.java
@@ -16,15 +16,15 @@ package net.minecraft.src;
public class CommonRegistry {
public static void addRecipe(ItemStack output, Object... params) {
- CraftingManager.getInstance().addRecipe(output, params);
+ CraftingManager.func_20151_a().func_20153_a(output, params);
}
public static void addShapelessRecipe(ItemStack output, Object... params) {
- CraftingManager.getInstance().addShapelessRecipe(output, params);
+ CraftingManager.func_20151_a().func_21146_b(output, params);
}
public static void addSmelting(int input, ItemStack output) {
- FurnaceRecipes.smelting().addSmelting(input, output);
+ FurnaceRecipes.func_21162_a().func_21160_a(input, output);
}
public static void registerBlock(Block block) {
@@ -35,7 +35,7 @@ public class CommonRegistry {
try {
assert block!=null : "registerBlock: block cannot be null";
assert itemclass!=null : "registerBlock: itemclass cannot be null";
- int blockItemId=block.blockID-256;
+ int blockItemId=block.field_573_bc-256;
itemclass.getConstructor(int.class).newInstance(blockItemId);
} catch (Exception e) {
//HMMM
diff --git a/patches/minecraft_server/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft_server/net/minecraft/server/MinecraftServer.java.patch
index 90ecb2a718..f09b946f30 100644
--- a/patches/minecraft_server/net/minecraft/server/MinecraftServer.java.patch
+++ b/patches/minecraft_server/net/minecraft/server/MinecraftServer.java.patch
@@ -1,32 +1,31 @@
--- src-reference/minecraft_server/net/minecraft/server/MinecraftServer.java 0000-00-00 00:00:00.000000000 -0000
+++ src-work/minecraft_server/net/minecraft/server/MinecraftServer.java 0000-00-00 00:00:00.000000000 -0000
-@@ -13,6 +13,9 @@
+@@ -13,6 +13,8 @@
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
+
-+import fml.FMLHooks;
-+import fml.obf.FMLHandler;
++import cpw.mods.fml.server.FMLHandler;
import net.minecraft.src.AnvilSaveConverter;
import net.minecraft.src.AnvilSaveHandler;
import net.minecraft.src.AxisAlignedBB;
-@@ -144,6 +147,7 @@
+@@ -100,6 +102,7 @@
var1.start();
- ConsoleLogManager.init();
- logger.info("Starting minecraft server version 1.2.4");
+ ConsoleLogManager.func_641_a();
+ field_6038_a.info("Starting minecraft server version 1.2.5");
+ FMLHandler.INSTANCE.onPreLoad(this);
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L)
{
-@@ -190,6 +194,7 @@
- logger.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file.");
+@@ -146,6 +149,7 @@
+ field_6038_a.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file.");
}
+ FMLHandler.INSTANCE.onLoadComplete();
- this.configManager = new ServerConfigurationManager(this);
- this.entityTracker[0] = new EntityTracker(this, 0);
- this.entityTracker[1] = new EntityTracker(this, -1);
-@@ -430,6 +435,7 @@
+ this.field_6033_f = new ServerConfigurationManager(this);
+ this.field_6028_k[0] = new EntityTracker(this, 0);
+ this.field_6028_k[1] = new EntityTracker(this, -1);
+@@ -370,6 +374,7 @@
var7 = 0L;
}
@@ -34,8 +33,8 @@
var3 += var7;
var1 = var5;
-@@ -446,6 +452,7 @@
- this.doTick();
+@@ -386,6 +391,7 @@
+ this.func_6018_h();
}
}
+ FMLHandler.INSTANCE.onPostTick();
diff --git a/patches/minecraft_server/net/minecraft/src/BlockDispenser.java.patch b/patches/minecraft_server/net/minecraft/src/BlockDispenser.java.patch
new file mode 100644
index 0000000000..1d21ff9861
--- /dev/null
+++ b/patches/minecraft_server/net/minecraft/src/BlockDispenser.java.patch
@@ -0,0 +1,23 @@
+--- src-reference/minecraft_server/net/minecraft/src/BlockDispenser.java 0000-00-00 00:00:00.000000000 -0000
++++ src-work/minecraft_server/net/minecraft/src/BlockDispenser.java 0000-00-00 00:00:00.000000000 -0000
+@@ -2,6 +2,8 @@
+
+ import java.util.Random;
+
++import cpw.mods.fml.server.FMLHandler;
++
+ public class BlockDispenser extends BlockContainer
+ {
+ private Random field_28032_a = new Random();
+@@ -124,7 +126,10 @@
+ }
+ else
+ {
+- if (var12.field_855_c == Item.field_4148_j.field_234_aS)
++ if (FMLHandler.INSTANCE.tryDispensingEntity(p_21036_1_, var13, var15, var17, var9, var10, var12)) {
++ ;
++ }
++ else if (var12.field_855_c == Item.field_4148_j.field_234_aS)
+ {
+ EntityArrow var19 = new EntityArrow(p_21036_1_, var13, var15, var17);
+ var19.func_177_a((double)var9, 0.10000000149011612D, (double)var10, 1.1F, 6.0F);
diff --git a/patches/minecraft_server/net/minecraft/src/ChunkProviderServer.java.patch b/patches/minecraft_server/net/minecraft/src/ChunkProviderServer.java.patch
index e60e832e36..e5a1c322ba 100644
--- a/patches/minecraft_server/net/minecraft/src/ChunkProviderServer.java.patch
+++ b/patches/minecraft_server/net/minecraft/src/ChunkProviderServer.java.patch
@@ -4,16 +4,16 @@
import java.util.List;
import java.util.Set;
-+import fml.obf.FMLHandler;
++import cpw.mods.fml.server.FMLHandler;
+
public class ChunkProviderServer implements IChunkProvider
{
- private Set droppedChunksSet = new HashSet();
-@@ -200,6 +202,7 @@
- if (this.serverChunkGenerator != null)
+ private Set field_725_a = new HashSet();
+@@ -174,6 +176,7 @@
+ if (this.field_730_c != null)
{
- this.serverChunkGenerator.populate(par1IChunkProvider, par2, par3);
-+ FMLHandler.INSTANCE.onChunkPopulate(par1IChunkProvider, par2, par3,this.world,this.serverChunkGenerator);
- var4.setChunkModified();
+ this.field_730_c.func_4055_a(p_4055_1_, p_4055_2_, p_4055_3_);
++ FMLHandler.INSTANCE.onChunkPopulate(p_4055_1_, p_4055_2_, p_4055_3_, this.field_726_g, this.field_730_c);
+ var4.func_336_e();
}
}
diff --git a/patches/minecraft_server/net/minecraft/src/EntityItem.java.patch b/patches/minecraft_server/net/minecraft/src/EntityItem.java.patch
new file mode 100644
index 0000000000..52706f573c
--- /dev/null
+++ b/patches/minecraft_server/net/minecraft/src/EntityItem.java.patch
@@ -0,0 +1,18 @@
+--- src-reference/minecraft_server/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000
++++ src-work/minecraft_server/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000
+@@ -1,5 +1,7 @@
+ package net.minecraft.src;
+
++import cpw.mods.fml.server.FMLHandler;
++
+ public class EntityItem extends Entity
+ {
+ public ItemStack field_429_a;
+@@ -145,6 +147,7 @@
+
+ if (this.field_433_ad == 0 && p_6093_1_.field_416_aj.func_201_a(this.field_429_a))
+ {
++ FMLHandler.INSTANCE.notifyItemPickup(this,p_6093_1_);
+ if (this.field_429_a.field_855_c == Block.field_582_K.field_573_bc)
+ {
+ p_6093_1_.func_27017_a(AchievementList.field_25131_c);
diff --git a/patches/minecraft_server/net/minecraft/src/EntityList.java.patch b/patches/minecraft_server/net/minecraft/src/EntityList.java.patch
index c44c5800dc..bd1bd9a496 100644
--- a/patches/minecraft_server/net/minecraft/src/EntityList.java.patch
+++ b/patches/minecraft_server/net/minecraft/src/EntityList.java.patch
@@ -1,15 +1,15 @@
--- src-reference/minecraft_server/net/minecraft/src/EntityList.java 0000-00-00 00:00:00.000000000 -0000
+++ src-work/minecraft_server/net/minecraft/src/EntityList.java 0000-00-00 00:00:00.000000000 -0000
-@@ -201,4 +201,12 @@
- addMapping(EntityVillager.class, "Villager", 120, 5651507, 12422002);
- addMapping(EntityEnderCrystal.class, "EnderCrystal", 200);
+@@ -166,4 +166,12 @@
+ func_46122_a(EntityVillager.class, "Villager", 120, 5651507, 12422002);
+ func_563_a(EntityEnderCrystal.class, "EnderCrystal", 200);
}
+
+ public static void addNewEntityListMapping(Class extends Entity> entityClass, String entityName, int id) {
-+ addMapping(entityClass, entityName, id);
++ func_563_a(entityClass,entityName,id);
+ }
+
+ public static void addNewEntityListMapping(Class extends Entity> entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour) {
-+ addMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
++ func_46122_a(entityClass,entityName,id,backgroundEggColour,foregroundEggColour);
+ }
}
diff --git a/patches/minecraft_server/net/minecraft/src/TileEntity.java.patch b/patches/minecraft_server/net/minecraft/src/TileEntity.java.patch
index abefd61d13..e461cba053 100644
--- a/patches/minecraft_server/net/minecraft/src/TileEntity.java.patch
+++ b/patches/minecraft_server/net/minecraft/src/TileEntity.java.patch
@@ -1,11 +1,11 @@
--- src-reference/minecraft_server/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
+++ src-work/minecraft_server/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
-@@ -200,4 +200,8 @@
- addMapping(TileEntityEnchantmentTable.class, "EnchantTable");
- addMapping(TileEntityEndPortal.class, "Airportal");
+@@ -145,4 +145,8 @@
+ func_187_a(TileEntityEnchantmentTable.class, "EnchantTable");
+ func_187_a(TileEntityEndPortal.class, "Airportal");
}
+
+ public static void addNewTileEntityMapping(Class extends TileEntity> tileEntityClass, String id) {
-+ addMapping(tileEntityClass, id);
++ func_187_a(tileEntityClass, id);
+ }
}
diff --git a/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch b/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch
index 84eb760976..34c5597518 100644
--- a/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch
+++ b/patches/minecraft_server/net/minecraft/src/TileEntityFurnace.java.patch
@@ -3,17 +3,17 @@
@@ -1,5 +1,7 @@
package net.minecraft.src;
-+import fml.obf.FMLHandler;
++import cpw.mods.fml.server.FMLHandler;
+
public class TileEntityFurnace extends TileEntity implements IInventory
{
- /**
-@@ -294,7 +296,7 @@
+ private ItemStack[] field_489_e = new ItemStack[3];
+@@ -236,7 +238,7 @@
else
{
- int var2 = par1ItemStack.getItem().shiftedIndex;
-- return var2 < 256 && Block.blocksList[var2].blockMaterial == Material.wood ? 300 : (var2 == Item.stick.shiftedIndex ? 100 : (var2 == Item.coal.shiftedIndex ? 1600 : (var2 == Item.bucketLava.shiftedIndex ? 20000 : (var2 == Block.sapling.blockID ? 100 : (var2 == Item.blazeRod.shiftedIndex ? 2400 : 0)))));
-+ return var2 < 256 && Block.blocksList[var2].blockMaterial == Material.wood ? 300 : (var2 == Item.stick.shiftedIndex ? 100 : (var2 == Item.coal.shiftedIndex ? 1600 : (var2 == Item.bucketLava.shiftedIndex ? 20000 : (var2 == Block.sapling.blockID ? 100 : (var2 == Item.blazeRod.shiftedIndex ? 2400 : FMLHandler.INSTANCE.fuelLookup(var2,par1ItemStack.getItemDamage()))))));
+ int var1 = p_194_1_.func_569_a().field_234_aS;
+- return var1 < 256 && Block.field_542_n[var1].field_553_bn == Material.field_524_c ? 300 : (var1 == Item.field_209_B.field_234_aS ? 100 : (var1 == Item.field_168_k.field_234_aS ? 1600 : (var1 == Item.field_201_aw.field_234_aS ? 20000 : (var1 == Block.field_6047_y.field_573_bc ? 100 : (var1 == Item.field_40239_bm.field_234_aS ? 2400 : 0)))));
++ return var1 < 256 && Block.field_542_n[var1].field_553_bn == Material.field_524_c ? 300 : (var1 == Item.field_209_B.field_234_aS ? 100 : (var1 == Item.field_168_k.field_234_aS ? 1600 : (var1 == Item.field_201_aw.field_234_aS ? 20000 : (var1 == Block.field_6047_y.field_573_bc ? 100 : (var1 == Item.field_40239_bm.field_234_aS ? 2400 : FMLHandler.INSTANCE.fuelLookup(var1, p_194_1_.func_21125_h()))))));
}
}
diff --git a/server/cpw/mods/fml/server/FMLHandler.java b/server/cpw/mods/fml/server/FMLHandler.java
new file mode 100644
index 0000000000..18fc13cdb0
--- /dev/null
+++ b/server/cpw/mods/fml/server/FMLHandler.java
@@ -0,0 +1,126 @@
+/*
+ * The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package cpw.mods.fml.server;
+
+import java.util.Random;
+import java.util.logging.Logger;
+
+import cpw.mods.fml.common.FMLHooks;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.ModContainer;
+
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.src.BaseMod;
+import net.minecraft.src.EntityItem;
+import net.minecraft.src.EntityPlayer;
+import net.minecraft.src.IChunkProvider;
+import net.minecraft.src.ItemStack;
+import net.minecraft.src.World;
+
+public enum FMLHandler {
+ INSTANCE;
+ private MinecraftServer server;
+
+ public void onPreLoad(MinecraftServer minecraftServer) {
+ INSTANCE.server = minecraftServer;
+ Loader.instance().loadMods();
+ }
+
+ public void onLoadComplete() {
+ Loader.instance().initializeMods();
+ }
+
+ public void onPreTick() {
+ FMLHooks.INSTANCE.serverTickStart();
+ }
+
+ public void onPostTick() {
+ FMLHooks.INSTANCE.serverTickEnd();
+ }
+
+ public MinecraftServer getServer() {
+ return server;
+ }
+
+ public static Logger getMinecraftLogger() {
+ return MinecraftServer.field_6038_a;
+ }
+
+ public void onChunkPopulate(IChunkProvider chunkProvider, int chunkX, int chunkZ, World world, IChunkProvider generator) {
+ Random fmlRandom = new Random(world.func_22079_j());
+ long xSeed = fmlRandom.nextLong() >> 2 + 1L;
+ long zSeed = fmlRandom.nextLong() >> 2 + 1L;
+
+ fmlRandom.setSeed((xSeed * chunkX + zSeed * chunkZ) ^ world.func_22079_j());
+
+ for (ModContainer mod : Loader.getModList()) {
+ if (mod.generatesWorld()) {
+ mod.getWorldGenerator().generate(fmlRandom, chunkX, chunkZ, world, generator, chunkProvider);
+ }
+ }
+ }
+
+ public int fuelLookup(int itemId, int itemDamage) {
+ int fv = 0;
+ for (ModContainer mod : Loader.getModList()) {
+ fv = Math.max(fv, mod.lookupFuelValue(itemId, itemDamage));
+ }
+ return fv;
+ }
+
+ public boolean isModLoaderMod(Class> clazz) {
+ return BaseMod.class.isAssignableFrom(clazz);
+ }
+
+ public ModContainer loadBaseModMod(Class> clazz, String canonicalPath) {
+ @SuppressWarnings("unchecked")
+ Class extends BaseMod> bmClazz = (Class extends BaseMod>) clazz;
+ return new ModLoaderModContainer(bmClazz, canonicalPath);
+ }
+
+ public void notifyItemPickup(EntityItem entityItem, EntityPlayer entityPlayer) {
+ for (ModContainer mod : Loader.getModList()) {
+ if (mod.wantsPickupNotification()) {
+ mod.getPickupNotifier().notifyPickup(entityItem, entityPlayer);
+ }
+ }
+ }
+
+ public static Logger getFMLLogger() {
+ return Loader.log;
+ }
+
+ public void raiseException(Throwable exception, String message, boolean stopGame) {
+ getFMLLogger().throwing("FMLHandler", "raiseException", exception);
+ throw new RuntimeException(exception);
+ }
+
+ /**
+ * @param p_21036_1_
+ * @param var13
+ * @param var15
+ * @param var17
+ * @param var9
+ * @param var10
+ * @param var12
+ * @return
+ */
+ public boolean tryDispensingEntity(World world, double x, double y, double z, byte xVelocity, byte zVelocity, ItemStack item) {
+ for (ModContainer mod : Loader.getModList()) {
+ if (mod.wantsToDispense() && mod.getDispenseHandler().dispense(x, y, z, xVelocity, zVelocity, world, item)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/server/fml/ml/ModLoaderModContainer.java b/server/cpw/mods/fml/server/ModLoaderModContainer.java
similarity index 79%
rename from server/fml/ml/ModLoaderModContainer.java
rename to server/cpw/mods/fml/server/ModLoaderModContainer.java
index 1a937c3cad..a5710b6763 100644
--- a/server/fml/ml/ModLoaderModContainer.java
+++ b/server/cpw/mods/fml/server/ModLoaderModContainer.java
@@ -11,17 +11,18 @@
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package fml.ml;
+package cpw.mods.fml.server;
import java.util.ArrayList;
import java.util.List;
-import fml.IWorldGenerator;
-import fml.Loader;
-import fml.LoaderException;
-import fml.ModContainer;
-import fml.obf.FMLHandler;
import net.minecraft.src.BaseMod;
+import cpw.mods.fml.common.IDispenseHandler;
+import cpw.mods.fml.common.IPickupNotifier;
+import cpw.mods.fml.common.IWorldGenerator;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.LoaderException;
+import cpw.mods.fml.common.ModContainer;
public class ModLoaderModContainer implements ModContainer {
private Class extends BaseMod> modClazz;
@@ -128,4 +129,30 @@ public class ModLoaderModContainer implements ModContainer {
public int lookupFuelValue(int itemId, int itemDamage) {
return mod.addFuel(itemId, itemDamage);
}
+
+ @Override
+ public boolean wantsPickupNotification() {
+ return true;
+ }
+
+ @Override
+ public IPickupNotifier getPickupNotifier() {
+ return mod;
+ }
+
+ /* (non-Javadoc)
+ * @see cpw.mods.fml.common.ModContainer#wantsToDispense()
+ */
+ @Override
+ public boolean wantsToDispense() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see cpw.mods.fml.common.ModContainer#getDispenseHandler()
+ */
+ @Override
+ public IDispenseHandler getDispenseHandler() {
+ return mod;
+ }
}
diff --git a/server/cpw/mods/fml/server/ReflectionHelper.java b/server/cpw/mods/fml/server/ReflectionHelper.java
new file mode 100644
index 0000000000..83feaa4e96
--- /dev/null
+++ b/server/cpw/mods/fml/server/ReflectionHelper.java
@@ -0,0 +1,69 @@
+/*
+ * The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package cpw.mods.fml.server;
+
+import java.lang.reflect.Field;
+
+public class ReflectionHelper {
+ @SuppressWarnings("unchecked")
+ public static T getPrivateValue(Class super E> classToAccess, E instance, int fieldIndex) {
+ try {
+ Field f = classToAccess.getDeclaredFields()[fieldIndex];
+ f.setAccessible(true);
+ return (T) f.get(instance);
+ } catch (Exception e) {
+ FMLHandler.getFMLLogger().severe(String.format("There was a problem getting field %d from %s", fieldIndex, classToAccess.getName()));
+ FMLHandler.getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static T getPrivateValue(Class super E> classToAccess, E instance, String fieldName) {
+ try {
+ Field f = classToAccess.getDeclaredField(fieldName);
+ f.setAccessible(true);
+ return (T) f.get(instance);
+ } catch (Exception e) {
+ FMLHandler.getFMLLogger().severe(String.format("There was a problem getting field %s from %s", fieldName, classToAccess.getName()));
+ FMLHandler.getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void setPrivateValue(Class super T> classToAccess, T instance, int fieldIndex, E value) {
+ try {
+ Field f = classToAccess.getDeclaredFields()[fieldIndex];
+ f.setAccessible(true);
+ f.set(instance, value);
+ } catch (Exception e) {
+ FMLHandler.getFMLLogger().severe(String.format("There was a problem setting field %d from %s", fieldIndex, classToAccess.getName()));
+ FMLHandler.getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e);
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public static void setPrivateValue(Class super T> classToAccess, T instance, String fieldName, E value) {
+ try {
+ Field f = classToAccess.getDeclaredField(fieldName);
+ f.setAccessible(true);
+ f.set(instance, value);
+ } catch (Exception e) {
+ FMLHandler.getFMLLogger().severe(String.format("There was a problem setting field %s from %s", fieldName, classToAccess.getName()));
+ FMLHandler.getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e);
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/server/fml/obf/FMLHandler.java b/server/fml/obf/FMLHandler.java
deleted file mode 100644
index 2ddaab255f..0000000000
--- a/server/fml/obf/FMLHandler.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * The FML Forge Mod Loader suite.
- * Copyright (C) 2012 cpw
- *
- * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package fml.obf;
-
-import java.util.Random;
-import java.util.logging.Logger;
-
-import fml.FMLHooks;
-import fml.Loader;
-import fml.ModContainer;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.src.BaseMod;
-import net.minecraft.src.IChunkProvider;
-import net.minecraft.src.World;
-
-public enum FMLHandler {
- INSTANCE;
- private MinecraftServer server;
-
- public void onPreLoad(MinecraftServer minecraftServer) {
- INSTANCE.server=minecraftServer;
- Loader.instance().loadMods();
- }
-
- public void onLoadComplete() {
- Loader.instance().initializeMods();
- }
-
- public void onPreTick() {
- FMLHooks.INSTANCE.serverTickStart();
- }
-
- public void onPostTick() {
- FMLHooks.INSTANCE.serverTickEnd();
- }
-
- public MinecraftServer getServer() {
- return server;
- }
-
- public static Logger getMinecraftLogger() {
- return MinecraftServer.logger;
- }
-
- public void onChunkPopulate(IChunkProvider chunkProvider, int chunkX, int chunkZ, World world, IChunkProvider generator) {
- Random fmlRandom=new Random(world.getSeed());
- long xSeed=fmlRandom.nextLong()>>2 + 1L;
- long zSeed=fmlRandom.nextLong()>>2 + 1L;
-
- fmlRandom.setSeed((xSeed * chunkX + zSeed * chunkZ)^world.getSeed());
-
- for (ModContainer mod : Loader.getModList()) {
- if (mod.generatesWorld()) {
- mod.getWorldGenerator().generate(fmlRandom, chunkX, chunkZ, world, generator, chunkProvider);
- }
- }
- }
-
- public int fuelLookup(int itemId, int itemDamage) {
- int fv=0;
- for (ModContainer mod : Loader.getModList()) {
- fv=Math.max(fv, mod.lookupFuelValue(itemId, itemDamage));
- }
- return fv;
- }
-}
diff --git a/server/net/minecraft/src/BaseMod.java b/server/net/minecraft/src/BaseMod.java
index fb8d06abbe..a413d7c376 100644
--- a/server/net/minecraft/src/BaseMod.java
+++ b/server/net/minecraft/src/BaseMod.java
@@ -14,26 +14,32 @@ package net.minecraft.src;
import java.util.Random;
-import fml.IWorldGenerator;
-import fml.Mod;
-import fml.obf.FMLHandler;
-
import net.minecraft.server.MinecraftServer;
-import net.minecraft.src.EntityPlayer;
-import net.minecraft.src.IInventory;
-import net.minecraft.src.ItemStack;
-import net.minecraft.src.Packet250CustomPayload;
-import net.minecraft.src.World;
+import cpw.mods.fml.common.IDispenseHandler;
+import cpw.mods.fml.common.IPickupNotifier;
+import cpw.mods.fml.common.IWorldGenerator;
-public abstract class BaseMod implements IWorldGenerator {
+public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDispenseHandler {
public int addFuel(int id, int metadata) {
return 0;
}
+ @Override
+ public boolean dispense(double x, double y, double z, byte xVelocity, byte zVelocity, Object... data) {
+ return dispenseEntity((World)data[0], x, y, z, xVelocity, zVelocity, (ItemStack)data[1]);
+ }
+
public boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item) {
return false;
}
+ @Override
+ public void notifyPickup(Object... pickupData) {
+ EntityItem item=(EntityItem) pickupData[0];
+ EntityPlayer player=(EntityPlayer) pickupData[1];
+ onItemPickup(player, item.field_429_a);
+ }
+
@Override
public void generate(Random random, int chunkX, int chunkZ, Object... additionalData) {
World w=(World) additionalData[0];
diff --git a/server/net/minecraft/src/ModLoader.java b/server/net/minecraft/src/ModLoader.java
index 2fdd3cc958..0f6fc325dd 100644
--- a/server/net/minecraft/src/ModLoader.java
+++ b/server/net/minecraft/src/ModLoader.java
@@ -15,9 +15,11 @@ package net.minecraft.src;
import java.util.List;
import java.util.logging.Logger;
-import fml.Loader;
-import fml.ml.ModLoaderModContainer;
-import fml.obf.FMLHandler;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.server.FMLHandler;
+import cpw.mods.fml.server.ModLoaderModContainer;
+import cpw.mods.fml.server.ReflectionHelper;
+
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.Achievement;
@@ -70,15 +72,15 @@ public class ModLoader {
}
public static void addRecipe(ItemStack output, Object... params) {
- CraftingManager.getInstance().addRecipe(output, params);
+ CommonRegistry.addRecipe(output, params);
}
public static void addShapelessRecipe(ItemStack output, Object... params) {
- CraftingManager.getInstance().addShapelessRecipe(output, params);
+ CommonRegistry.addShapelessRecipe(output, params);
}
public static void addSmelting(int input, ItemStack output) {
- FurnaceRecipes.smelting().addSmelting(input, output);
+ CommonRegistry.addSmelting(input, output);
}
public static void addSpawn(Class extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList) {
@@ -109,15 +111,15 @@ public class ModLoader {
}
public static Logger getLogger() {
- return FMLHandler.getMinecraftLogger();
+ return FMLHandler.getFMLLogger();
}
public static T getPrivateValue(Class super E> instanceclass, E instance, int fieldindex) {
- return null;
+ return ReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex);
}
public static T getPrivateValue(Class super E> instanceclass, E instance, String field) {
- return null;
+ return ReflectionHelper.getPrivateValue(instanceclass, instance, field);
}
public static int getUniqueEntityId() {
@@ -196,9 +198,11 @@ public class ModLoader {
}
public static void setPrivateValue(Class super T> instanceclass, T instance, int fieldindex, E value) {
+ ReflectionHelper.setPrivateValue(instanceclass, instance, fieldindex, value);
}
public static void setPrivateValue(Class super T> instanceclass, T instance, String field, E value) {
+ ReflectionHelper.setPrivateValue(instanceclass, instance, field, value);
}
public static void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory matrix) {
@@ -208,6 +212,7 @@ public class ModLoader {
}
public static void throwException(String message, Throwable e) {
+ FMLHandler.INSTANCE.raiseException(e, message, true);
}
public static MinecraftServer getMinecraftServerInstance() {
diff --git a/test/fml/test/LoaderTests.java b/test/fml/test/LoaderTests.java
index f961ee6d09..8330e88c9d 100644
--- a/test/fml/test/LoaderTests.java
+++ b/test/fml/test/LoaderTests.java
@@ -17,7 +17,8 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import fml.Loader;
+import cpw.mods.fml.common.Loader;
+
public class LoaderTests {