use of net.minecraft.client.renderer.block.model.IBakedModel in project minecolonies by Minecolonies.
the class RenderUtils method renderSigns.
/**
* Render informal signs at the citizen.
*
* @param clientWorld the client world.
* @param partialTicks the partial ticks.
* @param citizenDataView the citizen data.
* @param player the player.
* @param citizen the citizen position
*/
public static void renderSigns(final WorldClient clientWorld, final float partialTicks, final CitizenDataView citizenDataView, final EntityPlayer player, final BlockPos citizen) {
final Block block = ModBlocks.blockInfoPoster;
final BlockPos vector = citizen.subtract(player.getPosition());
final EnumFacing facing = EnumFacing.getFacingFromVector(vector.getX(), 0, vector.getZ()).getOpposite();
final BlockPos pos = citizen.up(2).offset(facing);
final IBlockState iblockstate = block.getDefaultState().withProperty(BlockInfoPoster.FACING, facing);
final IBlockState iBlockExtendedState = block.getExtendedState(iblockstate, clientWorld, pos);
final IBakedModel ibakedmodel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(iblockstate);
final TileEntityInfoPoster sign = new TileEntityInfoPoster();
sign.setPos(pos);
for (int i = 0; i < sign.signText.length; i++) {
if (i < citizenDataView.getLatestStatus().length) {
sign.signText[i] = citizenDataView.getLatestStatus()[i];
}
}
final ModelHolder models = new ModelHolder(pos, iblockstate, iBlockExtendedState, sign, ibakedmodel);
Structure.getQuads(models, models.quads);
new Structure(Minecraft.getMinecraft().world).renderGhost(clientWorld, models, player, partialTicks, false);
}
use of net.minecraft.client.renderer.block.model.IBakedModel in project YABBA by LatvianModder.
the class RenderItemBarrel method renderIcon.
@Override
public void renderIcon(TileItemBarrel barrel) {
IBakedModel bakedmodel = ClientUtils.MC.getRenderItem().getItemModelWithOverrides(barrel.getStoredItemType(), barrel.getWorld(), ClientUtils.MC.player);
GlStateManager.scale(0.4F, -0.4F, -0.02F);
bakedmodel = ForgeHooksClient.handleCameraTransforms(bakedmodel, ItemCameraTransforms.TransformType.GUI, false);
ClientUtils.MC.getRenderItem().renderItem(barrel.getStoredItemType(), bakedmodel);
}
use of net.minecraft.client.renderer.block.model.IBakedModel in project Solar by ArekkuusuJerii.
the class PhenomenaRenderer method renderTileEntityFast.
@Override
public void renderTileEntityFast(@Nonnull TilePhenomena phenomena, double x, double y, double z, float partialTick, int breakStage, float partial, @Nullable BufferBuilder renderer) {
if (blockRenderer == null)
blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockPos pos = phenomena.getPos();
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(phenomena.getWorld(), pos);
IBlockState state = getState(phenomena, world, pos);
if (state instanceof IExtendedBlockState) {
IExtendedBlockState extendedState = (IExtendedBlockState) state;
if (extendedState.getUnlistedNames().contains(Properties.AnimationProperty)) {
// Using tile timer instead of world time.
float time = ((20 - phenomena.timer)) / 20F;
IAnimationStateMachine capability = phenomena.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null);
if (capability != null) {
Pair<IModelState, Iterable<Event>> pair = capability.apply(time);
extendedState = extendedState.withProperty(Properties.AnimationProperty, pair.getLeft());
IBakedModel model = getModel(state);
assert renderer != null;
renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());
blockRenderer.getBlockModelRenderer().renderModel(world, model, extendedState, pos, renderer, false);
}
}
}
}
use of net.minecraft.client.renderer.block.model.IBakedModel in project RFTools by McJty.
the class ElevatorTESR method renderBlock.
private static boolean renderBlock(BlockRendererDispatcher dispatcher, IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder worldRendererIn) {
try {
EnumBlockRenderType enumblockrendertype = state.getRenderType();
if (enumblockrendertype == EnumBlockRenderType.INVISIBLE) {
return false;
} else {
if (blockAccess.getWorldType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
try {
state = state.getActualState(blockAccess, pos);
} catch (Exception var8) {
}
}
switch(enumblockrendertype) {
case MODEL:
IBakedModel model = dispatcher.getModelForState(state);
state = state.getBlock().getExtendedState(state, blockAccess, pos);
return dispatcher.getBlockModelRenderer().renderModel(blockAccess, model, state, pos, worldRendererIn, false);
case ENTITYBLOCK_ANIMATED:
return false;
default:
return false;
}
}
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated");
CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state));
throw new ReportedException(crashreport);
}
}
use of net.minecraft.client.renderer.block.model.IBakedModel in project Binnie by ForestryMC.
the class AABBModelBaker method bakeModel.
@Override
public IModelBakerModel bakeModel(boolean flip) {
ModelRotation mr = ModelRotation.X0_Y0;
if (flip) {
mr = ModelRotation.X0_Y180;
}
// Add baked models to the current model.
for (Pair<IBlockState, IBakedModel> bakedModel : bakedModels) {
currentModel.addModelQuads(bakedModel);
}
for (Pair<IBlockState, IBakedModel> bakedModel : bakedModelsPost) {
currentModel.addModelQuadsPost(bakedModel);
}
for (BoundModelBakerFace face : faces) {
final AxisAlignedBB modelBounds = face.modelBounds;
final Vector3f from = new Vector3f((float) modelBounds.minX * 16.0f, (float) modelBounds.minY * 16.0f, (float) modelBounds.minZ * 16.0f);
final Vector3f to = new Vector3f((float) modelBounds.maxX * 16.0f, (float) modelBounds.maxY * 16.0f, (float) modelBounds.maxZ * 16.0f);
final EnumFacing myFace = face.face;
final float[] uvs = getFaceUvs(myFace, to, from);
final BlockFaceUV uv = new BlockFaceUV(uvs, 0);
final BlockPartFace bpf = new BlockPartFace(myFace, face.colorIndex, "", uv);
BakedQuad bf = faceBakery.makeBakedQuad(from, to, bpf, face.spite, myFace, mr, null, true, true);
currentModel.addQuad(myFace, bf);
}
return currentModel;
}
Aggregations