Jump to content

f1rSt1kChannel

Members
  • Posts

    138
  • Joined

  • Last visited

Everything posted by f1rSt1kChannel

  1. How does it work Bukkit scheluder? Have the source code?
  2. Thanks. I just need to load an image from the site. To do so: private static Map<String, DynamicTexture> images = Maps.newHashMap(); public static void addTexture(String name, BufferedImage image){ images.put(name, new DynamicTexture(image)); } public static void bindTexture(String name){ GL11.glBindTexture(GL11.GL_TEXTURE_2D, images.get(name).getGlTextureId()); } addTexture("border", ImageIO.read(new URL("my.url.com/images/border.png"))); bindTexture("border"); drawTexturedModalRect(x, y, u, v, width, height);
  3. So? DynamicTexture texture = new DynamicTexture(new BufferedImage(...)); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getGlTextureId()); drawTexturedModalRect(...);?
  4. Write a wrapper for the ItemStack, now everything is working fine. /** * @author Agravaine */ public class ItemStackHash{ private ItemStack iStack; private boolean doCheckNBT = false; private boolean doCheckStackSize = false; private boolean doCheckDamage = false; public ItemStackHash(Block block){ this(block, 1); } public ItemStackHash(Block block, int count){ this(block, count, 0); } public ItemStackHash(Block block, int count, int damage){ this(Item.getItemFromBlock(block), count, damage); } public ItemStackHash(Item item){ this(item, 1); } public ItemStackHash(Item item, int count){ this(item, count, 0); } public ItemStackHash(Item item, int count, int damage){ iStack = new ItemStack(Preconditions.checkNotNull(item, "Item is null!"), count, damage); } public ItemStackHash(ItemStack itemStack){ iStack = Preconditions.checkNotNull(itemStack, "ItemStack is null!"); } private ItemStackHash(){ throw new UnsupportedOperationException("Unsupported empty constructor!"); } public ItemStackHash setDoCheckDamage(){ doCheckDamage = true; return this; } public ItemStackHash setDoCheckStackSize(){ doCheckStackSize = true; return this; } public ItemStackHash setDoCheckNBT(){ doCheckNBT = true; return this; } public ItemStackHash setChecks(ItemStackHash parent){ doCheckNBT = parent.doCheckNBT; doCheckDamage = parent.doCheckDamage; doCheckStackSize = parent.doCheckStackSize; return this; } public ItemStack getItemStack(){ return iStack; } public int hashCode(){ final int prime = 31; int result = 1; result = prime * result + Item.getIdFromItem(iStack.getItem()); result = prime * result + (doCheckDamage ? iStack.getItemDamage() : 0); result = prime * result + (doCheckStackSize ? iStack.stackSize : 0); result = prime * result + (doCheckNBT && iStack.hasTagCompound() ? iStack.stackTagCompound.hashCode() : 0); return result; } public boolean equals(Object obj) { if(!(obj instanceof ItemStackHash)){ return false; } ItemStackHash hashStack = (ItemStackHash)obj; if(Item.getIdFromItem(iStack.getItem()) != Item.getIdFromItem(hashStack.iStack.getItem())){ return false; } if(doCheckDamage && iStack.getItemDamage() != hashStack.iStack.getItemDamage()){ return false; } if(doCheckNBT && iStack.stackTagCompound != hashStack.iStack.stackTagCompound){ return false; } if(doCheckStackSize && iStack.stackSize != hashStack.iStack.stackSize){ return false; } return true; } public String toString(){ return iStack.toString(); } }
  5. And how then work normally with ItemStask in HashMap? P.S
  6. Please!!! Override method hashcode in ItemStack! Unable to work normally with ItemStack in HashMap
  7. Not Transparency is working GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.3F); //0.3F - alpha not work
  8. And at the end GL11.glDisable(GL11.GL_BLEND) necessary?
  9. Hello! When I draw a texture using RenderGameOverlayEvent, then with her drawn back white background, although it is transparent. My code is: @SubscribeEvent @SideOnly(Side.CLIENT) public void cancelVanillaGUI(RenderGameOverlayEvent.Pre event){ /* Cancel render vanilla hearts, food, air and armor */ if(event.type == ElementType.HEALTH || event.type == ElementType.FOOD || event.type == ElementType.AIR || event.type == ElementType.ARMOR || event.type == ElementType.EXPERIENCE){ event.setCanceled(true); Minecraft mc = Minecraft.getMinecraft(); if(mc.theWorld == null || mc.thePlayer == null){ return; } EntityClientPlayerMP player = mc.thePlayer; RPGPlayerInfo info = RPGPlayerInfo.forPlayer(player); if(player.capabilities.isCreativeMode){ return; } ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); int height = resolution.getScaledHeight(); int width = resolution.getScaledWidth(); GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F); //GL11.glDisable(GL11.GL_LIGHTING); mc.getTextureManager().bindTexture(new ResourceLocation(InMinecraftRpg.MOD_ID.toLowerCase(), "textures/gui/icons.png")); /* Draw border */ mc.ingameGUI.drawTexturedModalRect(2, 2, 0, 0, 162, 60); int healthBarWidth = MathHelper.ceiling_float_int(((player.getHealth() / player.getMaxHealth()) * 108)); /* Draw health bar */ mc.ingameGUI.drawTexturedModalRect(52, 16, 0, 60, healthBarWidth, 10); int armorBarWidth = MathHelper.ceiling_float_int(((getArmorValue(player) / 100.0F) * 108)); /* Draw armor bar */ mc.ingameGUI.drawTexturedModalRect(52, 29, 0, 70, armorBarWidth, 10); if(mc.objectMouseOver != null){ if(mc.objectMouseOver.typeOfHit == MovingObjectType.ENTITY && mc.objectMouseOver.entityHit instanceof EntityLivingBase){ EntityLivingBase viewEntity = (EntityLivingBase)mc.objectMouseOver.entityHit; int viewEntityHealthBarWidth = MathHelper.ceiling_float_int((viewEntity.getHealth() / viewEntity.getMaxHealth()) * 86); /* Draw view entity health bar */ mc.ingameGUI.drawTexturedModalRect(66, 53, 0, 80, viewEntityHealthBarWidth, 6); /* Draw view entity name */ mc.ingameGUI.drawCenteredString(mc.fontRenderer, viewEntity.getCommandSenderName(), 112, 64, Color.CYAN.getRGB()); if(viewEntity instanceof EntityPlayer){ int healthArmor = MathHelper.floor_float(viewEntity.getMaxHealth() + getArmorValue((EntityPlayer)viewEntity)); /* Draw view player health + armor */ mc.ingameGUI.drawCenteredString(mc.fontRenderer, String.valueOf(healthArmor), 112, 55, Color.CYAN.getRGB()); } } } mc.getTextureManager().bindTexture(Gui.icons); int max = info.experienceToNextLvl - RPGPlayerInfo.getXpToNextLvl(info.experienceLevel - 1); int current = info.experienceToNextLvl - info.experience; int concurrent = max - current; int experienceBarWidth = MathHelper.ceiling_float_int(((float)concurrent / (float)max) * 182); //GL11.glTranslated(-182, 0, 0); /* Draw experience border */ mc.ingameGUI.drawTexturedModalRect(width / 2 - 91, height - 29, 0, 64, 182, 5); /* Draw experience bar */ mc.ingameGUI.drawTexturedModalRect(width / 2 - 91, height - 29, 0, 69, experienceBarWidth, 5); /* Draw experience lvl value */ drawStringWithShadow(String.valueOf(info.experienceLevel), 82, 40, 8453920); /* Draw health value */ drawStringWithShadow(String.valueOf((int)player.getHealth()) + "/" + (int)player.getMaxHealth(), 218, 18, Color.WHITE.getRGB()); /* Draw armor value */ drawStringWithShadow(String.valueOf((int)getArmorValue(player)) + "/100", 218, 31, Color.WHITE.getRGB()); /* Draw experience value */ drawStringWithShadow(String.valueOf(info.experience) + "/" + String.valueOf(info.experienceToNextLvl), width, height - 45, 8453920); //GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } } Here drawn picture: mc.getTextureManager().bindTexture(new ResourceLocation(InMinecraftRpg.MOD_ID.toLowerCase(), "textures/gui/icons.png")); /* Draw border */ mc.ingameGUI.drawTexturedModalRect(2, 2, 0, 0, 162, 60); Screenshot:
  10. It is necessary to remove the effects of being eaten after the golden apples. How can this be done?
  11. EnumChatFormatting.RED + String1 + EnumChatFormatting.RESET + String2
  12. setSize I installed using reflection because he protected. Eye position: And I will give this method? What do I do with it?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.