From aab818d9481e62f58d0369da3edb875f2f30ea83 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Tue, 6 May 2014 02:23:03 -0400 Subject: [PATCH 1/2] codemunching --- .../mod_pocketDim/ticking/MobMonolith.java | 51 ++++++++----------- .../mod_pocketDimClient/RenderMobObelisk.java | 5 +- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java index ea654927..8e047b14 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java @@ -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) - { - // Decrease aggro over time - aggro--; - } - else if (player != null) - { - // Increase aggro if a player is within range and aggro < aggroCap - 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 + { + aggro+=3; + } } } // Clamp the aggro level diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java index d0335095..dc35abd0 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java @@ -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); From 79edf1004b4de0f786d28d623cb9dcc2a999b57c Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Tue, 6 May 2014 03:08:46 -0400 Subject: [PATCH 2/2] tweak --- .../mod_pocketDim/ticking/MobMonolith.java | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java index 8e047b14..4428f63d 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java @@ -22,6 +22,7 @@ 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 = 100; private static final int MAX_TEXTURE_STATE = 18; private static final int MAX_SOUND_COOLDOWN = 200; private static final int MAX_AGGRO_RANGE = 35; @@ -34,6 +35,7 @@ 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; @@ -42,6 +44,7 @@ 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)+20); if (properties == null) properties = DDProperties.instance(); } @@ -55,7 +58,7 @@ public class MobMonolith extends EntityFlying implements IMob @Override public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { - if (!(par1DamageSource == DamageSource.inWall)) + if (par1DamageSource != DamageSource.inWall) { this.aggro = MAX_AGGRO; } @@ -90,7 +93,7 @@ public class MobMonolith extends EntityFlying implements IMob protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setAttribute(10); + this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setAttribute(57005); } @Override @@ -174,29 +177,31 @@ 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.. - //aggro constantly decreases at a rate that varies with the current amount of aggro. - if(aggro > 0) + // Server side... + // Rapidly increase the aggro level if this Monolith can see the player + if (visibility) { - this.aggro -= (short)(this.aggro/(this.MAX_AGGRO/4)); + if (this.worldObj.provider instanceof LimboProvider) + { + aggro++; + } + else + { + // Aggro increases faster outside of Limbo + aggro += 4; + } } - if(player != null) + else { - //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 - { - aggro+=3; - } + if (aggro > aggroCap) + { + // Decrease aggro over time + aggro--; + } + else if (player != null && (aggro < aggroCap)) + { + // Increase aggro if a player is within range and aggro < aggroCap + aggro++; } } // Clamp the aggro level