Improved Monolith Jitter #130
@@ -241,13 +241,13 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
|
|
||||||
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
|
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
|
||||||
{
|
{
|
||||||
if(!(par1DamageSource == DamageSource.inWall))
|
if (par1DamageSource == DamageSource.inWall)
|
||||||
{
|
{
|
||||||
this.aggro=400;
|
this.posY = posY + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.posY=posY+1;
|
this.aggro = this.aggroMax;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import org.lwjgl.opengl.GL12;
|
|||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
@@ -32,8 +33,23 @@ public class RenderMobObelisk extends RenderLiving
|
|||||||
|
|
||||||
public void doRenderLiving(EntityLiving entity, double x, double y, double z, float par8, float par9)
|
public void doRenderLiving(EntityLiving entity, double x, double y, double z, float par8, float par9)
|
||||||
{
|
{
|
||||||
int noiseFactor = (int) (50-Math.log(MobMonolith.class.cast(entity).aggro));
|
final float minScaling = 0;
|
||||||
this.render(entity, x+entity.worldObj.rand.nextGaussian()/noiseFactor, y+entity.worldObj.rand.nextGaussian()/noiseFactor, z+entity.worldObj.rand.nextGaussian()/noiseFactor, par8, par9);
|
final float maxScaling = 0.1f;
|
||||||
|
final int maxAggroLevel = 500;
|
||||||
|
MobMonolith monolith = ((MobMonolith) entity);
|
||||||
|
|
||||||
|
// Use linear interpolation to scale how much jitter we want for our given aggro level
|
||||||
|
float aggroScaling = minScaling + monolith.aggro * (maxScaling - minScaling) / maxAggroLevel;
|
||||||
|
|
||||||
|
// Calculate jitter - include entity ID to give Monoliths individual jitters
|
||||||
|
float time = ((Minecraft.getSystemTime() + 0xF1234568 * monolith.entityId) % 200000) / 50.0F;
|
||||||
|
// We use random constants here on purpose just to get different wave forms
|
||||||
|
double xJitter = aggroScaling * Math.sin(1.1f * time) * Math.sin(0.8f * time);
|
||||||
|
double yJitter = aggroScaling * Math.sin(1.2f * time) * Math.sin(0.9f * time);
|
||||||
|
double zJitter = aggroScaling * Math.sin(1.3f * time) * Math.sin(0.7f * time);
|
||||||
|
|
||||||
|
// Render with jitter
|
||||||
|
this.render(entity, x + xJitter, y + yJitter, z + zJitter, par8, par9);
|
||||||
this.func_110827_b(entity, x, y, z, par8, par9);
|
this.func_110827_b(entity, x, y, z, par8, par9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user