use of net.minecraft.client.resources.model.IBakedModel in project Galacticraft by micdoodle8.
the class SpawnerRenderer method renderItem.
public void renderItem(ItemStack stack) {
int meta = stack.getItemDamage();
if (meta == 0) {
meta = ItemMobSpawner.idPig;
}
String bossName = BossStatus.bossName;
int bossTimeout = BossStatus.statusBarTime;
Minecraft mc = Minecraft.getMinecraft();
World world = mc.theWorld;
IBakedModel baseModel = mc.getRenderItem().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation("mob_spawner"));
GlStateManager.pushMatrix();
GlStateManager.translate(.5, .5, .5);
GlStateManager.scale(2, 2, 2);
mc.getRenderItem().renderItem(stack, baseModel);
GlStateManager.popMatrix();
try {
Entity entity = ItemMobSpawner.getEntity(meta);
entity.setWorld(world);
float scale = 0.6F / Math.max(entity.height, entity.width);
GlStateManager.pushMatrix();
GlStateManager.translate(0.5, 0.4, 0.5);
GlStateManager.rotate((float) (ClientUtils.getRenderTime() * 10), 0, 1, 0);
GlStateManager.rotate(-20, 1, 0, 0);
GlStateManager.translate(0, -0.4, 0);
GlStateManager.scale(scale, scale, scale);
entity.setLocationAndAngles(0, 0, 0, 0, 0);
mc.getRenderManager().renderEntityWithPosYaw(entity, 0, 0, 0, 0, 0);
GlStateManager.disableLighting();
GlStateManager.popMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
} catch (Exception e) {
if (Tessellator.getInstance().getWorldRenderer().isDrawing) {
Tessellator.getInstance().draw();
}
}
BossStatus.bossName = bossName;
BossStatus.statusBarTime = bossTimeout;
}
use of net.minecraft.client.resources.model.IBakedModel in project BuildCraft by BuildCraft.
the class FakeWorldManager method renderBlock.
private void renderBlock(BlockPos pos, EnumWorldBlockLayer layer, WorldRenderer renderer) {
IBlockState actualState = world.getBlockState(pos);
Block block = actualState.getBlock();
if (block == Blocks.air || block == null) {
return;
}
if (!block.canRenderInLayer(layer)) {
return;
}
actualState = block.getActualState(actualState, world, pos);
BlockRendererDispatcher dispatcher = mc.getBlockRendererDispatcher();
IBakedModel model = dispatcher.getBlockModelShapes().getModelForState(actualState);
if (model == null || model.getParticleTexture() == null || model.getGeneralQuads() == null) {
return;
}
boolean checkSides = pos.getY() > 0;
try {
dispatcher.getBlockModelRenderer().renderModelStandard(world, model, block, pos, renderer, checkSides);
} catch (Throwable t) {
BCLog.logger.warn("The model from the block " + block + " was invalid for layer " + layer, t);
}
}
use of net.minecraft.client.resources.model.IBakedModel in project BuildCraft by BuildCraft.
the class RobotItemModel method handle.
public static RobotItemModel handle(ItemStack stack) {
if (stack != null) {
RedstoneBoardRobotNBT board = ItemRobot.getRobotNBT(stack);
IBakedModel model = board != null ? RoboticsProxyClient.robotModel.get(board.getID()) : null;
if (model == null) {
model = RoboticsProxyClient.defaultRobotModel;
}
if (model != null) {
return new RobotItemModel(ImmutableList.copyOf(model.getGeneralQuads()), model.getParticleTexture(), DefaultVertexFormats.ITEM);
}
}
return new RobotItemModel(ImmutableList.<BakedQuad>of(), null, DefaultVertexFormats.ITEM);
}
Aggregations