Hooked up some entity rendering.
This commit is contained in:
parent
15c1ce54e0
commit
1a5ad78290
4 changed files with 22 additions and 45 deletions
|
@ -14,6 +14,10 @@ import java.io.File;
|
|||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.core.render.RenderEnergyLaser;
|
||||
import buildcraft.core.render.RenderEntityBlock;
|
||||
import buildcraft.core.render.RenderLaser;
|
||||
import buildcraft.core.render.RenderRobot;
|
||||
import buildcraft.core.render.RenderingEntityBlocks;
|
||||
import buildcraft.core.render.RenderingMarkers;
|
||||
import buildcraft.core.render.RenderingOil;
|
||||
|
@ -69,6 +73,8 @@ public class ClientProxyCore extends ProxyCore {
|
|||
public void obsidianPipePickup(World world, EntityItem item, TileEntity tile) {
|
||||
ModLoader.getMinecraftInstance().effectRenderer.addEffect(new TileEntityPickupFX(world, item, tile));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeRendering() {
|
||||
BuildCraftCore.blockByEntityModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
BuildCraftCore.legacyPipeModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
@ -83,6 +89,15 @@ public class ClientProxyCore extends ProxyCore {
|
|||
MinecraftForgeClient.preloadTexture(DefaultProps.TEXTURE_BLOCKS);
|
||||
MinecraftForgeClient.preloadTexture(DefaultProps.TEXTURE_ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeEntityRendering() {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBlock.class, new RenderEntityBlock());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityLaser.class, new RenderLaser());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityEnergyLaser.class, new RenderEnergyLaser());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityRobot.class, new RenderRobot());
|
||||
}
|
||||
|
||||
|
||||
/* NETWORKING */
|
||||
@Override
|
||||
|
|
|
@ -60,6 +60,7 @@ public class ProxyCore {
|
|||
/* GFX */
|
||||
public void obsidianPipePickup(World world, EntityItem item, TileEntity tile) {}
|
||||
public void initializeRendering() {}
|
||||
public void initializeEntityRendering() {}
|
||||
|
||||
/* REGISTRATION */
|
||||
public void registerBlock(Block block) {
|
||||
|
@ -83,10 +84,10 @@ public class ProxyCore {
|
|||
ModLoader.addShapelessRecipe(result, recipe);
|
||||
}
|
||||
|
||||
public void sendToPlayers(Packet packet, World w, int x, int y, int z, int maxDistance) {
|
||||
public void sendToPlayers(Packet packet, World world, int x, int y, int z, int maxDistance) {
|
||||
if (packet != null) {
|
||||
for (int j = 0; j < w.playerEntities.size(); j++) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) w.playerEntities.get(j);
|
||||
for (int j = 0; j < world.playerEntities.size(); j++) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) world.playerEntities.get(j);
|
||||
|
||||
if (Math.abs(player.posX - x) <= maxDistance && Math.abs(player.posY - y) <= maxDistance
|
||||
&& Math.abs(player.posZ - z) <= maxDistance)
|
||||
|
|
|
@ -76,7 +76,8 @@ public abstract class TileBuildCraft extends TileEntity implements ISynchronized
|
|||
}
|
||||
|
||||
public void sendNetworkUpdate() {
|
||||
ProxyCore.proxy.sendToPlayers(getUpdatePacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.NETWORK_UPDATE_RANGE);
|
||||
if(ProxyCore.proxy.isSimulating(worldObj))
|
||||
ProxyCore.proxy.sendToPlayers(getUpdatePacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.NETWORK_UPDATE_RANGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
package buildcraft;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
|
@ -24,16 +23,8 @@ import cpw.mods.fml.common.network.NetworkMod;
|
|||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.core.ClassMapping;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.EntityBlock;
|
||||
import buildcraft.core.EntityEnergyLaser;
|
||||
import buildcraft.core.EntityLaser;
|
||||
import buildcraft.core.EntityRobot;
|
||||
import buildcraft.core.ProxyCore;
|
||||
import buildcraft.core.network.PacketHandler;
|
||||
import buildcraft.core.render.RenderEnergyLaser;
|
||||
import buildcraft.core.render.RenderEntityBlock;
|
||||
import buildcraft.core.render.RenderLaser;
|
||||
import buildcraft.core.render.RenderRobot;
|
||||
import buildcraft.core.utils.Localization;
|
||||
|
||||
@Mod(name="BuildCraft", version=DefaultProps.VERSION, useMetadata = false, modid = "BC|CORE")
|
||||
|
@ -58,7 +49,6 @@ public class mod_BuildCraftCore {
|
|||
@PostInit
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
mod_BuildCraftCore.initialize();
|
||||
//BuildCraftCore.initializeModel(this);
|
||||
// ModLoader.setInGameHook(this, true, true);
|
||||
}
|
||||
|
||||
|
@ -69,6 +59,7 @@ public class mod_BuildCraftCore {
|
|||
|
||||
// Init rendering if applicable
|
||||
ProxyCore.proxy.initializeRendering();
|
||||
ProxyCore.proxy.initializeEntityRendering();
|
||||
|
||||
//Initialize localization
|
||||
Localization.addLocalization("/lang/buildcraft/", DefaultProps.DEFAULT_LANGUAGE);
|
||||
|
@ -77,26 +68,6 @@ public class mod_BuildCraftCore {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public void handlePacket(Packet230ModLoader packet) { switch
|
||||
* (PacketIds.values()[packet.packetType]) { case TileDescription:
|
||||
* Utils.handleDescriptionPacket(packet,
|
||||
* ModLoader.getMinecraftInstance().theWorld); break; case TileUpdate:
|
||||
* Utils.handleUpdatePacket(packet,
|
||||
* ModLoader.getMinecraftInstance().theWorld); break;
|
||||
*
|
||||
* } }
|
||||
*/
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
// @Override
|
||||
public void addRenderer(Map map) {
|
||||
map.put(EntityBlock.class, new RenderEntityBlock());
|
||||
map.put(EntityLaser.class, new RenderLaser());
|
||||
map.put(EntityEnergyLaser.class, new RenderEnergyLaser());
|
||||
map.put(EntityRobot.class, new RenderRobot());
|
||||
}
|
||||
|
||||
long lastReport = 0;
|
||||
|
||||
//@Override
|
||||
|
@ -115,15 +86,4 @@ public class mod_BuildCraftCore {
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public void handlePacket(Packet230ModLoader packet) { switch
|
||||
* (PacketIds.values()[packet.packetType]) { case TileDescription:
|
||||
* Utils.handleDescriptionPacket(packet,
|
||||
* ModLoader.getMinecraftInstance().theWorld); break; case TileUpdate:
|
||||
* Utils.handleUpdatePacket(packet,
|
||||
* ModLoader.getMinecraftInstance().theWorld); break;
|
||||
*
|
||||
* } }
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue