v5 Pre-Release #3

*Renamed RenderHandler "BlockRenderingHandler."
*Added basic item rendering functionality, thanks to @CovertJaguar's
help.
*Merged all generators into a single block ID.
*Fixed NPE when lauching game before data has been retrieved from
server.
*Renamed NuclearCore to AtomicCore.
*Renamed NuclearDisassembler to AtomicDisassembler.
This commit is contained in:
Aidan Brady 2012-11-26 19:18:50 -05:00
parent e1167f04f3
commit 8ae6207eac
11 changed files with 217 additions and 277 deletions

View file

@ -12,6 +12,6 @@ public class CreativeTabMekanism extends CreativeTabs
@Override
public ItemStack getIconItemStack()
{
return new ItemStack(Mekanism.NuclearCore);
return new ItemStack(Mekanism.AtomicCore);
}
}

View file

@ -113,8 +113,8 @@ public class Mekanism
public static Item SpeedUpgrade;
public static Item EnergyUpgrade;
public static Item UltimateUpgrade;
public static ItemAtomicDisassembler NuclearDisassembler;
public static Item NuclearCore;
public static ItemAtomicDisassembler AtomicDisassembler;
public static Item AtomicCore;
public static ItemStorageTank HydrogenTank;
public static ItemStorageTank OxygenTank;
@ -224,11 +224,11 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(UltimateUpgrade), new Object[] {
"ERA", "RDR", "ARS", Character.valueOf('E'), EnergyUpgrade, Character.valueOf('R'), Item.redstone, Character.valueOf('A'), EnrichedAlloy, Character.valueOf('D'), Item.diamond, Character.valueOf('S'), SpeedUpgrade
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(NuclearCore), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(AtomicCore), new Object[] {
"AOA", "PDP", "AOA", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('O'), "dustObsidian", Character.valueOf('P'), new ItemStack(Dust, 1, 2), Character.valueOf('D'), Item.diamond
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(NuclearDisassembler.getUnchargedItem(), new Object[] {
"AEA", "ACA", " O ", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('E'), EnergyTablet.getUnchargedItem(), Character.valueOf('C'), NuclearCore, Character.valueOf('O'), "ingotObsidian"
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(AtomicDisassembler.getUnchargedItem(), new Object[] {
"AEA", "ACA", " O ", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('E'), EnergyTablet.getUnchargedItem(), Character.valueOf('C'), AtomicCore, Character.valueOf('O'), "ingotObsidian"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(EnrichedAlloy), new Object[] {
" R ", "RIR", " R ", Character.valueOf('R'), Item.redstone, Character.valueOf('I'), Item.ingotIron
@ -316,8 +316,8 @@ public class Mekanism
LanguageRegistry.addName(SpeedUpgrade, "Speed Upgrade");
LanguageRegistry.addName(EnergyUpgrade, "Energy Upgrade");
LanguageRegistry.addName(UltimateUpgrade, "Ultimate Upgrade");
LanguageRegistry.addName(NuclearDisassembler, "Nuclear Disassembler");
LanguageRegistry.addName(NuclearCore, "Nuclear Core");
LanguageRegistry.addName(AtomicDisassembler, "Nuclear Disassembler");
LanguageRegistry.addName(AtomicCore, "Nuclear Core");
LanguageRegistry.addName(ElectricBow, "Electric Bow");
LanguageRegistry.addName(HydrogenTank, "Hydrogen Tank");
LanguageRegistry.addName(OxygenTank, "Oxygen Tank");
@ -380,8 +380,8 @@ public class Mekanism
SpeedUpgrade.setIconIndex(232);
EnergyUpgrade.setIconIndex(231);
UltimateUpgrade.setIconIndex(233);
NuclearDisassembler.setIconIndex(253);
NuclearCore.setIconIndex(254);
AtomicDisassembler.setIconIndex(253);
AtomicCore.setIconIndex(254);
ElectricBow.setIconIndex(252);
HydrogenTank.setIconIndex(251);
OxygenTank.setIconIndex(239);
@ -407,8 +407,8 @@ public class Mekanism
SpeedUpgrade = new ItemMachineUpgrade(11309, 0, 150).setItemName("SpeedUpgrade");
EnergyUpgrade = new ItemMachineUpgrade(11310, 1000, 0).setItemName("EnergyUpgrade");
UltimateUpgrade = new ItemMachineUpgrade(11311, 2500, 180).setItemName("UltimateUpgrade");
NuclearDisassembler = (ItemAtomicDisassembler) new ItemAtomicDisassembler(11312).setItemName("NuclearDisassembler");
NuclearCore = new ItemMekanism(11313).setItemName("NuclearCore");
AtomicDisassembler = (ItemAtomicDisassembler) new ItemAtomicDisassembler(11312).setItemName("AtomicDisassembler");
AtomicCore = new ItemMekanism(11313).setItemName("AtomicCore");
EnrichedAlloy = new ItemMekanism(11315).setItemName("EnrichedAlloy");
HydrogenTank = (ItemHydrogenTank) new ItemHydrogenTank(11316).setItemName("HydrogenTank");
OxygenTank = (ItemOxygenTank) new ItemOxygenTank(11317).setItemName("OxygenTank");

View file

@ -1,187 +0,0 @@
package mekanism.generators.common;
import java.util.List;
import java.util.Random;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.multiblock.IMultiBlock;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import mekanism.common.Mekanism;
import mekanism.common.TileEntityBasicBlock;
import mekanism.common.TileEntityElectricBlock;
import mekanism.common.BlockMachine.MachineType;
import mekanism.generators.client.GeneratorsClientProxy;
import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection;
public class BlockAdvancedSolarGenerator extends BlockContainer
{
public Random machineRand = new Random();
public BlockAdvancedSolarGenerator(int id)
{
super(id, Material.iron);
setHardness(3.5F);
setResistance(8F);
setCreativeTab(Mekanism.tabMekanism);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);
int side = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int change = 3;
switch(side)
{
case 0: change = 2; break;
case 1: change = 5; break;
case 2: change = 3; break;
case 3: change = 4; break;
}
tileEntity.setFacing((short)change);
if(tileEntity instanceof IMultiBlock)
{
((IMultiBlock)tileEntity).onCreate(new Vector3(x, y, z));
}
}
@Override
public void breakBlock(World world, int x, int y, int z, int i1, int i2)
{
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
for (int i = 0; i < tileEntity.getSizeInventory(); ++i)
{
ItemStack slotStack = tileEntity.getStackInSlot(i);
if (slotStack != null)
{
float xRandom = machineRand.nextFloat() * 0.8F + 0.1F;
float yRandom = machineRand.nextFloat() * 0.8F + 0.1F;
float zRandom = machineRand.nextFloat() * 0.8F + 0.1F;
while (slotStack.stackSize > 0)
{
int j = machineRand.nextInt(21) + 10;
if (j > slotStack.stackSize)
{
j = slotStack.stackSize;
}
slotStack.stackSize -= j;
EntityItem item = new EntityItem(world, (double)((float)x + xRandom), (double)((float)y + yRandom), (double)((float)z + zRandom), new ItemStack(slotStack.itemID, j, slotStack.getItemDamage()));
if (slotStack.hasTagCompound())
{
item.item.setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
}
float k = 0.05F;
item.motionX = (double)((float)machineRand.nextGaussian() * k);
item.motionY = (double)((float)machineRand.nextGaussian() * k + 0.2F);
item.motionZ = (double)((float)machineRand.nextGaussian() * k);
world.spawnEntityInWorld(item);
}
}
}
if(tileEntity instanceof IMultiBlock)
{
((IMultiBlock)tileEntity).onDestroy(tileEntity);
}
tileEntity.invalidate();
}
super.breakBlock(world, x, y, z, i1, i2);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int facing, float playerX, float playerY, float playerZ)
{
if(world.isRemote)
{
return true;
}
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
if(!entityplayer.isSneaking())
{
entityplayer.openGui(MekanismGenerators.instance, 1, world, x, y, z);
return true;
}
}
return false;
}
@Override
public String getTextureFile()
{
return "/resources/mekanism/textures/terrain.png";
}
@Override
public TileEntity createNewTileEntity(World world, int metadata)
{
return new TileEntityAdvancedSolarGenerator();
}
/*This method is not used, metadata manipulation is required to create a Tile Entity.*/
@Override
public TileEntity createNewTileEntity(World world)
{
return null;
}
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z)
{
boolean canPlace = super.canPlaceBlockAt(world, x, y, z);
int idSum = 0;
idSum += world.getBlockId(x, y, z);
World worldObj = world;
for(int xPos=-1;xPos<=2;xPos++)
{
for(int zPos=-1;zPos<=2;zPos++)
{
idSum += worldObj.getBlockId(x+xPos, y+2, z+zPos);
}
}
return (idSum == 0) && canPlace;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderType()
{
return GeneratorsClientProxy.RENDER_ID;
}
}

View file

@ -3,12 +3,16 @@ package mekanism.generators.common;
import java.util.List;
import java.util.Random;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.multiblock.IMultiBlock;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import mekanism.common.Mekanism;
import mekanism.common.TileEntityBasicBlock;
import mekanism.common.TileEntityElectricBlock;
import mekanism.common.BlockMachine.MachineType;
import mekanism.generators.client.GeneratorsClientProxy;
import net.minecraft.src.*;
import net.minecraftforge.common.ForgeDirection;
@ -18,6 +22,8 @@ import net.minecraftforge.common.ForgeDirection;
* 1: Solar Generator
* 2: Electrolytic Separator
* 3: Hydrogen Generator
* 4: Bio-Generator
* 5: Advanced Solar Generator
* @author AidanBrady
*
*/
@ -90,6 +96,11 @@ public class BlockGenerator extends BlockContainer
}
tileEntity.setFacing((short)change);
if(tileEntity instanceof IMultiBlock)
{
((IMultiBlock)tileEntity).onCreate(new Vector3(x, y, z));
}
}
@Override
@ -225,6 +236,31 @@ public class BlockGenerator extends BlockContainer
list.add(new ItemStack(i, 1, 3));
}
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z)
{
if(world.getBlockMetadata(x, y, z) == GeneratorType.ADVANCED_SOLAR_GENERATOR.meta)
{
boolean canPlace = super.canPlaceBlockAt(world, x, y, z);
int idSum = 0;
idSum += world.getBlockId(x, y, z);
World worldObj = world;
for(int xPos=-1;xPos<=2;xPos++)
{
for(int zPos=-1;zPos<=2;zPos++)
{
idSum += worldObj.getBlockId(x+xPos, y+2, z+zPos);
}
}
return (idSum == 0) && canPlace;
}
return super.canPlaceBlockAt(world, x, y, z);
}
@Override
public void breakBlock(World world, int x, int y, int z, int i1, int i2)
{
@ -268,6 +304,11 @@ public class BlockGenerator extends BlockContainer
}
}
if(tileEntity instanceof IMultiBlock)
{
((IMultiBlock)tileEntity).onDestroy(tileEntity);
}
tileEntity.invalidate();
}
@ -330,11 +371,38 @@ public class BlockGenerator extends BlockContainer
{
return new TileEntityHydrogenGenerator();
}
else if(metadata == GeneratorType.BIO_GENERATOR.meta)
{
return new TileEntityBioGenerator();
}
else if(metadata == GeneratorType.ADVANCED_SOLAR_GENERATOR.meta)
{
return new TileEntityAdvancedSolarGenerator();
}
else {
return null;
}
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderType()
{
return GeneratorsClientProxy.RENDER_ID;
}
/*This method is not used, metadata manipulation is required to create a Tile Entity.*/
@Override
public TileEntity createNewTileEntity(World world)
@ -347,7 +415,9 @@ public class BlockGenerator extends BlockContainer
HEAT_GENERATOR(0, 0),
SOLAR_GENERATOR(1, 1),
ELECTROLYTIC_SEPARATOR(2, 2),
HYDROGEN_GENERATOR(3, 3);
HYDROGEN_GENERATOR(3, 3),
BIO_GENERATOR(4, 4),
ADVANCED_SOLAR_GENERATOR(5, 1);
private int meta;
private int guiId;

View file

@ -40,8 +40,6 @@ public class GeneratorsCommonProxy
{
Mekanism.configuration.load();
MekanismGenerators.generatorID = Mekanism.configuration.getBlock("Generator", 3005).getInt();
MekanismGenerators.advancedSolarGeneratorID = Mekanism.configuration.getBlock("AdvancedSolarGenerator", 3006).getInt();
MekanismGenerators.bioGeneratorID = Mekanism.configuration.getBlock("BioGenerator", 3008).getInt();
Mekanism.configuration.save();
}

View file

@ -8,6 +8,7 @@ import net.minecraft.src.*;
* 1: Solar Generator
* 2: Electrolytic Separator
* 3: Hydrogen Generator
* 4: Bio-Generator
* @author AidanBrady
*
*/
@ -52,6 +53,12 @@ public class ItemBlockGenerator extends ItemBlock
case 3:
name = "HydrogenGenerator";
break;
case 4:
name = "BioGenerator";
break;
case 5:
name = "AdvancedSolarGenerator";
break;
default:
name = "Unknown";
break;

View file

@ -42,14 +42,10 @@ public class MekanismGenerators
public static Item SolarPanel;
//Blocks
public static Block BioGenerator;
public static Block Generator;
public static Block AdvancedSolarGenerator;
//Block IDs
public static int generatorID = 3005;
public static int advancedSolarGeneratorID = 3006;
public static int bioGeneratorID = 3008;
@Init
public void init(FMLInitializationEvent event)
@ -81,10 +77,10 @@ public class MekanismGenerators
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 1), new Object[] {
"SSS", "AIA", "PEP", Character.valueOf('S'), SolarPanel, Character.valueOf('A'), Mekanism.EnrichedAlloy, Character.valueOf('I'), Block.blockSteel, Character.valueOf('P'), "dustPlatinum", Character.valueOf('E'), Mekanism.EnergyTablet.getUnchargedItem()
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(AdvancedSolarGenerator), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 5), new Object[] {
"SES", "SES", "III", Character.valueOf('S'), new ItemStack(Generator, 1, 1), Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('I'), Item.ingotIron
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BioGenerator), new Object[] {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 4), new Object[] {
"RER", "BIB", "NEN", Character.valueOf('R'), Item.redstone, Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('B'), BioFuel, Character.valueOf('I'), new ItemStack(Mekanism.BasicBlock, 1, 5), Character.valueOf('N'), Item.ingotIron
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(Generator, 1, 2), new Object[] {
@ -119,10 +115,8 @@ public class MekanismGenerators
public void addNames()
{
LanguageRegistry.addName(BioGenerator, "Bio-Generator");
LanguageRegistry.addName(BioFuel, "Bio Fuel");
LanguageRegistry.addName(ElectrolyticCore, "Electrolytic Core");
LanguageRegistry.addName(AdvancedSolarGenerator, "Advanced Solar Generator");
LanguageRegistry.addName(SolarPanel, "Solar Panel");
//Localization for Generator
@ -130,6 +124,8 @@ public class MekanismGenerators
LanguageRegistry.instance().addStringLocalization("tile.Generator.SolarGenerator.name", "Solar Generator");
LanguageRegistry.instance().addStringLocalization("tile.Generator.ElectrolyticSeparator.name", "Electrolytic Separator");
LanguageRegistry.instance().addStringLocalization("tile.Generator.HydrogenGenerator.name", "Hydrogen Generator");
LanguageRegistry.instance().addStringLocalization("tile.Generator.BioGenerator.name", "Bio-Generator");
LanguageRegistry.instance().addStringLocalization("tile.Generator.AdvancedSolarGenerator.name", "Advanced Solar Generator");
}
public void addTextures()
@ -150,12 +146,6 @@ public class MekanismGenerators
public void addBlocks()
{
Generator = new BlockGenerator(generatorID).setBlockName("Generator");
AdvancedSolarGenerator = new BlockAdvancedSolarGenerator(advancedSolarGeneratorID).setBlockName("AdvancedSolarGenerator");
BioGenerator = new BlockBioGenerator(bioGeneratorID).setBlockName("BioGenerator");
//Registrations
GameRegistry.registerBlock(AdvancedSolarGenerator);
GameRegistry.registerBlock(BioGenerator);
Item.itemsList[generatorID] = new ItemBlockGenerator(generatorID - 256, Generator).setItemName("Generator");
}

View file

@ -17,10 +17,12 @@ import cpw.mods.fml.common.TickType;
*/
public class ClientTickHandler implements ITickHandler
{
public boolean hasNotified;
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
if(Mekanism.ticksPassed == 0 && ModLoader.getMinecraftInstance().theWorld != null && ModLoader.getMinecraftInstance().thePlayer != null)
if(Mekanism.ticksPassed > 0 && ModLoader.getMinecraftInstance().theWorld != null && ModLoader.getMinecraftInstance().thePlayer != null && Mekanism.latestVersionNumber != null && Mekanism.recentNews != null)
{
MekanismUtils.checkForUpdates(ModLoader.getMinecraftInstance().thePlayer);
Mekanism.ticksPassed++;

View file

@ -0,0 +1,119 @@
package mekanism.generators.client;
import org.lwjgl.opengl.GL11;
import mekanism.common.Mekanism;
import mekanism.generators.common.MekanismGenerators;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.ItemStack;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.Tessellator;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
{
public ModelAdvancedSolarGenerator solarGenerator = new ModelAdvancedSolarGenerator();
public ModelBioGenerator bioGenerator = new ModelBioGenerator();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
if(block.blockID == MekanismGenerators.generatorID)
{
switch(metadata)
{
case 4:
GL11.glTranslated(0.0F, -1.1F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/BioGenerator.png"));
bioGenerator.render(0.0625F);
break;
case 5:
GL11.glTranslatef(0.0F, 0.3F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/AdvancedSolarGenerator.png"));
solarGenerator.render(0.0F, 0.024F);
break;
default:
ForgeHooksClient.bindTexture(block.getTextureFile(), 0);
renderItem(renderer, metadata, block);
break;
}
}
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if(block.blockID == MekanismGenerators.generatorID)
{
renderer.renderStandardBlock(block, x, y, z);
renderer.func_83018_a(block);
return true;
}
return false;
}
@Override
public boolean shouldRender3DInInventory()
{
return true;
}
@Override
public int getRenderId()
{
return GeneratorsClientProxy.RENDER_ID;
}
public void renderItem(RenderBlocks renderer, int metadata, Block block)
{
block.setBlockBoundsForItemRender();
if (renderer.useInventoryTint)
{
int renderColor = block.getRenderColor(metadata);
float red = (float)(renderColor >> 16 & 255) / 255.0F;
float green = (float)(renderColor >> 8 & 255) / 255.0F;
float blue = (float)(renderColor & 255) / 255.0F;
GL11.glColor4f(red, green, blue, 1.0F);
}
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1.0F, 0.0F);
renderer.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, metadata));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderer.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, metadata));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1.0F);
renderer.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, metadata));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderer.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, metadata));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
renderer.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, metadata));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderer.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, metadata));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
}

View file

@ -49,7 +49,7 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy
}
//Register block handler
RenderingRegistry.registerBlockHandler(new RenderHandler());
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler());
System.out.println("[MekanismGenerators] Render initiative complete.");
}

View file

@ -1,59 +0,0 @@
package mekanism.generators.client;
import org.lwjgl.opengl.GL11;
import mekanism.common.Mekanism;
import mekanism.generators.common.MekanismGenerators;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.RenderBlocks;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderHandler implements ISimpleBlockRenderingHandler
{
public ModelAdvancedSolarGenerator solarGenerator = new ModelAdvancedSolarGenerator();
public ModelBioGenerator bioGenerator = new ModelBioGenerator();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
if(block.blockID == MekanismGenerators.advancedSolarGeneratorID)
{
GL11.glTranslatef(0.0F, 0.3F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/AdvancedSolarGenerator.png"));
solarGenerator.render(0.0F, 0.024F);
}
else if(block.blockID == MekanismGenerators.bioGeneratorID)
{
GL11.glTranslated(0.0F, -1.1F, 0.0F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/resources/mekanism/render/BioGenerator.png"));
bioGenerator.render(0.0625F);
}
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
return false;
}
@Override
public boolean shouldRender3DInInventory()
{
return true;
}
@Override
public int getRenderId()
{
return GeneratorsClientProxy.RENDER_ID;
}
}