Package vazkii.botania.common.entity

Examples of vazkii.botania.common.entity.EntityManaBurst$PositionProperties


  }

  @Override
  public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    if(par1ItemStack.getItemDamage() == 0) {
      EntityManaBurst burst = getBurst(par3EntityPlayer, par1ItemStack, true);
      if(burst != null && ManaItemHandler.requestManaExact(par1ItemStack, par3EntityPlayer, burst.getMana(), true)) {
        if(!par2World.isRemote) {
          par2World.playSoundAtEntity(par3EntityPlayer, "botania:manaBlaster", 0.6F, 1F);
          par2World.spawnEntityInWorld(burst);
        } else {
          par3EntityPlayer.swingItem();
View Full Code Here


  @SideOnly(Side.CLIENT)
  public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
    if(par2 == 0)
      return 0xFFFFFF;

    EntityManaBurst burst = getBurst(Minecraft.getMinecraft().thePlayer, par1ItemStack, false);
    Color color = new Color(burst == null ? 0x20FF20 : burst.getColor());

    float mul = (float) (Math.sin((double) ClientTickHandler.ticksInGame / 5) * 0.15F);
    int c = (int) (255 * mul);

    return new Color(Math.max(0, Math.min(255, color.getRed() + c)), Math.max(0, Math.min(255, color.getGreen() + c)), Math.max(0, Math.min(255, color.getBlue() + c))).getRGB();
View Full Code Here

  public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) {
    return false;
  }

  public EntityManaBurst getBurst(EntityPlayer player, ItemStack stack, boolean request) {
    EntityManaBurst burst = new EntityManaBurst(player);

    int maxMana = 120;
    int color = 0x20FF20;
    int ticksBeforeManaLoss = 60;
    float manaLossPerTick = 4F;
    float motionModifier = 5F;
    float gravity = 0F;
    BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color);

    ItemStack lens = getLens(stack);
    if(lens != null)
      ((ILens) lens.getItem()).apply(lens, props);


    burst.setSourceLens(lens);
    if(!request || ManaItemHandler.requestManaExact(stack, player, props.maxMana, false)) {
      burst.setColor(props.color);
      burst.setMana(props.maxMana);
      burst.setStartingMana(props.maxMana);
      burst.setMinManaLoss(props.ticksBeforeManaLoss);
      burst.setManaLossPerTick(props.manaLossPerTick);
      burst.setGravity(props.gravity);
      burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);

      return burst;
    }
    return null;
  }
View Full Code Here

  }

  public void tryShootBurst() {
    if(receiver != null || isRedstone()) {
      if(canShootBurst && (isRedstone() || receiver.canRecieveManaFromBursts() && !receiver.isFull())) {
        EntityManaBurst burst = getBurst(false);
        if(burst != null) {
          if(!worldObj.isRemote) {
            mana -= burst.getStartingMana();
            worldObj.spawnEntityInWorld(burst);
            if(!ConfigHandler.silentSpreaders)
              worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:spreaderFire", 0.2F, 0.7F + 0.3F * (float) Math.random());
          }

View Full Code Here

  public boolean isULTRA_SPREADER() {
    return worldObj == null ? staticUltra : getBlockMetadata() == 3;
  }

  public void checkForReceiver() {
    EntityManaBurst fakeBurst = getBurst(true);
    fakeBurst.setScanBeam();
    TileEntity receiver = fakeBurst.getCollidedTile(true);

    if(receiver != null && receiver instanceof IManaReceiver)
      this.receiver = (IManaReceiver) receiver;
    else this.receiver = null;
    lastTentativeBurst = fakeBurst.propsList;
View Full Code Here

    else this.receiver = null;
    lastTentativeBurst = fakeBurst.propsList;
  }

  public EntityManaBurst getBurst(boolean fake) {
    EntityManaBurst burst = new EntityManaBurst(this, fake);

    boolean dreamwood = isDreamwood();
    boolean ultra = isULTRA_SPREADER();
    int maxMana = ultra ? 640 : dreamwood ? 240 : 160;
    int color = isRedstone() ? 0xFF2020 : dreamwood ? 0xFF45C4 : 0x20FF20;
    int ticksBeforeManaLoss = ultra ? 120 : dreamwood ? 80 : 60;
    float manaLossPerTick = ultra ? 20F : 4F;
    float motionModifier = ultra ? 2F : dreamwood ? 1.25F : 1F;
    float gravity = 0F;
    BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color);

    ItemStack lens = getStackInSlot(0);
    if(lens != null && lens.getItem() instanceof ILensEffect)
      ((ILensEffect) lens.getItem()).apply(lens, props);

    burst.setSourceLens(lens);
    if(getCurrentMana() >= props.maxMana || fake) {
      if(mapmakerOverride) {
        burst.setColor(mmForcedColor);
        burst.setMana(mmForcedManaPayload);
        burst.setStartingMana(mmForcedManaPayload);
        burst.setMinManaLoss(mmForcedTicksBeforeManaLoss);
        burst.setManaLossPerTick(mmForcedManaLossPerTick);
        burst.setGravity(mmForcedGravity);
        burst.setMotion(burst.motionX * mmForcedVelocityMultiplier, burst.motionY * mmForcedVelocityMultiplier, burst.motionZ * mmForcedVelocityMultiplier);
      } else {
        burst.setColor(props.color);
        burst.setMana(props.maxMana);
        burst.setStartingMana(props.maxMana);
        burst.setMinManaLoss(props.ticksBeforeManaLoss);
        burst.setManaLossPerTick(props.manaLossPerTick);
        burst.setGravity(props.gravity);
        burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
      }

      return burst;
    }
    return null;
View Full Code Here

  }

  @Override
  public void onClientDisplayTick() {
    if(worldObj != null) {
      EntityManaBurst burst = getBurst(true);
      burst.getCollidedTile(false);
    }
  }
View Full Code Here

      EntityPlayer player = (EntityPlayer) par3Entity;
      PotionEffect haste = player.getActivePotionEffect(Potion.digSpeed);
      float check = haste == null ? 0.16666667F : haste.getAmplifier() == 1 ? 0.5F : 0.4F;

      if(player.getCurrentEquippedItem() == par1ItemStack && player.swingProgress == check && !par2World.isRemote && par2World.rand.nextInt(2) == 0) {
        EntityManaBurst burst = getBurst(player, par1ItemStack);
        par2World.spawnEntityInWorld(burst);
        ToolCommons.damageItem(par1ItemStack, 1, player, MANA_PER_DAMAGE);
        par2World.playSoundAtEntity(player, "botania:terraBlade", 0.4F, 1.4F);
      }
    }
View Full Code Here

      }
    }
  }

  public EntityManaBurst getBurst(EntityPlayer player, ItemStack stack) {
    EntityManaBurst burst = new EntityManaBurst(player);

    float motionModifier = 7F;

    burst.setColor(0x20FF20);
    burst.setMana(MANA_PER_DAMAGE);
    burst.setStartingMana(MANA_PER_DAMAGE);
    burst.setMinManaLoss(40);
    burst.setManaLossPerTick(4F);
    burst.setGravity(0F);
    burst.setMotion(burst.motionX * motionModifier, burst.motionY * motionModifier, burst.motionZ * motionModifier);

    ItemStack lens = stack.copy();
    ItemNBTHelper.setString(lens, TAG_ATTACKER_USERNAME, player.getCommandSenderName());
    burst.setSourceLens(lens);
    return burst;
  }
View Full Code Here

                ItemNBTHelper.setDouble(copyLens, TAG_HEIGHTSCALE, heightscale);
                ItemNBTHelper.setInt(copyLens, TAG_ITERATION_I, i);
                ItemNBTHelper.setInt(copyLens, TAG_ITERATION_J, j);
                ItemNBTHelper.setInt(copyLens, TAG_ITERATION_K, k);

                EntityManaBurst burst = getBurst(world, x, y, z, copyLens);
                world.spawnEntityInWorld(burst);
                return;
              }
            }
          }
View Full Code Here

TOP

Related Classes of vazkii.botania.common.entity.EntityManaBurst$PositionProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.