Cleanup of ModLoaderMP and proper update to the latest version of ModLoader

This commit is contained in:
LexManos 2012-03-05 20:02:07 -08:00
parent 1c77b62704
commit 72357310ae
8 changed files with 2544 additions and 28 deletions

View file

@ -0,0 +1,82 @@
--- ../src_base/minecraft_server/net/minecraft/src/BaseMod.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BaseMod.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,18 +5,33 @@
public abstract class BaseMod
{
- public int AddFuel(int var1)
+ public int addFuel(int var1, int var2)
{
return 0;
}
+ public boolean dispenseEntity(World var1, double var2, double var4, double var6, int var8, int var9, ItemStack var10)
+ {
+ return DispenseEntity(var1, var2, var4, var6, var8, var9, var10); //Lazy Flan
+ }
+
public boolean DispenseEntity(World var1, double var2, double var4, double var6, int var8, int var9, ItemStack var10)
{
return false;
}
+ public void generateNether(World var1, Random var2, int var3, int var4)
+ {
+ GenerateNether(var1, var2, var3, var4); //Lazy Flan
+ }
+
public void GenerateNether(World var1, Random var2, int var3, int var4) {}
+ public void generateSurface(World var1, Random var2, int var3, int var4)
+ {
+ GenerateSurface(var1, var2, var3, var4); //Lazy Flan
+ }
+
public void GenerateSurface(World var1, Random var2, int var3, int var4) {}
public String getName()
@@ -32,17 +47,39 @@
public abstract String getVersion();
public abstract void load();
+
+ public void modsLoaded()
+ {
+ ModsLoaded(); //Lazy Flan
+ }
+
+ public void ModsLoaded(){}
- public void OnTickInGame(MinecraftServer var1) {}
+ public void onItemPickup(EntityPlayer var1, ItemStack var2)
+ {
+ OnItemPickup(var1, var2); //Lazy Flan
+ }
+ public void OnItemPickup(EntityPlayer var1, ItemStack var2) {}
- public void ModsLoaded() {}
+ public boolean onTickInGame(MinecraftServer var1)
+ {
+ onTickInGame(var1); //Lazy Flan
+ return true;
+ }
+ public void OnTickInGame(MinecraftServer var1) {}
+ public void takenFromCrafting(EntityPlayer var1, ItemStack var2, IInventory var3)
+ {
+ TakenFromCrafting(var1, var2); //Lazy Flan
+ }
public void TakenFromCrafting(EntityPlayer var1, ItemStack var2) {}
+ public void takenFromFurnace(EntityPlayer var1, ItemStack var2)
+ {
+ TakenFromFurnace(var1, var2);
+ }
public void TakenFromFurnace(EntityPlayer var1, ItemStack var2) {}
-
- public void OnItemPickup(EntityPlayer var1, ItemStack var2) {}
-
+
public String toString()
{
return this.getName() + ' ' + this.getVersion();

View file

@ -15,7 +15,7 @@
+
+ if (delayBeforeCanPickup == 0 && !ForgeHooks.onItemPickup(par1EntityPlayer, this))
+ {
+ ModLoader.OnItemPickup(par1EntityPlayer, item);
+ ModLoader.onItemPickup(par1EntityPlayer, item);
+ this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ par1EntityPlayer.onItemPickup(this, var2);
+ if (item.stackSize <= 0)
@ -29,3 +29,11 @@
if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(this.item))
{
@@ -194,6 +210,7 @@
par1EntityPlayer.triggerAchievement(AchievementList.blazeRod);
}
+ ModLoader.onItemPickup(par1EntityPlayer, item);
this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
par1EntityPlayer.onItemPickup(this, var2);

View file

@ -21,3 +21,12 @@
EntityTrackerEntry2 var1 = ModLoaderMp.HandleEntityTrackerEntries(this.trackedEntity);
@@ -332,7 +339,7 @@
catch (Exception var4)
{
ModLoader.getLogger().throwing("EntityTrackerEntry", "getSpawnPacket", var4);
- ModLoader.ThrowException(String.format("Error sending spawn packet for entity of type %s.", new Object[] {this.trackedEntity.getClass()}), var4);
+ ModLoader.throwException(String.format("Error sending spawn packet for entity of type %s.", new Object[] {this.trackedEntity.getClass()}), var4);
return null;
}
}

View file

@ -8,6 +8,24 @@
public class ModLoaderMp
{
@@ -182,7 +183,7 @@
{
IllegalArgumentException var2 = new IllegalArgumentException("baseModMp cannot be null.");
ModLoader.getLogger().throwing("ModLoaderMP", "SendPacketToAll", var2);
- ModLoader.ThrowException("baseModMp cannot be null.", var2);
+ ModLoader.throwException("baseModMp cannot be null.", var2);
}
else
{
@@ -213,7 +214,7 @@
{
IllegalArgumentException var3 = new IllegalArgumentException("baseModMp cannot be null.");
ModLoader.getLogger().throwing("ModLoaderMP", "SendPacketTo", var3);
- ModLoader.ThrowException("baseModMp cannot be null.", var3);
+ ModLoader.throwException("baseModMp cannot be null.", var3);
}
else
{
@@ -231,13 +232,11 @@
public static World GetPlayerWorld(EntityPlayer var0)
@ -25,3 +43,56 @@
}
}
@@ -267,31 +266,31 @@
catch (IllegalAccessException var4)
{
ModLoader.getLogger().throwing("ModLoaderMP", "AddCustomPacketMapping", var4);
- ModLoader.ThrowException("ModLoaderMP", var4);
+ ModLoader.throwException("ModLoaderMP", var4);
return;
}
catch (IllegalArgumentException var5)
{
ModLoader.getLogger().throwing("ModLoaderMP", "init", var5);
- ModLoader.ThrowException("ModLoaderMP", var5);
+ ModLoader.throwException("ModLoaderMP", var5);
return;
}
catch (InvocationTargetException var6)
{
ModLoader.getLogger().throwing("ModLoaderMP", "init", var6);
- ModLoader.ThrowException("ModLoaderMP", var6);
+ ModLoader.throwException("ModLoaderMP", var6);
return;
}
catch (NoSuchMethodException var7)
{
ModLoader.getLogger().throwing("ModLoaderMP", "init", var7);
- ModLoader.ThrowException("ModLoaderMP", var7);
+ ModLoader.throwException("ModLoaderMP", var7);
return;
}
catch (SecurityException var8)
{
ModLoader.getLogger().throwing("ModLoaderMP", "init", var8);
- ModLoader.ThrowException("ModLoaderMP", var8);
+ ModLoader.throwException("ModLoaderMP", var8);
return;
}
@@ -315,13 +314,13 @@
catch (FileNotFoundException var9)
{
ModLoader.getLogger().throwing("ModLoader", "init", var9);
- ModLoader.ThrowException("ModLoaderMultiplayer", var9);
+ ModLoader.throwException("ModLoaderMultiplayer", var9);
return;
}
catch (IOException var10)
{
ModLoader.getLogger().throwing("ModLoader", "init", var10);
- ModLoader.ThrowException("ModLoaderMultiplayer", var10);
+ ModLoader.throwException("ModLoaderMultiplayer", var10);
return;
}

View file

@ -60,7 +60,7 @@
+ }
+ catch (UnsupportedEncodingException ex)
+ {
+ ModLoader.ThrowException("NetServerHandler.handleCustomPayload", ex);
+ ModLoader.throwException("NetServerHandler.handleCustomPayload", ex);
+ }
+ }
+ else if (pkt.channel.equals("UNREGISTER"))
@ -75,7 +75,7 @@
+ }
+ catch (UnsupportedEncodingException ex)
+ {
+ ModLoader.ThrowException("NetServerHandler.handleCustomPayload", ex);
+ ModLoader.throwException("NetServerHandler.handleCustomPayload", ex);
+ }
+ }
+ else

View file

@ -8,10 +8,12 @@
public class SlotCrafting extends Slot
{
/** The craft matrix inventory linked to this result slot. */
@@ -89,6 +91,7 @@
@@ -88,7 +90,8 @@
this.thePlayer.addStat(AchievementList.bookcase, 1);
}
ModLoader.TakenFromCrafting(this.thePlayer, par1ItemStack);
- ModLoader.TakenFromCrafting(this.thePlayer, par1ItemStack);
+ ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, craftMatrix);
+ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix);
}

View file

@ -50,6 +50,15 @@
{
if (par1ItemStack == null)
{
@@ -287,7 +293,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 : ModLoader.AddAllFuel(var2))))));
+ 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 : ModLoader.addAllFuel(par1ItemStack.itemID, par1ItemStack.getItemDamage()))))));
}
}
@@ -302,4 +308,18 @@
public void openChest() {}