mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-27 15:33:18 +00:00
Created a Entity tracking ans spawning system.
Mod creators should call MinecraftForge.registerEntity to register a entity. All entity ID numbers are Mod Unique. Meaning two mods can have Entity #1. Added client and server side packet handlers for the 'Forge' channel. For use in internal packets such as the new Spawn packet. Updated the build scripts to copy over unique server source files now that there actually are some. For modders: If you have a entity that used MLMP's 'owner' system, you should have your entity implement IThrowableEntity If you have a entity that implments MLMLP's ISpawnable, you should implement ISpawnHandler. They provide the same functionality, just in a cleaner, more orginized way and will be the method used when we eventually drop MLMP.
This commit is contained in:
1 parent
fcc781b100
commit
2ea1775224
17 files changed
+587
-55
No files matched your search
@@ -0,0 +1,45 @@
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityTracker;
|
||||
|
||||
public class ForgeHooksServer
|
||||
{
|
||||
/**
|
||||
* Called when a Entity is being added to a EntityTracker.
|
||||
* If we have valid info, register the entity.
|
||||
*
|
||||
* @param tracker The EntityTracker instance
|
||||
* @param entity The Entity to add
|
||||
* @return True if we registered the Entity
|
||||
*/
|
||||
public static boolean OnTrackEntity(EntityTracker tracker, Entity entity)
|
||||
{
|
||||
EntityTrackerInfo info = MinecraftForge.getEntityTrackerInfo(entity, true);
|
||||
if (info != null)
|
||||
{
|
||||
tracker.trackEntity(entity, info.Range, info.UpdateFrequancy, info.SendVelocityInfo);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private static boolean hasInit = false;
|
||||
public static void init()
|
||||
{
|
||||
if (hasInit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
hasInit = true;
|
||||
ForgeHooks.setPacketHandler(new PacketHandlerServer());
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
init();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.NetworkManager;
|
||||
|
||||
public class PacketHandlerServer implements IPacketHandler
|
||||
{
|
||||
@Override
|
||||
public void onPacketData(NetworkManager network, String channel, byte[] data)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user