/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its * argument and then handing it off to a worker function which does the actual work. In all * probabilty, the class Render is generic (Render<T extends Entity) and this method has signature * public void doRender(T entity, double d, double d1, double d2, float f, float f1). But JAD is * pre 1.5 so doesn't do that. */ public void doRender( Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { Icon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f); if (icon != null) { GL11.glPushMatrix(); GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); this.bindEntityTexture(par1Entity); Tessellator tessellator = Tessellator.instance; if (icon == ItemPotion.func_94589_d("bottle_splash")) { int i = PotionHelper.func_77915_a(((LaunchedPotion) par1Entity).getPotionDamage(), false); float f2 = (float) (i >> 16 & 255) / 255.0F; float f3 = (float) (i >> 8 & 255) / 255.0F; float f4 = (float) (i & 255) / 255.0F; GL11.glColor3f(f2, f3, f4); GL11.glPushMatrix(); this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay")); GL11.glPopMatrix(); GL11.glColor3f(1.0F, 1.0F, 1.0F); } this.func_77026_a(tessellator, icon); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } }
/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its * argument and then handing it off to a worker function which does the actual work. In all * probabilty, the class Render is generic (Render<T extends Entity) and this method has signature * public void doRender(T entity, double d, double d1, double d2, float f, float f1). But JAD is * pre 1.5 so doesn't do that. */ public void doRender( Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { GL11.glPushMatrix(); GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); // this.loadTexture("/warpcraft/items/Items.png"); Tessellator var10 = Tessellator.instance; if (this.itemIconIndex == 9) { int var11 = PotionHelper.func_77915_a(((EntityPotion) par1Entity).getPotionDamage(), false); float var12 = (float) (var11 >> 16 & 255) / 255.0F; float var13 = (float) (var11 >> 8 & 255) / 255.0F; float var14 = (float) (var11 & 255) / 255.0F; GL11.glColor3f(var12, var13, var14); GL11.glPushMatrix(); this.func_77026_a(var10, 141); GL11.glPopMatrix(); GL11.glColor3f(1.0F, 1.0F, 1.0F); } this.func_77026_a(var10, this.itemIconIndex); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
public static int addPotionEffect(int targetMetaData, ItemStack ingredient) { return ingredient == null ? targetMetaData : (ingredient.getItem().isPotionIngredient(ingredient) ? PotionHelper.applyIngredient( targetMetaData, ingredient.getItem().getPotionEffect(ingredient)) : targetMetaData); }
@SubscribeEvent public void potionBrewEvent(PotionBrewEvent.Pre event) { ItemStack ingredient = event.getItem(3); if (ingredient != null && ingredient.getItem() == ModItems.dragon_breath) { for (int i = 0; i < 3; i++) { ItemStack potion = event.getItem(i); if (potion != null && potion.getItem() == Items.potionitem && ItemPotion.isSplash(potion.getItemDamage())) event.setItem( i, new ItemStack( ModItems.lingering_potion, 1, PotionHelper.applyIngredient( potion.getItemDamage(), ModItems.dragon_breath.getPotionEffect(ingredient)))); } if (--ingredient.stackSize <= 0) event.setItem(3, ingredient.getItem().getContainerItem(ingredient)); event.setCanceled(true); } }
public int getColor(ItemStack itemStack) { // basically we're just using vanillas right now. This is hilarious in comparison to the old // method, which is a mile long. return PotionHelper.calcPotionLiquidColor( new PotionEssence(itemStack.getTagCompound()).getEffects()); }
@Override public boolean doPreWork() { if (isPowered && tank.getAmount() >= 50) { setIdle(delay * 20); ForgeDirection direct = getDirection(); Location loc = getLocation(); double minX = xCoord - (direct == ForgeDirection.WEST ? 6 : direct == ForgeDirection.EAST ? -1.5 : 1.5); double minY = yCoord - (direct == ForgeDirection.DOWN ? 6 : direct == ForgeDirection.UP ? -1.5 : 1.5); double minZ = zCoord - (direct == ForgeDirection.NORTH ? 6 : direct == ForgeDirection.SOUTH ? -1.5 : 1.5); double maxX = xCoord + (direct == ForgeDirection.EAST ? 6 : direct == ForgeDirection.WEST ? -1.0 : 1.5); double maxY = yCoord + (direct == ForgeDirection.UP ? 6 : direct == ForgeDirection.DOWN ? -1.0 : 1.5); double maxZ = zCoord + (direct == ForgeDirection.SOUTH ? 6 : direct == ForgeDirection.NORTH ? -1.0 : 1.5); Brewcraft.inst.logDebug( "Current location: ", loc, ", spraying min: [", minX, ", ", minY, ", ", minZ, "], to max: [", maxX, ", ", maxY, ", ", maxZ, "]"); AxisAlignedBB range = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); @SuppressWarnings("unchecked") List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, range); final FluidStack fluid = tank.getFluid(); final ItemStack potion = FluidContainerRegistry.fillFluidContainer( new FluidStack(fluid, 1000), new ItemStack(Items.glass_bottle)); Collection<PotionEffect> effects = null; if (potion != null && potion.getItem() instanceof MetaItemPotion) { final MetaItemPotion bottle = (MetaItemPotion) potion.getItem(); final SubItemPotion bot = bottle.getMetaItem(bottle.getDamage(potion)); ParticleHandler.send( worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, bot.getEffect(), ParticleHandler.MIST, getDirection()); worldObj.playSoundEffect( xCoord, yCoord, zCoord, "random.fizz", 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); effects = new ArrayList<PotionEffect>(1); effects.add( new PotionEffect( bot.getEffect().id, bot.getEffect().isInstant() ? 1 : bot.duration / 2, bot.strength)); } else if (potion != null && potion.getItem() instanceof ItemPotion) { @SuppressWarnings("unchecked") final List<PotionEffect> list = PotionHelper.getPotionEffects(potion.getItemDamage(), false); if (list != null) { ParticleHandler.send( worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, PotionHelper.func_77915_a(potion.getItemDamage(), false), true, ParticleHandler.MIST, getDirection()); worldObj.playSoundEffect( xCoord, yCoord, zCoord, "random.fizz", 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); effects = list; } } else return false; if (effects != null) for (EntityLivingBase entity : entities) for (PotionEffect effect : effects) entity.addPotionEffect(effect); tank.drain(50, true); return true; } else return false; }