本文整理汇总了Java中net.minecraft.client.renderer.entity.RenderItem类的典型用法代码示例。如果您正苦于以下问题:Java RenderItem类的具体用法?Java RenderItem怎么用?Java RenderItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RenderItem类属于net.minecraft.client.renderer.entity包,在下文中一共展示了RenderItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postInit
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
if (event.getSide() == Side.CLIENT)
{
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
BlockAuraStone.BlockType.registerRenders();
renderItem.getItemModelMesher().register(orb, 0, new ModelResourceLocation(MODID + ":" + ((ItemAuraOrb) orb).getNameFromDamage(0), "inventory"));
renderItem.getItemModelMesher().register(orb, 1, new ModelResourceLocation(MODID + ":" + ((ItemAuraOrb) orb).getNameFromDamage(1), "inventory"));
renderItem.getItemModelMesher().register(Item.getItemFromBlock(auramPlant), 0 , new ModelResourceLocation(MODID + ":" + (((BlockAuramPlant) auramPlant).getName()), "inventory"));
}
}
示例2: renderTileEntityAt
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
@Override
public void renderTileEntityAt(TileEntityShaft shaft, double dx, double dy, double dz, float partial, int destroyingStage) {
GlStateManager.enableTexture2D();
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
Minecraft.getMinecraft().getTextureManager().bindTexture(Core.blockAtlas);
GL11.glPushMatrix();
GL11.glTranslated(dx + 0.5, dy + 0.5, dz + 0.5);
if (shaft.axis.getDirectionVec().getX() == 1) {
GL11.glRotatef(90, 0, 0, 1);
} else if (shaft.axis.getDirectionVec().getZ() == 1) {
GL11.glRotatef(90, 1, 0, 0);
}
double angle = Math.toDegrees(NumUtil.interp(shaft.prev_angle, shaft.angle, partial));
GL11.glRotatef((float) angle, 0, 1, 0);
Minecraft mc = Minecraft.getMinecraft();
RenderItem ri = mc.getRenderItem();
RenderUtil.scale3(2);
IBakedModel model = ri.getItemModelMesher().getItemModel(shaft.shaftItem);
ri.renderItem(shaft.shaftItem, model);
GL11.glPopMatrix();
}
示例3: renderTesr
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void renderTesr(@Nullable ServoMotor motor, float partial) {
final Minecraft mc = Minecraft.getMinecraft();
final RenderItem ri = mc.getRenderItem();
RenderUtil.scale3(2);
GL11.glPushMatrix();
GL11.glTranslated(0.25, 0.25, 0.25);
for (int i = 0; i < parts.length; i++) {
ItemStack part = parts[i];
if (part == null) continue;
if (motor == null && isStaticPart(i, part)) continue;
GL11.glPushMatrix();
stateForPart(i, part, partial);
ri.renderItem(part, ItemCameraTransforms.TransformType.NONE);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
示例4: initBlocks
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
public static final void initBlocks(FMLInitializationEvent event)
{
blocks = new ArrayList<CustomBlock>();
marble = (CustomBlock)new CustomBlock("marble", Material.rock).setHardness(1.5f).setResistance(10.0f).setStepSound(Block.soundTypePiston);
marbleBricks = (CustomBlock)new CustomBlock("marbleBricks", Material.rock).setHardness(1.5f).setResistance(10.0f).setStepSound(Block.soundTypePiston);
if (event.getSide() == Side.CLIENT)
{
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
for (CustomBlock block : blocks)
{
renderItem.getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(NaturalRocks.prefix + block.getName(), "inventory"));
}
}
}
示例5: BWItem
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
public BWItem(net.minecraft.item.Item item, int meta, NBTTagCompound tag) {
this.item = item;
this.meta = meta;
this.tag = tag;
components.add(new StaticRenderer())
.onRender(model -> {
model.addChild(new CustomModel(self -> {
Tessellator.instance.draw();
GL11.glPushMatrix();
DoubleBuffer buffer = BufferUtils.createDoubleBuffer(4 * 4);
double[] flatArray = Arrays.stream(self.matrix.getMatrix().getData())
.flatMapToDouble(Arrays::stream)
.toArray();
buffer.put(flatArray);
buffer.position(0);
GL11.glMultMatrix(buffer);
RenderItem.getInstance().doRender(fakeEntity, 0, 0, 0, 0, 0);
GL11.glPopMatrix();
Tessellator.instance.startDrawingQuads();
}));
}
);
}
示例6: renderTileEntityAt
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f1) {
model.renderDoomShrine(x, y, z);
TileDoomShrine tileEntity = (TileDoomShrine)te;
int slot = 0;
if(tileEntity.getStackInSlot(slot)!= null){
if((entItem == null) || entItem.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem())
entItem = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot));
GL11.glPushMatrix();
this.entItem.hoverStart = 0.0F;
RenderItem.renderInFrame = true;
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.08F, (float)z + 0.5F);
GL11.glRotatef(0, 90, 1, 1);
RenderManager.instance.renderEntityWithPosYaw(this.entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
}
}
示例7: renderSlots
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
private void renderSlots(GearSwapperTE gearSwapperTE) {
RenderHelper.enableGUIStandardItemLighting();
float factor = 2.0f;
float f3 = 0.0075F;
GL11.glTranslatef(-0.5F, 0.5F, 0.04F);
GL11.glScalef(f3 * factor, -f3 * factor, 0.0001f);
RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
for (int i = 0 ; i < 4 ; i++) {
ItemStack stack = gearSwapperTE.getStackInSlot(i);
if (stack != null) {
itemRender.renderItemAndEffectIntoGUI(stack, xx[i], yy[i]);
}
}
RenderHelper.enableStandardItemLighting();
}
示例8: renderItemStack
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
public void renderItemStack(ItemStack stack, int x, int y)
{
if (stack != null)
{
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
// Renders Item Icon.
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
// Renders Item Overlay example durability bar
RenderItem.getInstance().renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1F, 1F, 1F, 1F);
}
}
示例9: registerItemModels
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
/**
* -------------------------------------------------------------------------
*/
@Override
public void registerItemModels() {
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
for (Item item : RealLifeMod_Items.itemList) {
renderItem.getItemModelMesher().register(item, 0, new ModelResourceLocation(
Reference.ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
for (Block b : RealLifeMod_Blocks.blockList) {
renderItem.getItemModelMesher().register(Item.getItemFromBlock(b), 0,
new ModelResourceLocation(Reference.ID + ":" + b.getUnlocalizedName().substring(5), "inventory"));
}
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RealLifeMod_Blocks.transformer), 0,
new ModelResourceLocation(Reference.ID + ":blockTransformer", "inventory"));
}
示例10: renderItem
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
// ====================== Render item texture ======================
FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(item);
int color = fluidStack.getFluid().getColor();
IIcon fluidIcon = item.getIconIndex();
IIcon bucketIcon = Items.bucket.getIconIndex(new ItemStack(Items.bucket));
if(type == ItemRenderType.INVENTORY) {
GL11.glEnable(GL11.GL_ALPHA_TEST);
RenderItem.getInstance().renderIcon(0, 0, bucketIcon, 16, 16);
GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));
RenderItem.getInstance().renderIcon(0, 0, fluidIcon, 16, 16);
GL11.glColor3f(1f, 1f, 1f);
}
else {
ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)bucketIcon).getMinU(), ((IIcon)bucketIcon).getMinV(), ((IIcon)bucketIcon).getMaxU(), ((IIcon)bucketIcon).getMaxV(), ((IIcon)bucketIcon).getIconWidth(), ((IIcon)bucketIcon).getIconHeight(), 0.1f);
GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));
ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)fluidIcon).getMinU(), ((IIcon)fluidIcon).getMinV(), ((IIcon)fluidIcon).getMaxU(), ((IIcon)fluidIcon).getMaxV(), ((IIcon)fluidIcon).getIconWidth(), ((IIcon)fluidIcon).getIconHeight(), 0.1f);
GL11.glColor3f(1f, 1f, 1f);
}
}
示例11: renderPage
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
@Override
public void renderPage(GuiManual gui, int x, int y, int mx, int my)
{
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
float scale = 2f;
int w = (105-stacks.length*16)/(stacks.length+1);
GL11.glScalef(scale,scale,scale);
RenderItem.getInstance().renderWithColor=true;
for(int i=0; i<stacks.length; i++)
RenderItem.getInstance().renderItemAndEffectIntoGUI(manual.fontRenderer, ManualUtils.mc().renderEngine, stacks[i], (int)((x+w+(18+w)*i)/scale), (int)((y+4)/scale));
GL11.glScalef(1/scale,1/scale,1/scale);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_BLEND);
if(localizedText!=null&&!localizedText.isEmpty())
manual.fontRenderer.drawSplitString(localizedText, x,y+44, 120, manual.getTextColour());
}
示例12: updateItemStackFocus
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
/** Redraws the ItemStack into the focus slot **/
private void updateItemStackFocus(ItemStack itemstack)
{
if(itemstack != null)
{
RenderItem renderer = new RenderItem();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
RenderHelper.enableGUIStandardItemLighting();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F);
renderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.renderEngine, itemstack, this.posX + 152, this.posY + 111);
}
}
示例13: draw
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
@Override
public void draw()
{
RenderItem renderer = new RenderItem();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
RenderHelper.enableGUIStandardItemLighting();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F);
renderer.renderItemAndEffectIntoGUI(fontrenderer, renderengine, item, posX, posY);
}
示例14: RenderHelper
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
public RenderHelper()
{
renderer = new RenderItem()
{
public boolean shouldSpreadItems()
{
return false;
}
public boolean shouldBob()
{
return false;
}
};
renderer.setRenderManager(RenderManager.instance);
renderer.renderInFrame = true;
entityItem.hoverStart = 0F;
}
示例15: sendAlertWithItem
import net.minecraft.client.renderer.entity.RenderItem; //导入依赖的package包/类
public void sendAlertWithItem(String title, String description, int givenWidth, ItemStack givenItem)
{
this.title = "\u00A7f" + title;
this.description = description;
this.field_146263_l = Minecraft.getSystemTime();
this.field_146262_n = false;
this.itemStack = givenItem;
this.item = new RenderItem();
this.image = null;
if (givenWidth == -1) {
if (mc.fontRenderer.getStringWidth(title) > mc.fontRenderer.getStringWidth(description)) {
this.alertWidth = 30 + mc.fontRenderer.getStringWidth(title) + 5;
} else {
this.alertWidth = 30 + mc.fontRenderer.getStringWidth(description) + 5;
}
}
}