Just pushing my work so far

This commit is contained in:
Cricket committed 2014-12-23 20:16:31 -05:00
1 parent 8620d975ee
commit 3eb7d90c89
8 files changed
+117 -161

No files matched your search

@@ -1,21 +1,22 @@
package com.cricketcraft.chisel.client.render.item;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.block.BlockPresent;
import net.minecraft.block.Block;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.model.ModelChest;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.cricketcraft.chisel.Chisel;
import cpw.mods.fml.client.FMLClientHandler;
public class ItemPresentRenderer implements IItemRenderer {
private final ModelChest model = new ModelChest();
private final BlockPresent present = new BlockPresent();
BlockPresent present;
private int meta;
public ItemPresentRenderer(int type){
present = new BlockPresent(type);
this.meta = type;
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type != ItemRenderType.FIRST_PERSON_MAP;
@@ -28,7 +29,7 @@ public class ItemPresentRenderer implements IItemRenderer {
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
FMLClientHandler.instance().getClient().renderEngine.bindTexture(present.getResourceSingle(item.getItemDamage()));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Chisel.MOD_ID, present.getKindOfChest(meta) + ".png"));
switch (type) {
case ENTITY:
renderBlock(0.0F, 0.0F, 0.0F);
@@ -1,29 +1,21 @@
package com.cricketcraft.chisel.client.render.tile;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.block.BlockPresent;
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.block.Block;
import net.minecraft.block.BlockChest;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.model.ModelLargeChest;
import net.minecraft.client.renderer.tileentity.TileEntityChestRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.cricketcraft.chisel.block.BlockPresent;
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
import cpw.mods.fml.common.FMLLog;
public class RenderPresent extends TileEntityChestRenderer {
private ModelChest chest = new ModelChest();
private ModelChest doubleChest = new ModelLargeChest();
//TODO: this will be changed so it actually checks after I have crate textures :)
//private boolean isChristmas = true;
public RenderPresent() {
}
public void renderTileEntityAt(TileEntityPresent present, double x, double y, double z, float partialTicks) {
@@ -49,15 +41,7 @@ public class RenderPresent extends TileEntityChestRenderer {
if (present.adjacentChestZNeg == null && present.adjacentChestXNeg == null) {
BlockPresent blockPresent = (BlockPresent) present.getWorldObj().getBlock(present.xCoord, present.yCoord, present.zCoord);
ModelChest modelchest;
if (present.adjacentChestXPos == null && present.adjacentChestZPos == null) {
modelchest = this.chest;
this.bindTexture(blockPresent.getResourceSingle(present.getBlockMetadata()));
} else {
modelchest = this.doubleChest;
this.bindTexture(blockPresent.getResourceDouble(present.getBlockMetadata()));
}
this.bindTexture(new ResourceLocation(Chisel.MOD_ID, blockPresent.getKindOfChest(present.type) + ".png"));
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
@@ -114,8 +98,8 @@ public class RenderPresent extends TileEntityChestRenderer {
f1 = 1.0F - f1;
f1 = 1.0F - f1 * f1 * f1;
modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
modelchest.renderAll();
this.chest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
this.chest.renderAll();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);