コード例 #1
0
 protected void drawActiveEntries(ResourceLocation texture, int xOffset, int yOffset) {
   if (!this.hasActiveSeed()) {
     return;
   }
   int textureSize = 256;
   GL11.glColor4f(1F, 1F, 1F, 1F);
   for (int i = 0; i < this.activeSeeds.size(); i++) {
     Component<PlantStatsStorage> component = activeSeeds.get(i);
     if (component != null && component.getComponent() != null) {
       PlantStatsStorage stats = component.getComponent();
       short growth = stats.getGrowth();
       short gain = stats.getGain();
       short strength = stats.getStrength();
       // draw the seed icon
       ItemStack stack = new ItemStack(activeSeed, stats.amount, activeMeta);
       stack.setTagCompound(
           CropPlantHandler.setSeedNBT(new NBTTagCompound(), growth, gain, strength, true));
       itemRender.renderItemIntoGUI(stack, component.xOffset(), component.yOffset());
       itemRender.renderItemOverlayIntoGUI(
           fontRendererObj, stack, component.xOffset(), component.yOffset(), "" + stack.stackSize);
       // draw the stat bars
       Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
       GL11.glDisable(GL11.GL_LIGHTING);
       this.drawTexturedModalRect(
           this.guiLeft + xOffset + (i * 16) + 1,
           this.guiTop + yOffset - growth,
           0,
           textureSize - growth,
           3,
           growth);
       this.drawTexturedModalRect(
           this.guiLeft + xOffset + i * 16 + 6,
           this.guiTop + yOffset - gain,
           0,
           textureSize - gain,
           3,
           gain);
       this.drawTexturedModalRect(
           this.guiLeft + xOffset + i * 16 + 11,
           this.guiTop + yOffset - strength,
           0,
           textureSize - strength,
           3,
           strength);
       GL11.glEnable(GL11.GL_LIGHTING);
     }
   }
 }
コード例 #2
0
 @SuppressWarnings("unchecked")
 protected void drawTooltip(int x, int y) {
   if (!this.hasActiveSeed()) {
     return;
   }
   for (Component<PlantStatsStorage> component : this.activeSeeds) {
     if (component != null && component.getComponent() != null) {
       // tooltip
       if (component.isOverComponent(x, y)) {
         PlantStatsStorage stats = component.getComponent();
         short growth = stats.getGrowth();
         short gain = stats.getGain();
         short strength = stats.getStrength();
         ItemStack stack = new ItemStack(activeSeed, stats.amount, activeMeta);
         stack.setTagCompound(
             CropPlantHandler.setSeedNBT(new NBTTagCompound(), growth, gain, strength, true));
         List toolTip = stack.getTooltip(Minecraft.getMinecraft().thePlayer, true);
         drawHoveringText(toolTip, x - this.guiLeft, y - this.guiTop, fontRendererObj);
       }
     }
   }
 }