Re-enabled rendering of oil.

This commit is contained in:
SirSengir 2012-08-21 15:53:38 +02:00
parent d1275161af
commit b29be13156
5 changed files with 46 additions and 16 deletions

View file

@ -12,8 +12,8 @@ import cpw.mods.fml.client.registry.ClientRegistry;
import buildcraft.mod_BuildCraftCore;
import buildcraft.core.DefaultProps;
import buildcraft.core.ProxyCore;
import buildcraft.core.render.BlockRenderingHandler;
import buildcraft.core.render.BlockRenderingHandler.EntityRenderIndex;
import buildcraft.core.render.RenderingEntityBlocks;
import buildcraft.core.render.RenderingEntityBlocks.EntityRenderIndex;
import buildcraft.factory.BlockAutoWorkbench;
import buildcraft.factory.BlockFrame;
import buildcraft.factory.BlockHopper;
@ -157,12 +157,12 @@ public class BuildCraftFactory {
/// FIXME: Render registration needs to move into a client side proxy.
ClientRegistry.bindTileEntitySpecialRenderer(TileTank.class, new RenderTank());
ClientRegistry.bindTileEntitySpecialRenderer(TileRefinery.class, new RenderRefinery());
BlockRenderingHandler.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.refineryBlock, 0),
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.refineryBlock, 0),
new RenderRefinery());
if(!hopperDisabled) {
ClientRegistry.bindTileEntitySpecialRenderer(TileHopper.class, new RenderHopper());
BlockRenderingHandler.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.hopperBlock, 0), new RenderHopper());
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.hopperBlock, 0), new RenderHopper());
}

View file

@ -13,7 +13,7 @@ import net.minecraft.src.RenderBlocks;
import net.minecraft.src.Tessellator;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class BlockRenderingHandler implements ISimpleBlockRenderingHandler {
public class RenderingEntityBlocks implements ISimpleBlockRenderingHandler {
public static class EntityRenderIndex {
@ -43,7 +43,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler {
public static HashMap<EntityRenderIndex, IInventoryRenderer> blockByEntityRenders = new HashMap<EntityRenderIndex, IInventoryRenderer>();
public BlockRenderingHandler() {
public RenderingEntityBlocks() {
initializeMarkerMatrix();
}
@ -114,9 +114,8 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler {
legacyPipeRender(renderer, world, x, y, z, block, modelId);
} else if (block.getRenderType() == BuildCraftCore.oilModel)
renderer.renderBlockFluids(block, x, y, z);
}
return true;
}

View file

@ -0,0 +1,29 @@
package buildcraft.core.render;
import buildcraft.BuildCraftCore;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.RenderBlocks;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderingOil implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID,
RenderBlocks renderer) {}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,
Block block, int modelId, RenderBlocks renderer) {
if(block.getRenderType() != BuildCraftCore.oilModel)
return true;
renderer.renderBlockFluids(block, x, y, z);
return true;
}
@Override public boolean shouldRender3DInInventory() { return false; }
@Override public int getRenderId() { return BuildCraftCore.oilModel; }
}

View file

@ -32,11 +32,12 @@ import buildcraft.core.EntityEnergyLaser;
import buildcraft.core.EntityLaser;
import buildcraft.core.EntityRobot;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.render.BlockRenderingHandler;
import buildcraft.core.render.RenderingEntityBlocks;
import buildcraft.core.render.RenderEnergyLaser;
import buildcraft.core.render.RenderEntityBlock;
import buildcraft.core.render.RenderLaser;
import buildcraft.core.render.RenderRobot;
import buildcraft.core.render.RenderingOil;
import buildcraft.core.utils.Localization;
@Mod(name="BuildCraft", version=DefaultProps.VERSION, useMetadata = false, modid = "BC|CORE")
@ -74,7 +75,8 @@ public class mod_BuildCraftCore {
BuildCraftCore.markerModel = RenderingRegistry.getNextAvailableRenderId();
BuildCraftCore.oilModel = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler());
RenderingRegistry.registerBlockHandler(new RenderingEntityBlocks());
RenderingRegistry.registerBlockHandler(new RenderingOil());
MinecraftForgeClient.preloadTexture(DefaultProps.TEXTURE_BLOCKS);
MinecraftForgeClient.preloadTexture(DefaultProps.TEXTURE_ITEMS);

View file

@ -20,8 +20,8 @@ import cpw.mods.fml.common.registry.GameRegistry;
import buildcraft.BuildCraftEnergy;
import buildcraft.core.DefaultProps;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.render.BlockRenderingHandler;
import buildcraft.core.render.BlockRenderingHandler.EntityRenderIndex;
import buildcraft.core.render.RenderingEntityBlocks;
import buildcraft.core.render.RenderingEntityBlocks.EntityRenderIndex;
import buildcraft.energy.OilPopulate;
import buildcraft.energy.TileEngine;
import buildcraft.energy.render.RenderEngine;
@ -53,11 +53,11 @@ public class mod_BuildCraftEnergy {
BuildCraftEnergy.initialize();
BlockRenderingHandler.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 0), new RenderEngine(
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 0), new RenderEngine(
DefaultProps.TEXTURE_PATH_BLOCKS + "/base_wood.png"));
BlockRenderingHandler.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 1), new RenderEngine(
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 1), new RenderEngine(
DefaultProps.TEXTURE_PATH_BLOCKS + "/base_stone.png"));
BlockRenderingHandler.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 2), new RenderEngine(
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftEnergy.engineBlock, 2), new RenderEngine(
DefaultProps.TEXTURE_PATH_BLOCKS + "/base_iron.png"));
ModLoader.getMinecraftInstance().renderEngine.registerTextureFX(new TextureOilFX());