Added the effects of the most basic lenses.

This commit is contained in:
Vasco Lavos committed 2014-02-01 00:20:09 +00:00
1 parent 1277f1d81b
commit 73d1a1bfe9
5 files changed
+49 -9

No files matched your search

@@ -21,6 +21,8 @@ public interface IManaBurst {
public boolean isFake();
public void setMotion(double x, double y, double z);
public int getColor();
public void setColor(int color);
@@ -20,14 +20,17 @@ public final class BurstProperties {
public int maxMana;
public int ticksBeforeManaLoss;
public float manaLossPerTick;
public int color;
public float gravity;
public float motionModifier;
public BurstProperties(int maxMana, int ticksBeforeManaLoss, float manaLossPerTick, float gravity, int color) {
public int color;
public BurstProperties(int maxMana, int ticksBeforeManaLoss, float manaLossPerTick, float gravity, float motionModifier, int color) {
this.maxMana = maxMana;
this.ticksBeforeManaLoss = ticksBeforeManaLoss;
this.manaLossPerTick = manaLossPerTick;
this.gravity = gravity;
this.motionModifier = motionModifier;
this.color = color;
}
@@ -168,7 +168,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector
Vector3 relative = new Vector3(-0.5, 0, 0);
double angle = Math.acos(clickVector.dotProduct(relative) / (relative.mag() * clickVector.mag())) * 180D / Math.PI;
rotationX = (float) angle + 180;
rotationX = (float) angle + 180F;
if(clickVector.z < 0)
rotationX = 360 - rotationX;
}
@@ -225,8 +225,9 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector
int color = 0x00FF00;
int ticksBeforeManaLoss = 100;
float manaLossPerTick = 2F;
float motionModifier = 1F;
float gravity = 0F;
BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, color);
BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color);
ItemStack lens = getStackInSlot(0);
if(lens != null)
@@ -239,7 +240,8 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector
burst.setStartingMana(props.maxMana);
burst.setMinManaLoss(props.ticksBeforeManaLoss);
burst.setManaLossPerTick(props.manaLossPerTick);
burst.setGravity(gravity);
burst.setGravity(props.gravity);
burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
return burst;
}
@@ -72,9 +72,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
rotationPitch = spreader.rotationY;
float f = 0.4F;
lastXMotion = motionX = (MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
lastYMotion = motionZ = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
lastZMotion = motionY = (MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f) / 2D;
double mx = (MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
double my = (MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f) / 2D;
setMotion(mx, my, mz);
}
float accumulatedManaLoss = 0;
@@ -221,7 +222,6 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
return getGravity();
}
@Override
public boolean isFake() {
return fake;
@@ -324,4 +324,14 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
return null;
}
@Override
public void setMotion(double x, double y, double z) {
motionX = x;
motionY = y;
motionZ = z;
lastXMotion = motionX;
lastYMotion = motionY;
lastZMotion = motionZ;
}
}
@@ -105,6 +105,29 @@ public class ItemLens extends ItemMod implements ILens {
int storedColor = getStoredColor(stack);
if(storedColor != -1)
props.color = getLensColor(stack);
switch(stack.getItemDamage()) {
case 1 : { // Speed
props.motionModifier = 2F;
break;
}
case 2 : { // Potency
props.maxMana *= 2;
break;
}
case 3 : { // Resistance
props.ticksBeforeManaLoss *= 2;
break;
}
case 4 : { // Efficiency
props.manaLossPerTick /= 2F;
break;
}
case 6 : { // Gravity
props.gravity = 0.003F;
break;
}
}
}
@Override