Fix missing ml.sendpacket, call in renderers

This commit is contained in:
Christian Weeks 2012-05-11 17:31:28 -04:00
parent c032e39fed
commit 394b046220
8 changed files with 77 additions and 0 deletions

View file

@ -46,11 +46,14 @@ import net.minecraft.src.KeyBinding;
import net.minecraft.src.ModTextureStatic;
import net.minecraft.src.NetClientHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet1Login;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.Packet3Chat;
import net.minecraft.src.Render;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.RenderManager;
import net.minecraft.src.RenderPlayer;
import net.minecraft.src.StringTranslate;
import net.minecraft.src.TexturePackBase;
@ -109,6 +112,8 @@ public class FMLClientHandler implements IFMLSidedHandler
private TexturePackBase fallbackTexturePack;
private NetClientHandler networkClient;
// Cached lookups
private static HashMap<String, ArrayList<OverrideInfo>> overrideInfo = new HashMap<String, ArrayList<OverrideInfo>>();
private static HashMap<Integer, BlockRenderInfo> blockModelIds = new HashMap<Integer, BlockRenderInfo>();
@ -164,6 +169,12 @@ public class FMLClientHandler implements IFMLSidedHandler
public void onLoadComplete()
{
Loader.instance().initializeMods();
for (ModContainer mod : Loader.getModList()) {
mod.gatherRenderers(RenderManager.field_1233_a.getRendererList());
for (Render r : ((List<Render>)RenderManager.field_1233_a.getRendererList())) {
r.func_4009_a(RenderManager.field_1233_a);
}
}
client.field_6304_y.loadModKeySettings(harvestKeyBindings());
onTexturePackChange(fallbackTexturePack);
}
@ -406,6 +417,7 @@ public class FMLClientHandler implements IFMLSidedHandler
public void handleServerLogin(Packet1Login loginPacket, NetClientHandler handler, NetworkManager networkManager)
{
this.networkClient=handler;
Packet250CustomPayload packet = new Packet250CustomPayload();
packet.field_44012_a = "REGISTER";
packet.field_44011_c = FMLCommonHandler.instance().getPacketRegistry();
@ -747,4 +759,14 @@ public class FMLClientHandler implements IFMLSidedHandler
onTexturePackChange(fallback);
}
}
/**
* @param packet
*/
public void sendPacket(Packet packet)
{
if (this.networkClient!=null) {
this.networkClient.func_847_a(packet);
}
}
}

View file

@ -409,4 +409,13 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
}
/**
* @param renderers
*/
public void onRenderHarvest(Map renderers)
{
addRenderer((Map<Class<? extends Entity>,Render>)renderers);
}
}

View file

@ -676,6 +676,9 @@ public class ModLoader
{
}
public static void sendPacket(Packet packet) {
FMLClientHandler.instance().sendPacket(packet);
}
/**
* Send a chat message to the server
* {@link FMLClientHandler#handleChatPacket(Packet3Chat, EntityPlayer)}

View file

@ -15,6 +15,7 @@ package cpw.mods.fml.common;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
@ -373,4 +374,13 @@ public class FMLModContainer implements ModContainer
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see cpw.mods.fml.common.ModContainer#gatherRenderers(java.util.Map)
*/
@Override
public void gatherRenderers(Map renderers)
{
// TODO Auto-generated method stub
}
}

View file

@ -15,6 +15,7 @@ package cpw.mods.fml.common;
import java.io.File;
import java.util.List;
import java.util.Map;
import cpw.mods.fml.common.ModContainer.SourceType;
@ -216,4 +217,8 @@ public interface ModContainer
ModMetadata getMetadata();
void setMetadata(ModMetadata meta);
/**
*
*/
void gatherRenderers(Map renderers);
}

View file

@ -642,4 +642,13 @@ public class ModLoaderModContainer implements ModContainer
{
this.metadata=meta;
}
/* (non-Javadoc)
* @see cpw.mods.fml.common.ModContainer#gatherRenderers(java.util.Map)
*/
@Override
public void gatherRenderers(Map renderers)
{
mod.onRenderHarvest(renderers);
}
}

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/src/RenderManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/RenderManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -183,4 +183,8 @@
{
return this.field_1218_p;
}
+
+ public Map<Class<? extends Entity>, Render> getRendererList() {
+ return field_6501_o;
+ }
}

View file

@ -388,6 +388,14 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
}
/**
* @param renderers
*/
public void onRenderHarvest(Map renderers)
{
// NOOP
}
// Spare client junk
// -------
// void addRenderer(Map<Class<? extends Entity>, Render> renderers);