More ML compatibility - fix up dragon mounts, thanks!
This commit is contained in:
parent
fe0d081eec
commit
346661cc6b
7 changed files with 43 additions and 4 deletions
|
@ -11,6 +11,7 @@ import net.minecraft.src.Entity;
|
|||
import net.minecraft.src.EntityClientPlayerMP;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.KeyBinding;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.Render;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendClientPacket(BaseModProxy mod, Packet250CustomPayload packet)
|
||||
{
|
||||
((net.minecraft.src.BaseMod)mod).clientCustomPayload(client.field_71439_g.field_71174_a, packet);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -367,6 +367,12 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverDisconnect() {
|
||||
|
||||
|
@ -481,4 +487,9 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModPr
|
|||
return null;
|
||||
}
|
||||
|
||||
public void clientCustomPayload(NetClientHandler handler, Packet250CustomPayload packet)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,6 +45,10 @@ 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";
|
||||
|
@ -290,6 +294,15 @@ public class ModLoader
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraft.src.GuiScreen;
|
|||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.NetServerHandler;
|
||||
import net.minecraft.src.NetworkManager;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
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,
|
||||
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 net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
|
||||
public interface IModLoaderSidedHelper
|
||||
{
|
||||
|
@ -14,4 +15,6 @@ public interface IModLoaderSidedHelper
|
|||
|
||||
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)
|
||||
{
|
||||
mod.onPacket250Received((EntityPlayer) player, packet);
|
||||
mod.serverCustomPayload(((EntityPlayerMP)player).field_71135_a, packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
mod.receiveCustomPacket(packet);
|
||||
ModLoaderHelper.sidedHelper.sendClientPacket(mod, packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,14 @@
|
|||
DataInputStream var2;
|
||||
ItemStack var3;
|
||||
ItemStack var4;
|
||||
@@ -1029,4 +1036,10 @@
|
||||
@@ -1029,4 +1036,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // modloader compat -- yuk!
|
||||
+ @Override
|
||||
+ public EntityPlayer getPlayer()
|
||||
+ public EntityPlayerMP getPlayer()
|
||||
+ {
|
||||
+ return field_72574_e;
|
||||
+ }
|
||||
|
|
Loading…
Reference in a new issue