codemunching
This commit is contained in:
@@ -22,7 +22,6 @@ import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
|||||||
public class MobMonolith extends EntityFlying implements IMob
|
public class MobMonolith extends EntityFlying implements IMob
|
||||||
{
|
{
|
||||||
private static final short MAX_AGGRO = 200;
|
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_TEXTURE_STATE = 18;
|
||||||
private static final int MAX_SOUND_COOLDOWN = 200;
|
private static final int MAX_SOUND_COOLDOWN = 200;
|
||||||
private static final int MAX_AGGRO_RANGE = 35;
|
private static final int MAX_AGGRO_RANGE = 35;
|
||||||
@@ -35,7 +34,6 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
public float pitchLevel;
|
public float pitchLevel;
|
||||||
private short aggro = 0;
|
private short aggro = 0;
|
||||||
private int soundTime = 0;
|
private int soundTime = 0;
|
||||||
private final short aggroCap;
|
|
||||||
|
|
||||||
private static DDProperties properties = null;
|
private static DDProperties properties = null;
|
||||||
|
|
||||||
@@ -44,7 +42,6 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
super(world);
|
super(world);
|
||||||
this.setSize(WIDTH, HEIGHT);
|
this.setSize(WIDTH, HEIGHT);
|
||||||
this.noClip = true;
|
this.noClip = true;
|
||||||
this.aggroCap = (short) this.rand.nextInt(MAX_AGGRO_CAP + 1);
|
|
||||||
if (properties == null)
|
if (properties == null)
|
||||||
properties = DDProperties.instance();
|
properties = DDProperties.instance();
|
||||||
}
|
}
|
||||||
@@ -58,11 +55,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
@Override
|
@Override
|
||||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||||
{
|
{
|
||||||
if (par1DamageSource == DamageSource.inWall)
|
if (!(par1DamageSource == DamageSource.inWall))
|
||||||
{
|
|
||||||
this.posY = posY + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
this.aggro = MAX_AGGRO;
|
this.aggro = MAX_AGGRO;
|
||||||
}
|
}
|
||||||
@@ -181,32 +174,30 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
// If we're working on the client side, retrieve aggro level from dataWatcher
|
// If we're working on the client side, retrieve aggro level from dataWatcher
|
||||||
if (!this.worldObj.isRemote)
|
if (!this.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
// Server side...
|
//Server side..
|
||||||
// Rapidly increase the aggro level if this Monolith can see the player
|
//aggro constantly decreases at a rate that varies with the current amount of aggro.
|
||||||
if (visibility)
|
if(aggro > 0)
|
||||||
{
|
{
|
||||||
if (this.worldObj.provider instanceof LimboProvider)
|
this.aggro -= (short)(this.aggro/(this.MAX_AGGRO/4));
|
||||||
|
}
|
||||||
|
if(player != null)
|
||||||
{
|
{
|
||||||
aggro++;
|
//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)
|
||||||
|
{
|
||||||
|
//reduce the rate at which aggro increases in limbo
|
||||||
|
if(this.worldObj.provider instanceof LimboProvider)
|
||||||
|
{
|
||||||
|
aggro+=1.5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Aggro increases faster outside of Limbo
|
aggro+=3;
|
||||||
aggro += 4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (aggro >= aggroCap)
|
|
||||||
{
|
|
||||||
// Decrease aggro over time
|
|
||||||
aggro--;
|
|
||||||
}
|
|
||||||
else if (player != null)
|
|
||||||
{
|
|
||||||
// Increase aggro if a player is within range and aggro < aggroCap
|
|
||||||
aggro++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Clamp the aggro level
|
// Clamp the aggro level
|
||||||
aggro = (short) MathHelper.clamp_int(aggro, 0, MAX_AGGRO);
|
aggro = (short) MathHelper.clamp_int(aggro, 0, MAX_AGGRO);
|
||||||
|
|||||||
@@ -75,13 +75,14 @@ public class RenderMobObelisk extends RenderLiving
|
|||||||
|
|
||||||
float f6 = 0.0625F;
|
float f6 = 0.0625F;
|
||||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||||
this.preRenderCallback(par1EntityLivingBase, par9);
|
this.preRenderCallback(par1EntityLivingBase, par9);
|
||||||
GL11.glRotatef(((MobMonolith)par1EntityLivingBase).pitchLevel , 1.0F, 0.0F, 0.0F);
|
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);
|
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
|||||||
Reference in New Issue
Block a user