ForgeHammer update rewrite fk refactoriung

This commit is contained in:
KitsuShadow
2015-07-03 23:24:28 -04:00
parent 2a7d676773
commit 2653079404
75 changed files with 464 additions and 827 deletions

View File

@@ -22,7 +22,6 @@ import cpw.mods.fml.client.FMLClientHandler;
public class ForgeAnvilRenderer extends TileEntitySpecialRenderer {
ItemStack stack;
EntityItem entItem = null;
private static final ResourceLocation MODEL_CRUCIBLE = new ResourceLocation("kitsumedievalcraft:models/ForgeAnvil.obj");
@@ -32,20 +31,10 @@ public class ForgeAnvilRenderer extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
TileEntityAnvilForge tileEntity = (TileEntityAnvilForge)tile;
if(tileEntity.getStackInSlot(0)!=null){
stack = tileEntity.getStackInSlot(0);
}
if(tileEntity.getStackInSlot(0)==null){
stack = null;
}
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.forgeAnvil);
if(stack != null){
entItem = new EntityItem(tileEntity.getWorldObj(), x, y, z, stack);
if(tileEntity.getStackInSlot(0)!=null){
entItem = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(0));
GL11.glPushMatrix();
this.entItem.hoverStart = 0.0F;
RenderItem.renderInFrame = true;
@@ -54,11 +43,11 @@ public class ForgeAnvilRenderer extends TileEntitySpecialRenderer {
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
}
renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.forgeAnvil);
GL11.glPopMatrix();
}
@SuppressWarnings({ "cast"})
public void renderBlock(TileEntityAnvilForge tl, World world, int i, int j,int k, Block block) {
Tessellator tessellator = Tessellator.instance;
// This will make your block brightness dependent from surroundings

View File

@@ -30,6 +30,9 @@ public class ForgeRenderer extends TileEntitySpecialRenderer {
EntityItem entItem1 = null;
public static final ResourceLocation MODEL = new ResourceLocation("kitsumedievalcraft:models/SingleForge.obj");
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/SingleForge.png");
public static final ResourceLocation TEXTURE1 = new ResourceLocation("kitsumedievalcraft:models/SingleForgeBurning.png");
public static final ResourceLocation TEXTURE2 = new ResourceLocation("kitsumedievalcraft:models/SingleForgeOn.png");
private ResourceLocation loc;
IModelCustom model = AdvancedModelLoader.loadModel(MODEL);
@@ -37,10 +40,9 @@ public class ForgeRenderer extends TileEntitySpecialRenderer {
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
TileForge tileEntity = (TileForge)tile;
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.forge);
if(tileEntity.getStackInSlot(1) != null){
entItem1 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(1));
@@ -80,11 +82,20 @@ public class ForgeRenderer extends TileEntitySpecialRenderer {
tileEntity.markForUpdate();
tileEntity.markDirty();
}
/*if(tileEntity.isOn==false && tileEntity.isBurning==false){
loc = TEXTURE;
}
if(tileEntity.isOn==false && tileEntity.isBurning==true){
loc = TEXTURE1;
}*/
if(loc == null){
loc = TEXTURE;
}
//tileEntity.markForUpdate();
//tileEntity.markDirty();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(loc);
renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.forge);
GL11.glPopMatrix();
}
@@ -107,7 +118,7 @@ public class ForgeRenderer extends TileEntitySpecialRenderer {
if(dir == 3){
GL11.glRotated(-90F, 0.0, 1.0F, 0.0F);
}
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
this.model.renderAll();
GL11.glPopMatrix();

View File

@@ -1,78 +0,0 @@
/*
package com.kitsu.medievalcraft.renderer.blocks.machine;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.tileents.machine.ModelSandFilter;
import com.kitsu.medievalcraft.tileents.machine.TileEntitySandFilterEmpty;
import cpw.mods.fml.client.FMLClientHandler;
public class SandFilterEmptyRenderer extends TileEntitySpecialRenderer {
private ModelSandFilter model;
public static boolean render;
public SandFilterEmptyRenderer () {
model = new ModelSandFilter();
}
@Override
public void renderTileEntityAt(TileEntity tileEnt, double x, double y, double z, float scale) {
World world = tileEnt.getWorldObj();
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
TileEntitySandFilterEmpty tileEntityBlock = (TileEntitySandFilterEmpty) world.getTileEntity((int) x, (int) y, (int) z);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelSandFilter.TEXTUREEMPTY);
//FMLClientHandler.instance().getClient().renderEngine.bindTexture(SandFilterTexture.filterText.get(renderInt));
renderBlock(tileEntityBlock, tileEnt.getWorldObj(), tileEnt.xCoord, tileEnt.yCoord, tileEnt.zCoord, ModBlocks.sandFilterEmpty);
GL11.glPopMatrix();
}
@SuppressWarnings({"cast"})
public void renderBlock(TileEntitySandFilterEmpty tileSand, World world, int x, int y,int z, Block block) {
tileSand = (TileEntitySandFilterEmpty) world.getTileEntity(x, y, z);
Tessellator tessellator = Tessellator.instance;
float f = block.getLightOpacity(world, x, y, z);
int l = world.getLightBrightnessForSkyBlocks(x, y, z, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setColorOpaque_F(f, f, f);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,(float) l1, (float) l2);
GL11.glPushMatrix();
float scale = 0.8F;
GL11.glScalef(scale, scale-0.05F, scale);
GL11.glTranslatef(0.62F,0.58F,0.62F);
//ResourceLocation TEXTUREGET = new ResourceLocation(tileSand.getTexture(world, x, y, z));
//ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/SandFilter.png");
//ResourceLocation TEXTUREEMPTY = new ResourceLocation("kitsumedievalcraft:models/SandFilterEmpty.png");
//if (render == false){
//FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTUREGET);
//}
//if (render == true){
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelSandFilter.TEXTUREEMPTY);
//}
//FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelSandFilter.TEXTURE);
//FMLClientHandler.instance().getClient().renderEngine.bindTexture(tileSand.getTexture(world, x, y, z));
this.model.render();
GL11.glPopMatrix();
}
}
*/