本文整理汇总了Java中net.minecraftforge.client.MinecraftForgeClient.getItemRenderer方法的典型用法代码示例。如果您正苦于以下问题:Java MinecraftForgeClient.getItemRenderer方法的具体用法?Java MinecraftForgeClient.getItemRenderer怎么用?Java MinecraftForgeClient.getItemRenderer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.client.MinecraftForgeClient
的用法示例。
在下文中一共展示了MinecraftForgeClient.getItemRenderer方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerRenderers
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
public void registerRenderers()
{
RenderingRegistry.registerEntityRenderingHandler(EntityIlluminatedArrow.class, new RenderIlluminatedArrow());
if (Loader.isModLoaded("Thaumcraft"))
{
ItemStack stack = GameRegistry.findItemStack("Thaumcraft", "WandCasting", 1);
IItemRenderer wandRenderer = MinecraftForgeClient.getItemRenderer(stack, ItemRenderType.EQUIPPED_FIRST_PERSON);
RenderWandHandler render = new RenderWandHandler(wandRenderer);
MinecraftForgeClient.registerItemRenderer(stack.getItem(), render);
FMLCommonHandler.instance().bus().register(render);
}
IlluminatedBows.renderIdIllumination = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new RenderIllumination());
}
示例2: renderEquippedItems
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
protected void renderEquippedItems(EntityChiselSnowman snowman, float size){
super.renderEquippedItems(snowman, size);
ItemStack itemStack = snowman.getEquipmentInSlot(2);
if(itemStack.getItem() instanceof ItemBlock){
GL11.glPushMatrix();
this.snowMan.head.postRender(0.0625F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemStack, BLOCK_3D));
if(is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemStack.getItem()).getRenderType())){
float f1 = 0.625F;
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f1, -f1, f1);
}
this.renderManager.itemRenderer.renderItem(snowman, itemStack, 0);
GL11.glPopMatrix();
}
}
示例3: renderEquippedItems
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
protected void renderEquippedItems(EntitySnowman p_77029_1_, float p_77029_2_)
{
super.renderEquippedItems(p_77029_1_, p_77029_2_);
ItemStack itemstack = new ItemStack(Blocks.pumpkin, 1);
if (itemstack.getItem() instanceof ItemBlock)
{
GL11.glPushMatrix();
this.snowmanModel.head.postRender(0.0625F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType()))
{
float f1 = 0.625F;
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f1, -f1, f1);
}
this.renderManager.itemRenderer.renderItem(p_77029_1_, itemstack, 0);
GL11.glPopMatrix();
}
}
示例4: renderSnowmanPumpkin
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
* Renders this snowman's pumpkin.
*/
protected void renderSnowmanPumpkin(EntitySnowman par1EntitySnowman, float par2)
{
super.renderEquippedItems(par1EntitySnowman, par2);
ItemStack itemstack = new ItemStack(Block.pumpkin, 1);
if (itemstack != null && itemstack.getItem() instanceof ItemBlock)
{
GL11.glPushMatrix();
this.snowmanModel.head.postRender(0.0625F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
float f1 = 0.625F;
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f1, -f1, f1);
}
this.renderManager.itemRenderer.renderItem(par1EntitySnowman, itemstack, 0);
GL11.glPopMatrix();
}
}
示例5: renderSnowmanPumpkin
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
* Renders this snowman's pumpkin.
*/
protected void renderSnowmanPumpkin(EntityIceGolem par1EntityIceGolem, float par2)
{
super.renderEquippedItems(par1EntityIceGolem, par2);
ItemStack itemstack = new ItemStack(WinterWarMain.frozenPumpkin, 1);
if (itemstack != null && itemstack.getItem() instanceof ItemBlock)
{
GL11.glPushMatrix();
this.iceGolemModel.head.postRender(0.0625F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
float f1 = 0.625F;
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f1, -f1, f1);
}
this.renderManager.itemRenderer.renderItem(par1EntityIceGolem, itemstack, 0);
GL11.glPopMatrix();
}
}
示例6: renderItemUniform
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
* Renders items and blocks in the world at 0,0,0 with transformations that size them appropriately
* @param spin The spin angle of the item around the y axis in degrees
*/
public static void renderItemUniform(ItemStack item, double spin)
{
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
boolean is3D = customRenderer != null && customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D);
boolean larger = false;
if (item.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item.getItem()).getRenderType()))
{
int renderType = Block.getBlockFromItem(item.getItem()).getRenderType();
larger = !(renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2);
}
else if(is3D)
{
larger = true;
}
double d = 2;
double d1 = 1/d;
if(larger)
GL11.glScaled(d, d, d);
GL11.glColor4f(1, 1, 1, 1);
entityItem.setEntityItemStack(item);
uniformRenderItem.doRender(entityItem, 0, larger ? 0.09 : 0.06, 0, 0, (float)(spin*9/Math.PI));
if(larger)
GL11.glScaled(d1, d1, d1);
}
示例7: renderItemUniform
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
* Renders item and blocks in the world at 0,0,0 with transformations that size them appropriately
*
* @param spin The spin angle of the item around the y axis in degrees
*/
public static void renderItemUniform(ItemStack item, double spin)
{
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
boolean is3D = customRenderer != null && customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D);
boolean larger = false;
if (item.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item.getItem()).getRenderType()))
{
int renderType = Block.getBlockFromItem(item.getItem()).getRenderType();
larger = !(renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2);
} else if (is3D)
{
larger = true;
}
double d = 2;
double d1 = 1 / d;
if (larger)
{
GL11.glScaled(d, d, d);
}
GL11.glColor4f(1, 1, 1, 1);
entityItem.setEntityItemStack(item);
uniformRenderItem.doRender(entityItem, 0, larger ? 0.09 : 0.06, 0, 0, (float) (spin * 9 / Math.PI));
if (larger)
{
GL11.glScaled(d1, d1, d1);
}
}
示例8: renderTileEntityAt
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tickTime)
{
ToolTE te = (ToolTE) tileentity;
ItemStack is = te.getStack();
if (is == null) return;
IItemRenderer renderer = MinecraftForgeClient.getItemRenderer(is, IItemRenderer.ItemRenderType.EQUIPPED);
if (renderer != null && renderer.handleRenderType(is, IItemRenderer.ItemRenderType.EQUIPPED))
{
doSpecialRender(renderer, is, x, y, z, te.getBlockMetadata());
}
else
{
doRenderPass(0, te.getBlockMetadata(), is, x, y, z);
if (is.getItem().requiresMultipleRenderPasses())
{
for (int i = 1; i < is.getItem().getRenderPasses(is.getItemDamage()); i++)
{
doRenderPass(i, te.getBlockMetadata(), is, x, y, z);
}
}
}
if (ToolClassFinder.isSword(is))
{
if (te.sign1Facing != -1) renderSign(x, y, z, tickTime, te.sign1Facing, te.sign1Text, te.getBlockMetadata());
if (te.sign2Facing != -1) renderSign(x, y, z, tickTime, te.sign2Facing, te.sign2Text, te.getBlockMetadata());
}
}
示例9: renderItem
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
@Override
public void renderItem(ItemRenderType renderType, ItemStack itemStack, Object... data) {
render(renderType, itemStack);
ItemStack wrenchStack = ModItems.toolBox.getCurrentWrench(itemStack);
if(wrenchStack != null) {
IItemRenderer itemRenderer = MinecraftForgeClient.getItemRenderer(wrenchStack, renderType);
if(itemRenderer != null) {
itemRenderer.renderItem(renderType, wrenchStack, data);
} else {
render(renderType, wrenchStack);
}
}
}
示例10: renderItem
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
private void renderItem(TileEntityWeaponRack tile, ItemStack itemstack, Icon icon, int slot, int layer)
{
GL11.glPushMatrix();
TextureManager texturemanager = this.mc.getTextureManager();
GL11.glScalef(0.85F, 0.85F, 0.85F);
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, ItemRenderType.EQUIPPED);
if (isCustom(itemstack) && customRenderer != null)
{
texturemanager.bindTexture(texturemanager.getResourceLocation(itemstack.getItemSpriteNumber()));
renderEquippedItem(ItemRenderType.EQUIPPED, customRenderer, new RenderBlocks(), itemstack);
}
else
{
if (icon == null)
{
GL11.glPopMatrix();
return;
}
texturemanager.bindTexture(texturemanager.getResourceLocation(itemstack.getItemSpriteNumber()));
Tessellator tessellator = Tessellator.instance;
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float f4 = 0.0F;
float f5 = 0.3F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(-f4, -f5, 0.0F);
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
if (itemstack.hasEffect(layer))
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
texturemanager.bindTexture(TextureHelperMF.ITEM_GLINT);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f7 = 0.76F;
GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f8 = 0.125F;
GL11.glScalef(f8, f8, f8);
float f9 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f9, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f8, f8, f8);
f9 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f9, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
GL11.glPopMatrix();
}
示例11: renderFlatItem
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
public static void renderFlatItem(ItemStack itemstack, World world) {
if (itemstack == null || world == null) return;
int br = 16 << 20 | 16 << 4;
int x = br % 65536;
int y = br / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, x * 0.8F, y * 0.8F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
Tessellator.instance.setColorOpaque_F(1.0f, 1.0f, 1.0f);
if (itemstack != null) {
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, itemstack);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0;
entityitem.age = 0;
entityitem.rotationYaw = 0;
GL11.glPushMatrix();
GL11.glTranslatef(0, -0.04F, 0);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if (itemstack.isItemEnchanted() || itemstack.getItem().requiresMultipleRenderPasses()) {
GL11.glTranslatef(0.0f, -0.05f, -0.25f);
GL11.glScalef(1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f);
GL11.glScalef(1.0f, -1.0f, 0.005f);
Block block = Block.getBlockFromItem(itemstack.getItem());
if ((itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))) {
GL11.glRotatef(25.0f, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(15.0f, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(30.0f, 0.0f, 1.0f, 0.0f);
}
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, IItemRenderer.ItemRenderType.ENTITY);
if (customRenderer != null && !(itemstack.getItem() instanceof ItemBlock)) {
if (customRenderer.shouldUseRenderHelper(IItemRenderer.ItemRenderType.ENTITY, itemstack, IItemRenderer.ItemRendererHelper.BLOCK_3D)) {
GL11.glTranslatef(0, -0.04F, 0);
GL11.glScalef(0.7f, 0.7f, 0.7f);
GL11.glRotatef(35, 1, 0, 0);
GL11.glRotatef(45, 0, 1, 0);
GL11.glRotatef(-90, 0, 1, 0);
}
} else if (itemstack.getItem() instanceof ItemBlock) {
GL11.glTranslatef(0, -0.04F, 0);
GL11.glScalef(1.1f, 1.1f, 1.1f);
GL11.glRotatef(-90, 0, 1, 0);
} else {
GL11.glTranslatef(0, -0.14F, 0);
GL11.glScalef(0.8f, 0.8f, 0.8f);
}
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
} else {
GL11.glScalef(1.0f / 42.0f, 1.0f / 42.0f, 1.0f / 42.0f);
GL11.glTranslated(-8.0, -10.2, -10.4);
GL11.glScalef(1.0f, 1.0f, 0.005f);
RenderItem.renderInFrame = false;
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
if (!ForgeHooksClient.renderInventoryItem(renderBlocks, Minecraft.getMinecraft().renderEngine, itemstack, true, 0, (float) 0, (float) 0)) {
renderItem.renderItemIntoGUI(fr, Minecraft.getMinecraft().renderEngine, itemstack, 0, 0, false);
}
}
GL11.glPopMatrix();
}
}
示例12: renderSpecials
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
/**
* Method for adding special render rules
*/
protected void renderSpecials(EntityStatuePlayer player, float par2) {
float f1 = 1.0F;
GL11.glColor3f(f1, f1, f1);
super.renderEquippedItems(player, par2);
super.renderArrowsStuckInEntity(player, par2);
ItemStack stack = player.inventory.armorItemInSlot(3);
if (stack != null) {
GL11.glPushMatrix();
modelBipedMain.bipedHead.postRender(0.0625F);
float f2;
if (stack != null && stack.getItem() instanceof ItemBlock) {
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(stack, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, stack, BLOCK_3D));
if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
f2 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f2, -f2, -f2);
}
renderManager.itemRenderer.renderItem(player, stack, 0);
} else if (stack.getItem().equals(Items.skull)) {
f2 = 1.0625F;
GL11.glScalef(f2, -f2, -f2);
GameProfile s = null;
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("Owner")) {
s = NBTUtil.func_152459_a(stack.getTagCompound().getCompoundTag("Owner"));
}
TileEntitySkullRenderer.field_147536_b.func_152674_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, stack.getItemDamage(), s);
}
GL11.glPopMatrix();
}
renderItemInRightArm(player);
renderItemInLeftArm(player);
}
示例13: getRendererForTool
import net.minecraftforge.client.MinecraftForgeClient; //导入方法依赖的package包/类
private IItemRenderer getRendererForTool(ItemStack itemstack, ItemRenderType type) {
return MinecraftForgeClient.getItemRenderer(itemstack,
type);
}