codemunching

This commit is contained in:
StevenRS11
2014-05-06 02:23:03 -04:00
committed by SenseiKiwi
parent f427e66f6e
commit f4efa7dca2
2 changed files with 24 additions and 32 deletions

View File

@@ -22,7 +22,6 @@ import StevenDimDoors.mod_pocketDim.world.PocketProvider;
public class MobMonolith extends EntityFlying implements IMob
{
private static final short MAX_AGGRO = 200;
private static final short MAX_AGGRO_CAP = 60;
private static final int MAX_TEXTURE_STATE = 18;
private static final int MAX_SOUND_COOLDOWN = 200;
private static final int MAX_AGGRO_RANGE = 35;
@@ -35,7 +34,6 @@ public class MobMonolith extends EntityFlying implements IMob
public float pitchLevel;
private short aggro = 0;
private int soundTime = 0;
private final short aggroCap;
private static DDProperties properties = null;
@@ -44,7 +42,6 @@ public class MobMonolith extends EntityFlying implements IMob
super(world);
this.setSize(WIDTH, HEIGHT);
this.noClip = true;
this.aggroCap = (short) this.rand.nextInt(MAX_AGGRO_CAP + 1);
if (properties == null)
properties = DDProperties.instance();
}
@@ -58,11 +55,7 @@ public class MobMonolith extends EntityFlying implements IMob
@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
if (par1DamageSource == DamageSource.inWall)
{
this.posY = posY + 1;
}
else
if (!(par1DamageSource == DamageSource.inWall))
{
this.aggro = MAX_AGGRO;
}
@@ -181,31 +174,29 @@ public class MobMonolith extends EntityFlying implements IMob
// If we're working on the client side, retrieve aggro level from dataWatcher
if (!this.worldObj.isRemote)
{
// Server side...
// Rapidly increase the aggro level if this Monolith can see the player
if (visibility)
//Server side..
//aggro constantly decreases at a rate that varies with the current amount of aggro.
if(aggro > 0)
{
if (this.worldObj.provider instanceof LimboProvider)
{
aggro++;
}
else
{
// Aggro increases faster outside of Limbo
aggro += 4;
}
this.aggro -= (short)(this.aggro/(this.MAX_AGGRO/4));
}
else
if(player != null)
{
if (aggro >= aggroCap)
//monoliths increase aggro slightly if the player is near, but slowly and to a cap.
aggro+= 1.5-(this.getDistanceToEntity(player)/this.MAX_AGGRO_RANGE);
//rapidly increase aggro if the monolith has line of sight to the player.
if(visibility)
{
// Decrease aggro over time
aggro--;
}
else if (player != null)
{
// Increase aggro if a player is within range and aggro < aggroCap
aggro++;
//reduce the rate at which aggro increases in limbo
if(this.worldObj.provider instanceof LimboProvider)
{
aggro+=1.5;
}
else
{
aggro+=3;
}
}
}
// Clamp the aggro level

View File

@@ -75,13 +75,14 @@ public class RenderMobObelisk extends RenderLiving
float f6 = 0.0625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(-1.0F, -1.0F, 1.0F);
this.preRenderCallback(par1EntityLivingBase, par9);
GL11.glRotatef(((MobMonolith)par1EntityLivingBase).pitchLevel , 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, 24.0F * f6 - 0.0078125F, 0.0F);
GL11.glTranslatef(0.0F, -24.0F * f6 - 0.0078125F, 0.0F);
this.renderModel(par1EntityLivingBase, 0, 0, rotation, interpolatedYawHead - interpolatedYaw, pitch, f6);
this.renderModel(par1EntityLivingBase, 0, 0, rotation, interpolatedYaw, pitch, f6);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);