More ML compatibility - fix up dragon mounts, thanks!

This commit is contained in:
Christian committed 2012-08-23 00:37:45 -04:00
1 parent ee48a3673d
commit 907cf2d925
7 files changed
+43 -4

No files matched your search

@@ -11,6 +11,7 @@ import net.minecraft.src.Entity;
import net.minecraft.src.EntityClientPlayerMP; import net.minecraft.src.EntityClientPlayerMP;
import net.minecraft.src.EntityPlayer; import net.minecraft.src.EntityPlayer;
import net.minecraft.src.KeyBinding; import net.minecraft.src.KeyBinding;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.Render; import net.minecraft.src.Render;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
@@ -114,4 +115,11 @@ public class ModLoaderClientHelper implements IModLoaderSidedHelper
{ {
return ((net.minecraft.src.BaseMod)mod).spawnEntity(er.getModEntityId(), client.field_71441_e, input.scaledX, input.scaledY, input.scaledZ); return ((net.minecraft.src.BaseMod)mod).spawnEntity(er.getModEntityId(), client.field_71441_e, input.scaledX, input.scaledY, input.scaledZ);
} }
@Override
public void sendClientPacket(BaseModProxy mod, Packet250CustomPayload packet)
{
((net.minecraft.src.BaseMod)mod).clientCustomPayload(client.field_71439_g.field_71174_a, packet);
}
} }
+11
View File
@@ -367,6 +367,12 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
} }
@Override
public void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet)
{
}
@Override @Override
public void serverDisconnect() { public void serverDisconnect() {
@@ -481,4 +487,9 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
return null; return null;
} }
public void clientCustomPayload(NetClientHandler handler, Packet250CustomPayload packet)
{
}
} }
+13
View File
@@ -45,6 +45,10 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.server.FMLServerHandler; import cpw.mods.fml.server.FMLServerHandler;
/**
* @author cpw
*
*/
public class ModLoader public class ModLoader
{ {
public static final String fmlMarker = "This is an FML marker"; public static final String fmlMarker = "This is an FML marker";
@@ -290,6 +294,15 @@ public class ModLoader
EntityRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes); EntityRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
} }
/**
* Send a packet from the client
* @param packet
*/
public static void clientSendPacket(Packet packet)
{
PacketDispatcher.sendPacketToServer(packet);
}
/** /**
* This method is a call in hook from modified external code. Implemented elsewhere. * This method is a call in hook from modified external code. Implemented elsewhere.
* *
@@ -22,6 +22,7 @@ import net.minecraft.src.GuiScreen;
import net.minecraft.src.IInventory; import net.minecraft.src.IInventory;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraft.src.NetHandler; import net.minecraft.src.NetHandler;
import net.minecraft.src.NetServerHandler;
import net.minecraft.src.NetworkManager; import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.World; import net.minecraft.src.World;
@@ -90,4 +91,6 @@ public interface BaseModProxy
public abstract int dispenseEntity(World world, ItemStack item, Random rnd, double x, double y, double z, int xVel, int zVel, double entX, public abstract int dispenseEntity(World world, ItemStack item, Random rnd, double x, double y, double z, int xVel, int zVel, double entX,
double entY, double entZ); double entY, double entZ);
public abstract void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet);
} }
@@ -4,6 +4,7 @@ import cpw.mods.fml.common.network.EntitySpawnPacket;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import net.minecraft.src.Entity; import net.minecraft.src.Entity;
import net.minecraft.src.EntityPlayer; import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Packet250CustomPayload;
public interface IModLoaderSidedHelper public interface IModLoaderSidedHelper
{ {
@@ -14,4 +15,6 @@ public interface IModLoaderSidedHelper
Entity spawnEntity(BaseModProxy mod, EntitySpawnPacket input, EntityRegistration registration); Entity spawnEntity(BaseModProxy mod, EntitySpawnPacket input, EntityRegistration registration);
void sendClientPacket(BaseModProxy mod, Packet250CustomPayload packet);
} }
@@ -21,11 +21,11 @@ public class ModLoaderPacketHandler implements IPacketHandler
{ {
if (player instanceof EntityPlayerMP) if (player instanceof EntityPlayerMP)
{ {
mod.onPacket250Received((EntityPlayer) player, packet); mod.serverCustomPayload(((EntityPlayerMP)player).field_71135_a, packet);
} }
else else
{ {
mod.receiveCustomPacket(packet); ModLoaderHelper.sidedHelper.sendClientPacket(mod, packet);
} }
} }
@@ -21,13 +21,14 @@
DataInputStream var2; DataInputStream var2;
ItemStack var3; ItemStack var3;
ItemStack var4; ItemStack var4;
@@ -1029,4 +1036,10 @@ @@ -1029,4 +1036,11 @@
} }
} }
} }
+ +
+ // modloader compat -- yuk!
+ @Override + @Override
+ public EntityPlayer getPlayer() + public EntityPlayerMP getPlayer()
+ { + {
+ return field_72574_e; + return field_72574_e;
+ } + }