本文整理汇总了Java中net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeHooksClient.handleCameraTransforms方法的具体用法?Java ForgeHooksClient.handleCameraTransforms怎么用?Java ForgeHooksClient.handleCameraTransforms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.client.ForgeHooksClient
的用法示例。
在下文中一共展示了ForgeHooksClient.handleCameraTransforms方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderItemInWorld
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public static void renderItemInWorld(ItemStack stack){
if(!stack.isEmpty()){
Minecraft mc = Minecraft.getMinecraft();
RenderItem renderer = mc.getRenderItem();
TextureManager manager = mc.getTextureManager();
IBakedModel model = renderer.getItemModelWithOverrides(stack, null, null);
manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.pushMatrix();
model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.FIXED, false);
renderer.renderItem(stack, model);
GlStateManager.cullFace(GlStateManager.CullFace.BACK);
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
}
示例2: handlePerspective
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
switch (cameraTransformType) {
case FIRST_PERSON:
GlStateManager.scale(2.0F, 2.0F, 2.0F);
ForgeHooksClient.handleCameraTransforms(parent, cameraTransformType);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, -0.35F);
break;
case THIRD_PERSON:
GlStateManager.scale(2.0F, 2.0F, 2.0F);
ForgeHooksClient.handleCameraTransforms(parent, cameraTransformType);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(-0.15F, 0.25F, -0.25F);
break;
default:
ForgeHooksClient.handleCameraTransforms(parent, cameraTransformType);
break;
}
return Pair.of(this, null);
}
示例3: render
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
@Override
public void render(TileEntityXPBlock te, double x, double y, double z, float partialTicks, int destroyStage, float alpha)
{
if(GlobalXP.config.renderNameplate)
{
ITextComponent levelsText = new TextComponentString((int)te.getStoredLevels() + " (" + te.getStoredXP() + ")");
if(te != null && te.getPos() != null && rendererDispatcher.cameraHitResult != null && rendererDispatcher.cameraHitResult.getBlockPos() != null && rendererDispatcher.cameraHitResult.getBlockPos().equals(te.getPos()))
{
setLightmapDisabled(true);
drawNameplate(te, levelsText.getFormattedText(), x, y, z, 12);
setLightmapDisabled(false);
}
}
double offset = Math.sin((te.getWorld().getTotalWorldTime() + partialTicks) * GlobalXP.config.bobSpeed / 8.0D) / 10.0D;
IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(emerald, te.getWorld(), null);
GlStateManager.enableRescaleNormal();
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
GlStateManager.enableBlend();
RenderHelper.enableStandardItemLighting();
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.pushMatrix();
GlStateManager.translate(x + 0.5D, y + 0.4D + offset, z + 0.5D);
GlStateManager.rotate((te.getWorld().getTotalWorldTime() + partialTicks) * 4.0F * (float)GlobalXP.config.spinSpeed, 0.0F, 1.0F, 0.0F);
model = ForgeHooksClient.handleCameraTransforms(model, TransformType.GROUND, false);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Minecraft.getMinecraft().getRenderItem().renderItem(emerald, model);
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
}
示例4: renderItem
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
public void renderItem(double x, double y, double z, TileMeltery meltery) {
// calculate x/z parameters
double x1 = meltery.getPos().getX();
double y1 = meltery.getPos().getY();
double z1 = meltery.getPos().getZ();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
RenderUtil.pre(x, y, z);
GlStateManager.translate(0.5,1/16d,0.5);
GlStateManager.disableCull();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
RenderHelper.enableStandardItemLighting();
int brightness = meltery.getWorld().getCombinedLight(meltery.getPos(), 0);
ItemStack stack = meltery.inventory.getStackInSlot(0);
boolean isItem = !(stack.getItem() instanceof ItemBlock);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) (brightness % 0x10000) / 1f,
(float) (brightness / 0x10000) / 1f);
if (isItem) {
GlStateManager.rotate(-90, 1, 0, 0);
} else {
GlStateManager.scale(0.5,0.5,0.5);
}
IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, meltery.getWorld(), null);
model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.NONE, false);
Minecraft.getMinecraft().getRenderItem().renderItem(stack, model);
if (isItem) {
GlStateManager.rotate(90, 1, 0, 0);
}
RenderHelper.enableStandardItemLighting();
GlStateManager.enableCull();
RenderUtil.post();
}
示例5: handlePerspective
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
ForgeHooksClient.handleCameraTransforms(baseModel, cameraTransformType);
if (cameraTransformType == ItemCameraTransforms.TransformType.GUI) {
return Pair.of(new ModelItemBombBagGui(baseModel, bombsHeld), null);
}
return Pair.of(this, null);
}
示例6: renderItemLabel
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
private void renderItemLabel(@Nonnull ItemStack itemLabel, double globalScale) {
if (!itemLabel.isEmpty()) {
RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
GlStateManager.pushMatrix();
GlStateManager.translate(0.5f, 0.75f, 0.5f);
// TODO: This doesn't work that well with 3D items, find a rotation that does
GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate((renderManager.options.thirdPersonView == 2 ? -1 : 1) * renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(globalScale, globalScale, globalScale);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
IBakedModel bakedmodel = itemRenderer.getItemModelWithOverrides(itemLabel, (World) null, (EntityLivingBase) null);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_CONSTANT_COLOR, GlStateManager.SourceFactor.ONE.factor,
GlStateManager.DestFactor.ZERO.factor);
GL14.glBlendColor(itemBlend.x, itemBlend.y, itemBlend.z, itemBlend.w);
bakedmodel = ForgeHooksClient.handleCameraTransforms(bakedmodel, ItemCameraTransforms.TransformType.GUI, false);
itemRenderer.renderItem(itemLabel, NullHelper.notnullF(bakedmodel, "handleCameraTransforms returned null!"));
RenderHelper.disableStandardItemLighting();
GL14.glBlendColor(1, 1, 1, 1);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.popMatrix();
}
}
示例7: handleTransforms
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
private IBakedModel handleTransforms(ItemStack stack, IBakedModel model, TransformType transformType, boolean isLeftHand) {
lastKnownTransformType = transformType;
return ForgeHooksClient.handleCameraTransforms(model, transformType, isLeftHand);
}
示例8: handlePerspective
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
// Render as 2D sprite when in GUI
if (cameraTransformType == ItemCameraTransforms.TransformType.GUI) {
ForgeHooksClient.handleCameraTransforms(baseModel, cameraTransformType);
return Pair.of(this, null);
}
GlStateManager.pushMatrix();
switch (cameraTransformType) {
case FIRST_PERSON:
GlStateManager.translate(0.5F, 0.5F, 0.5F);
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(-0.75F, -0.5F, 0.5F);
if (isFlashing) {
GlStateManager.scale(1.2F, 1.2F, 1.2F);
}
break;
case THIRD_PERSON:
GlStateManager.rotate(80.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, -0.525F, -0.1F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
if (isFlashing) {
GlStateManager.scale(1.2F, 1.2F, 1.2F);
}
break;
case GROUND:
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, -0.725F, 0.0F);
GlStateManager.scale(0.825F, 0.825F, 0.825F);
break;
case FIXED: // e.g. inside a ceramic jar
GlStateManager.rotate(90.0F, 1.0F, 1.0F, 0.0F);
GlStateManager.translate(0F, -0.325F, 0F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
break;
default:
}
Minecraft.getMinecraft().getTextureManager().bindTexture(getTexture(type, isFlashing));
// first Entity parameter not used for anything in ModelBomb, so null is safe
bombModel.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0475F);
GlStateManager.popMatrix();
if (this.emptyModel == null) {
ModelResourceLocation resource = new ModelResourceLocation(ModInfo.ID + ":empty", "inventory");
this.emptyModel = new IFlexibleBakedModel.Wrapper(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getModel(resource), DefaultVertexFormats.ITEM);
}
// return empty model to render nothing - bomb model already rendered
return Pair.of(emptyModel, null);
}
示例9: handlePerspective
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
ForgeHooksClient.handleCameraTransforms(shieldFront, cameraTransformType);
return Pair.of(this, null);
}