Initial 1.11.2 update

This commit is contained in:
Electroblob
2018-02-07 21:15:50 +00:00
parent 67f6be0671
commit 3df5597dcc
368 changed files with 17234 additions and 15082 deletions
@@ -33,264 +33,243 @@ public class EntityIceWraith extends EntityBlazeMinion {
super(world, x, y, z, caster, lifetime);
this.isImmuneToFire = false;
}
@Override
protected void initEntityAI(){
super.initEntityAI();
this.tasks.taskEntries.clear();
this.tasks.addTask(4, new AIIceShardAttack(this));
this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(8, new EntityAILookIdle(this));
this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(8, new EntityAILookIdle(this));
}
@Override
protected void spawnParticleEffect() {
if(this.worldObj.isRemote){
for(int i=0;i<15;i++){
float brightness = 0.5f + (rand.nextFloat()/2);
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, worldObj, this.posX - 0.5d + rand.nextDouble(), this.posY + this.height/2 - 0.5d + rand.nextDouble(), this.posZ - 0.5d + rand.nextDouble(), 0, 0.05f, 0, 20 + rand.nextInt(10), brightness, brightness + 0.1f, 1.0f);
protected void spawnParticleEffect(){
if(this.world.isRemote){
for(int i = 0; i < 15; i++){
float brightness = 0.5f + (rand.nextFloat() / 2);
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARKLE, world, this.posX - 0.5d + rand.nextDouble(),
this.posY + this.height / 2 - 0.5d + rand.nextDouble(), this.posZ - 0.5d + rand.nextDouble(), 0,
0.05f, 0, 20 + rand.nextInt(10), brightness, brightness + 0.1f, 1.0f);
}
}
}
@Override
public void onLivingUpdate(){
if(!this.onGround && this.motionY < 0.0D){
this.motionY *= 0.6D;
}
if(this.rand.nextInt(24) == 0){
this.playSound(WizardrySounds.SPELL_LOOP_WIND, 0.3F + this.rand.nextFloat()/4, this.rand.nextFloat() * 0.7F + 1.4F);
this.motionY *= 0.6D;
}
if(this.worldObj.isRemote){
if(this.rand.nextInt(24) == 0){
this.playSound(WizardrySounds.SPELL_LOOP_WIND, 0.3F + this.rand.nextFloat() / 4,
this.rand.nextFloat() * 0.7F + 1.4F);
}
if(this.world.isRemote){
for(int i = 0; i < 2; ++i){
this.worldObj.spawnParticle(EnumParticleTypes.CLOUD, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0D, 0.0D, 0.0D);
this.world.spawnParticle(EnumParticleTypes.CLOUD,
this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width,
this.posY + this.rand.nextDouble() * (double)this.height,
this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0D, 0.0D, 0.0D);
}
}
// Replaces super call.
this.livingBaseUpdate();
}
/** Copied from {@link EntityLivingBase#onLivingUpdate()}. The only change is removal of the updateElytra() call
* since that's irrelevant here. In actual fact, neither EntityMob nor EntityLiving has any code in its version
* of this method that is of use. This isn't exactly ideal, but it's the lesser of two evils since the
* alternative is copying the entire EntityBlaze class and its renderer. All to remove one particle effect... */
/**
* Copied from {@link EntityLivingBase#onLivingUpdate()}. The only change is removal of the updateElytra() call
* since that's irrelevant here. In actual fact, neither EntityMob nor EntityLiving has any code in its version of
* this method that is of use. This isn't exactly ideal, but it's the lesser of two evils since the alternative is
* copying the entire EntityBlaze class and its renderer. All to remove one particle effect...
*/
// ... demonstrating why critical methods should delegate any non-critical functionality (like particles) to
// separate protected methods.
private void livingBaseUpdate(){
if (this.jumpTicks > 0)
{
--this.jumpTicks;
}
if (this.newPosRotationIncrements > 0 && !this.canPassengerSteer())
{
double d0 = this.posX + (this.interpTargetX - this.posX) / (double)this.newPosRotationIncrements;
double d1 = this.posY + (this.interpTargetY - this.posY) / (double)this.newPosRotationIncrements;
double d2 = this.posZ + (this.interpTargetZ - this.posZ) / (double)this.newPosRotationIncrements;
double d3 = MathHelper.wrapDegrees(this.interpTargetYaw - (double)this.rotationYaw);
this.rotationYaw = (float)((double)this.rotationYaw + d3 / (double)this.newPosRotationIncrements);
this.rotationPitch = (float)((double)this.rotationPitch + (this.interpTargetPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements);
--this.newPosRotationIncrements;
this.setPosition(d0, d1, d2);
this.setRotation(this.rotationYaw, this.rotationPitch);
}
else if (!this.isServerWorld())
{
this.motionX *= 0.98D;
this.motionY *= 0.98D;
this.motionZ *= 0.98D;
}
if(this.jumpTicks > 0){
--this.jumpTicks;
}
if (Math.abs(this.motionX) < 0.003D)
{
this.motionX = 0.0D;
}
if(this.newPosRotationIncrements > 0 && !this.canPassengerSteer()){
double d0 = this.posX + (this.interpTargetX - this.posX) / (double)this.newPosRotationIncrements;
double d1 = this.posY + (this.interpTargetY - this.posY) / (double)this.newPosRotationIncrements;
double d2 = this.posZ + (this.interpTargetZ - this.posZ) / (double)this.newPosRotationIncrements;
double d3 = MathHelper.wrapDegrees(this.interpTargetYaw - (double)this.rotationYaw);
this.rotationYaw = (float)((double)this.rotationYaw + d3 / (double)this.newPosRotationIncrements);
this.rotationPitch = (float)((double)this.rotationPitch
+ (this.interpTargetPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements);
--this.newPosRotationIncrements;
this.setPosition(d0, d1, d2);
this.setRotation(this.rotationYaw, this.rotationPitch);
}else if(!this.isServerWorld()){
this.motionX *= 0.98D;
this.motionY *= 0.98D;
this.motionZ *= 0.98D;
}
if (Math.abs(this.motionY) < 0.003D)
{
this.motionY = 0.0D;
}
if(Math.abs(this.motionX) < 0.003D){
this.motionX = 0.0D;
}
if (Math.abs(this.motionZ) < 0.003D)
{
this.motionZ = 0.0D;
}
if(Math.abs(this.motionY) < 0.003D){
this.motionY = 0.0D;
}
this.worldObj.theProfiler.startSection("ai");
if(Math.abs(this.motionZ) < 0.003D){
this.motionZ = 0.0D;
}
if (this.isMovementBlocked())
{
this.isJumping = false;
this.moveStrafing = 0.0F;
this.moveForward = 0.0F;
this.randomYawVelocity = 0.0F;
}
else if (this.isServerWorld())
{
this.worldObj.theProfiler.startSection("newAi");
this.updateEntityActionState();
this.worldObj.theProfiler.endSection();
}
this.world.theProfiler.startSection("ai");
this.worldObj.theProfiler.endSection();
this.worldObj.theProfiler.startSection("jump");
if(this.isMovementBlocked()){
this.isJumping = false;
this.moveStrafing = 0.0F;
this.moveForward = 0.0F;
this.randomYawVelocity = 0.0F;
}else if(this.isServerWorld()){
this.world.theProfiler.startSection("newAi");
this.updateEntityActionState();
this.world.theProfiler.endSection();
}
if (this.isJumping)
{
if (this.isInWater())
{
this.handleJumpWater();
}
else if (this.isInLava())
{
this.handleJumpLava();
}
else if (this.onGround && this.jumpTicks == 0)
{
this.jump();
this.jumpTicks = 10;
}
}
else
{
this.jumpTicks = 0;
}
this.world.theProfiler.endSection();
this.world.theProfiler.startSection("jump");
this.worldObj.theProfiler.endSection();
this.worldObj.theProfiler.startSection("travel");
this.moveStrafing *= 0.98F;
this.moveForward *= 0.98F;
this.randomYawVelocity *= 0.9F;
this.moveEntityWithHeading(this.moveStrafing, this.moveForward);
this.worldObj.theProfiler.endSection();
this.worldObj.theProfiler.startSection("push");
this.collideWithNearbyEntities();
this.worldObj.theProfiler.endSection();
if(this.isJumping){
if(this.isInWater()){
this.handleJumpWater();
}else if(this.isInLava()){
this.handleJumpLava();
}else if(this.onGround && this.jumpTicks == 0){
this.jump();
this.jumpTicks = 10;
}
}else{
this.jumpTicks = 0;
}
this.world.theProfiler.endSection();
this.world.theProfiler.startSection("travel");
this.moveStrafing *= 0.98F;
this.moveForward *= 0.98F;
this.randomYawVelocity *= 0.9F;
this.moveEntityWithHeading(this.moveStrafing, this.moveForward);
this.world.theProfiler.endSection();
this.world.theProfiler.startSection("push");
this.collideWithNearbyEntities();
this.world.theProfiler.endSection();
}
@Override
public boolean attackEntityFrom(DamageSource source, float amount){
// Removes the damage from being wet that applies to blazes by checking if the mob is actually drowning.
if(source == DamageSource.drown && (this.getAir() > 0 || this.isPotionActive(MobEffects.WATER_BREATHING))){
if(source == DamageSource.DROWN && (this.getAir() > 0 || this.isPotionActive(MobEffects.WATER_BREATHING))){
// In this case, the ice wraith is not actually drowning, so cancel the damage.
return false;
}else{
return super.attackEntityFrom(source, amount);
}
}
@Override
public boolean isBurning(){
// Uses the datawatcher on both sides because fire is private to Entity (and I'm not using reflection here).
// TESTME: This should work, but there may be some issues with updating, so if it doesn't work, copy the
// TESTME: This should work, but there may be some issues with updating, so if it doesn't work, copy the
// version from Entity and use reflection to access the fire field.
return this.getFlag(0);
}
}
/** Copied straight from EntityBlaze.AIFireballAttack, with the only changes being replacement of fireball
* spawning with a one-liner call to WizardryRegistry.iceShard.cast(...) and the removal of redundant local variables. */
/**
* Copied straight from EntityBlaze.AIFireballAttack, with the only changes being replacement of fireball spawning
* with a one-liner call to WizardryRegistry.iceShard.cast(...) and the removal of redundant local variables.
*/
static class AIIceShardAttack extends EntityAIBase {
private final EntityBlaze blaze;
private int attackStep;
private int attackTime;
public AIIceShardAttack(EntityBlaze blazeIn)
{
this.blaze = blazeIn;
this.setMutexBits(3);
}
private final EntityBlaze blaze;
private int attackStep;
private int attackTime;
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute()
{
EntityLivingBase entitylivingbase = this.blaze.getAttackTarget();
return entitylivingbase != null && entitylivingbase.isEntityAlive();
}
public AIIceShardAttack(EntityBlaze blazeIn){
this.blaze = blazeIn;
this.setMutexBits(3);
}
/**
* Execute a one shot task or start executing a continuous task
*/
public void startExecuting()
{
this.attackStep = 0;
}
/**
* Returns whether the EntityAIBase should begin execution.
*/
public boolean shouldExecute(){
EntityLivingBase entitylivingbase = this.blaze.getAttackTarget();
return entitylivingbase != null && entitylivingbase.isEntityAlive();
}
/**
* Resets the task
*/
public void resetTask()
{
// This might be called setOnFire, but what it really controls is whether the wraith is in attack mode.
this.blaze.setOnFire(false);
}
/**
* Execute a one shot task or start executing a continuous task
*/
public void startExecuting(){
this.attackStep = 0;
}
/**
* Updates the task
*/
public void updateTask()
{
--this.attackTime;
EntityLivingBase entitylivingbase = this.blaze.getAttackTarget();
double d0 = this.blaze.getDistanceSqToEntity(entitylivingbase);
/**
* Resets the task
*/
public void resetTask(){
// This might be called setOnFire, but what it really controls is whether the wraith is in attack mode.
this.blaze.setOnFire(false);
}
if (d0 < 4.0D)
{
if (this.attackTime <= 0)
{
this.attackTime = 20;
this.blaze.attackEntityAsMob(entitylivingbase);
}
/**
* Updates the task
*/
public void updateTask(){
--this.attackTime;
EntityLivingBase entitylivingbase = this.blaze.getAttackTarget();
double d0 = this.blaze.getDistanceSqToEntity(entitylivingbase);
this.blaze.getMoveHelper().setMoveTo(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, 1.0D);
}
else if (d0 < 256.0D)
{
if (this.attackTime <= 0)
{
++this.attackStep;
if(d0 < 4.0D){
if(this.attackTime <= 0){
this.attackTime = 20;
this.blaze.attackEntityAsMob(entitylivingbase);
}
if (this.attackStep == 1)
{
this.attackTime = 60;
this.blaze.setOnFire(true);
}
else if (this.attackStep <= 4)
{
this.attackTime = 6;
}
else
{
this.attackTime = 100;
this.attackStep = 0;
this.blaze.setOnFire(false);
}
this.blaze.getMoveHelper().setMoveTo(entitylivingbase.posX, entitylivingbase.posY,
entitylivingbase.posZ, 1.0D);
}else if(d0 < 256.0D){
if(this.attackTime <= 0){
++this.attackStep;
if(this.attackStep > 1){
// Proof, if it were at all needed, of the elegance and versatility of the spell system.
Spells.ice_shard.cast(this.blaze.worldObj, this.blaze, EnumHand.MAIN_HAND, 0, entitylivingbase, new SpellModifiers());
// TODO: Decide if an event should be fired here. I'm guessing no.
}
}
if(this.attackStep == 1){
this.attackTime = 60;
this.blaze.setOnFire(true);
}else if(this.attackStep <= 4){
this.attackTime = 6;
}else{
this.attackTime = 100;
this.attackStep = 0;
this.blaze.setOnFire(false);
}
this.blaze.getLookHelper().setLookPositionWithEntity(entitylivingbase, 10.0F, 10.0F);
}
else
{
this.blaze.getNavigator().clearPathEntity();
this.blaze.getMoveHelper().setMoveTo(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, 1.0D);
}
if(this.attackStep > 1){
// Proof, if it were at all needed, of the elegance and versatility of the spell system.
Spells.ice_shard.cast(this.blaze.world, this.blaze, EnumHand.MAIN_HAND, 0, entitylivingbase,
new SpellModifiers());
// TODO: Decide if an event should be fired here. I'm guessing no.
}
}
super.updateTask();
}
}
this.blaze.getLookHelper().setLookPositionWithEntity(entitylivingbase, 10.0F, 10.0F);
}else{
this.blaze.getNavigator().clearPathEntity();
this.blaze.getMoveHelper().setMoveTo(entitylivingbase.posX, entitylivingbase.posY,
entitylivingbase.posZ, 1.0D);
}
super.updateTask();
}
}
}