Fixed a major lag source and a really weird issue with the prediction beam going crazy all over the place.

This commit is contained in:
Vasco Lavos committed 2014-01-31 19:41:36 +00:00
1 parent 13617a072c
commit 622d882c30
3 files changed
+14 -6

No files matched your search

@@ -101,7 +101,6 @@ public class SubTileGenerating extends SubTileEntity {
if(!collector.isFull()) {
collector.recieveMana(mana);
mana = 0;
PacketDispatcher.sendPacketToAllInDimension(linkedCollector.getDescriptionPacket(), supertile.worldObj.provider.dimensionId);
}
}
}
@@ -46,7 +46,6 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector
private static final int MAX_MANA = 1000;
private static final String TAG_MANA = "mana";
private static final String TAG_CAN_SHOOT = "canShoot";
private static final String TAG_KNOWN_MANA = "knownMana";
private static final String TAG_ROTATION_X = "rotationX";
private static final String TAG_ROTATION_Y = "rotationY";
@@ -40,6 +40,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
private static final String TAG_SPREADER_Z = "spreaderZ";
private static final String TAG_GRAVITY = "gravity";
double lastXMotion, lastYMotion, lastZMotion;
boolean fake = false;
final int dataWatcherEntries = 10;
@@ -70,9 +72,9 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
rotationPitch = spreader.rotationY;
float f = 0.4F;
motionX = (MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
motionZ = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
motionY = (MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f) / 2D;
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;
}
float accumulatedManaLoss = 0;
@@ -80,6 +82,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
@Override
public void onUpdate() {
try {
motionX = lastXMotion;
motionY = lastYMotion;
motionZ = lastZMotion;
super.onUpdate();
ILens lens = getLensInstance();
@@ -98,8 +104,12 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
if(getMana() <= 0)
setDead();
}
} catch(NullPointerException e) {
lastXMotion = motionX;
lastYMotion = motionY;
lastZMotion = motionZ;
} catch(NullPointerException e) {
// Apparently this can happen on some weird occasions on clients.
}
}