List of usage examples for org.apache.commons.lang3.mutable MutableFloat setValue
@Override public void setValue(final Number value)
From source file:de.sanandrew.mods.claysoldiers.util.soldier.upgrade.misc.UpgradeEnderpearl.java
@Override public void onSoldierAttack(EntityClayMan clayMan, SoldierUpgradeInst upgradeInst, EntityClayMan target, MutableFloat damage) { if (target.getEntityToAttack() == null) { target.setTarget(clayMan);/*from w w w . j av a2s. c o m*/ } if (damage.getValue() >= target.getHealth()) { target.addUpgrade(SoldierUpgrades.getUpgrade(SoldierUpgrades.UPG_ENDERPEARL)); clayMan.heal(clayMan.getMaxHealth()); damage.setValue(0.0F); } upgradeInst.getNbtTag().setShort("ticksActive", (short) 0); }
From source file:de.sanandrew.mods.claysoldiers.util.soldier.upgrade.lefthand.UpgradeEmerald.java
@Override public void getAiMoveSpeed(EntityClayMan clayMan, SoldierUpgradeInst upgradeInst, MutableFloat speed) { Entity target = clayMan.getEntityToAttack(); if (target instanceof EntityLivingBase && !target.isDead && clayMan.canEntityBeSeen(target) && ((EntityLivingBase) target).getHealth() > 0) { float multiplier = Math.min(1.0F, Math.max(-1.0F, (float) clayMan.getDistanceSqToEntity(target) - 16.0F)); speed.setValue(speed.getValue() * multiplier); }/*from w w w.ja v a2 s . co m*/ }
From source file:de.sanandrew.mods.particledeco.tileentity.TileEntityParticleBox.java
private void changeDirection(MutableFloat motionX, MutableFloat motionY, MutableFloat motionZ) { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()); switch (this.particleData.particleSpread) { case SPREADED_FOUR_DIAG: int ticksMod = this.ticksExisted % 5; if (ticksMod != 0) { float facingMulti = 0.025F - (ticksMod % 2) * 0.05F; motionX.setValue(0.05F * dir.offsetX + facingMulti * (ticksMod < 3 ? dir.offsetY : dir.offsetZ)); motionY.setValue(0.05F * dir.offsetY + facingMulti * (ticksMod < 3 ? dir.offsetZ : dir.offsetX)); motionZ.setValue(0.05F * dir.offsetZ + facingMulti * (ticksMod < 3 ? dir.offsetX : dir.offsetY)); } else {/*www. ja va 2s . co m*/ motionX.setValue(0.075F * dir.offsetX); motionY.setValue(0.075F * dir.offsetY); motionZ.setValue(0.075F * dir.offsetZ); } break; case STRAIGHT_UP: motionX.setValue(0.075F * dir.offsetX); motionY.setValue(0.075F * dir.offsetY); motionZ.setValue(0.075F * dir.offsetZ); break; } }
From source file:com.norconex.collector.http.robot.impl.DefaultRobotsTxtProvider.java
private void parseAgentLines(String baseURL, List<IURLFilter> filters, MutableFloat crawlDelay, String key, String value) {//from ww w . java 2s. c o m if ("disallow".equalsIgnoreCase(key)) { filters.add(buildURLFilter(baseURL, value, OnMatch.EXCLUDE)); } else if ("allow".equalsIgnoreCase(key)) { filters.add(buildURLFilter(baseURL, value, OnMatch.INCLUDE)); } else if ("crawl-delay".equalsIgnoreCase(key)) { crawlDelay.setValue(NumberUtils.toFloat(value, crawlDelay.floatValue())); } //note that sitemap directives are handled by ISitemapsResolver }
From source file:de.sanandrew.mods.turretmod.entity.projectile.EntityProjectileLaser.java
@Override public boolean onPreHit(Entity e, DamageSource dmgSource, MutableFloat dmg) { if (super.onPreHit(e, dmgSource, dmg)) { if (e instanceof EntityLivingBase) { EntityLivingBase elb = ((EntityLivingBase) e); if (!(this.shooterCache instanceof ITurretInst && ((ITurretInst) this.shooterCache) .getUpgradeProcessor().hasUpgrade(Upgrades.ENDER_MEDIUM))) { if (elb.isImmuneToFire()) { return false; }/* w ww. j a v a2 s. c o m*/ } else { if (!elb.isImmuneToFire()) { dmg.setValue(dmg.floatValue() * 1.25F); } } this.prevMaxHurtResistantTime = elb.maxHurtResistantTime; elb.maxHurtResistantTime = 10; } return true; } else { return false; } }