net.minecraft.client.Minecraft类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(393)

本文整理了Java中net.minecraft.client.Minecraft类的一些代码示例,展示了Minecraft类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Minecraft类的具体详情如下:
包路径:net.minecraft.client.Minecraft
类名称:Minecraft

Minecraft介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public RenderFloatingItem( final RenderManager manager )
{
  super( manager, Minecraft.getMinecraft().getRenderItem() );
  this.shadowOpaque = 0.0F;
}

代码示例来源:origin: Vazkii/Botania

@Override
public void bindTexture() {
  Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
}

代码示例来源:origin: Vazkii/Botania

@Override
@SideOnly(Side.CLIENT)
public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) {
  if(button == buttonText) {
    GuiLexicon.startTutorial();
    Minecraft.getMinecraft().displayGuiScreen(new GuiLexicon());
    Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("botaniamisc.tutorialStarted").setStyle(new Style().setColor(TextFormatting.GREEN)));
  } else if(button == buttonVideo && Desktop.isDesktopSupported()) {
    try {
      Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=D75Aad-5QgQ"));
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public TextureAtlasSprite getParticleTexture() {
  return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:blocks/livingwood0");
}

代码示例来源:origin: Vazkii/Botania

private void renderBlock(Block block) {
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(block.getDefaultState(), 1.0F);
  }
}

代码示例来源:origin: Vazkii/Botania

private static boolean renderComponentInWorld(World world, Multiblock mb, MultiblockComponent comp, BlockPos anchorPos) {
  double renderPosX = Minecraft.getMinecraft().getRenderManager().renderPosX;
  double renderPosY = Minecraft.getMinecraft().getRenderManager().renderPosY;
  double renderPosZ = Minecraft.getMinecraft().getRenderManager().renderPosZ;
  BlockPos pos = comp.getRelativePosition();
  BlockPos pos_ = pos.add(anchorPos);
  if(anchor != null && comp.matches(world, pos_))
    return false;
  GlStateManager.pushMatrix();
  GlStateManager.translate(-renderPosX, -renderPosY, -renderPosZ);
  GlStateManager.disableDepth();
  doRenderComponent(mb, comp, pos_);
  GlStateManager.popMatrix();
  return true;
}

代码示例来源:origin: Vazkii/Botania

@SideOnly(Side.CLIENT)
public void render(ItemStack stack, EntityPlayer player, float partialTicks) {
  Minecraft mc = Minecraft.getMinecraft();
  Tessellator tess = Tessellator.getInstance();
  double renderPosX = mc.getRenderManager().renderPosX;
  double renderPosY = mc.getRenderManager().renderPosY;
  double renderPosZ = mc.getRenderManager().renderPosZ;
      Minecraft.getMinecraft().getRenderItem().renderItem(slotStack, ItemCameraTransforms.TransformType.GUI);
      RenderHelper.disableStandardItemLighting();

代码示例来源:origin: Vazkii/Botania

@Override
@SideOnly(Side.CLIENT)
public void readSpawnData(ByteBuf additionalData) {
  playerCount = additionalData.readInt();
  hardMode = additionalData.readBoolean();
  source = BlockPos.fromLong(additionalData.readLong());
  long msb = additionalData.readLong();
  long lsb = additionalData.readLong();
  bossInfoUUID = new UUID(msb, lsb);
  Minecraft.getMinecraft().getSoundHandler().playSound(new DopplegangerMusic(this));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public RayTraceResult getRTR()
{
  return Minecraft.getMinecraft().objectMouseOver;
}

代码示例来源:origin: Vazkii/Botania

@SideOnly(Side.CLIENT)
public void renderItem(IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack) {
  RenderItem render = Minecraft.getMinecraft().getRenderItem();
  boolean mouseDown = Mouse.isButtonDown(0);
  GlStateManager.pushMatrix();
  GlStateManager.enableBlend();
  GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
  RenderHelper.enableGUIStandardItemLighting();
  GlStateManager.enableRescaleNormal();
  GlStateManager.enableDepth();
  render.renderItemAndEffectIntoGUI(stack, xPos, yPos);
  render.renderItemOverlays(Minecraft.getMinecraft().fontRenderer, stack, xPos, yPos);
  RenderHelper.disableStandardItemLighting();
  GlStateManager.popMatrix();
  if(relativeMouseX >= xPos && relativeMouseY >= yPos && relativeMouseX <= xPos + 16 && relativeMouseY <= yPos + 16) {
    tooltipStack = stack;
    EntryData data = LexiconRecipeMappings.getDataForStack(tooltipStack);
    if(data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) {
      tooltipEntry = true;
      if(!mouseDownLastTick && mouseDown && GuiScreen.isShiftKeyDown()) {
        GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui);
        newGui.page = data.page;
        Minecraft.getMinecraft().displayGuiScreen(newGui);
      }
    }
  }
  GlStateManager.disableLighting();
}

代码示例来源:origin: Vazkii/Botania

private static void renderBlockAt(Block block, int meta, BlockPos pos) {
  IBlockState state = block.getStateFromMeta(meta);
  double renderPosX = Minecraft.getMinecraft().getRenderManager().renderPosX;
  double renderPosY = Minecraft.getMinecraft().getRenderManager().renderPosY;
  double renderPosZ = Minecraft.getMinecraft().getRenderManager().renderPosZ;
  GlStateManager.pushMatrix();
  GlStateManager.translate(-renderPosX, -renderPosY, -renderPosZ);
  GlStateManager.disableDepth();
  
  GlStateManager.pushMatrix();
  GlStateManager.enableBlend();
  GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
  Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
  BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
  GlStateManager.translate(pos.getX(), pos.getY(), pos.getZ() + 1);
  GlStateManager.color(1, 1, 1, 1);
  brd.renderBlockBrightness(state, 1.0F);
  GlStateManager.color(1F, 1F, 1F, 1F);
  GlStateManager.enableDepth();
  GlStateManager.popMatrix();
  GlStateManager.popMatrix();
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

GlStateManager.disableBlend();
final Fluid fluid = fs.getFluid();
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
final TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() );

代码示例来源:origin: SleepyTrousers/EnderIO

public DynaTextureProvider(int textureSize, @Nonnull ResourceLocation fallBackTexture) {
 this.textureManager = Minecraft.getMinecraft().getTextureManager();
 this.resourceManager = Minecraft.getMinecraft().getResourceManager();
 this.fallBackTexture = fallBackTexture;
 this.dynamicTexture = new DynamicTexture(textureSize, textureSize);
 this.imageData = this.dynamicTexture.getTextureData();
 this.resourceLocation = textureManager.getDynamicTextureLocation(EnderIO.DOMAIN, this.dynamicTexture);
 for (int i = 0; i < this.imageData.length; ++i) {
  this.imageData[i] = 0;
 }
 instances.add(this);
}

代码示例来源:origin: Vazkii/Botania

@Override
public IMessage onMessage(final PacketBotaniaEffect message, final MessageContext ctx) {
  Minecraft.getMinecraft().addScheduledTask(new Runnable() {

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
  public void modelRegistration( Side side, IModelRegistry registry )
  {
    registry.setCustomStateMapper( this.block, this.stateMapper );
    if( this.stateMapper instanceof IResourceManagerReloadListener )
    {
      ( (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager() )
          .registerReloadListener( (IResourceManagerReloadListener) this.stateMapper );
    }
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void drawContent( final Minecraft mc, final int mouseX, final int mouseY, final float partialTicks )
{
  final IAEFluidStack fs = this.getFluidStack();
  if( fs != null )
  {
    GlStateManager.disableLighting();
    GlStateManager.disableBlend();
    final Fluid fluid = fs.getFluid();
    mc.getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
    final TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() );
    // Set color for dynamic fluids
    // Convert int color to RGB
    final float red = ( fluid.getColor() >> 16 & 255 ) / 255.0F;
    final float green = ( fluid.getColor() >> 8 & 255 ) / 255.0F;
    final float blue = ( fluid.getColor() & 255 ) / 255.0F;
    GlStateManager.color( red, green, blue );
    this.drawTexturedModalRect( this.xPos(), this.yPos(), sprite, this.getWidth(), this.getHeight() );
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

GlStateManager.disableCull();
if( Minecraft.isAmbientOcclusionEnabled() )
BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
IBakedModel model = dispatcher.getModelForState( blockState );

代码示例来源:origin: Vazkii/Botania

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  mc.getTextureManager().bindTexture(texture);
  int k = (width - xSize) / 2;
  int l = (height - ySize) / 2;
  drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
  List<Slot> slotList = inventorySlots.inventorySlots;
  for(Slot slot : slotList)
    if(slot instanceof SlotItemHandler) {
      SlotItemHandler slotf = (SlotItemHandler) slot;
      if(!slotf.getHasStack()) {
        ItemStack stack = new ItemStack(ModBlocks.flower, 1, slotf.getSlotIndex()); // index matches colors
        int x = guiLeft + slotf.xPos;
        int y = guiTop + slotf.yPos;
        RenderHelper.enableGUIStandardItemLighting();
        mc.getRenderItem().renderItemIntoGUI(stack, x, y);
        RenderHelper.disableStandardItemLighting();
        mc.fontRenderer.drawStringWithShadow("0", x + 11, y + 9, 0xFF6666);
      }
    }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public void bindTexture( final String base, final String file )
{
  final ResourceLocation loc = new ResourceLocation( base, "textures/" + file );
  this.mc.getTextureManager().bindTexture( loc );
}

代码示例来源:origin: Vazkii/Botania

private void openEntry(int index) {
  if(index >= entriesToDisplay.size())
    return;
  LexiconEntry entry = entriesToDisplay.get(index);
  mc.displayGuiScreen(new GuiLexiconEntry(entry, this));
  ClientTickHandler.notifyPageChange();
}

相关文章