Initial stab at 1.11

About halfway.
This commit is contained in:
Nicholas Ignoffo 2016-12-12 19:56:36 -08:00
parent ce52aea512
commit 00d6f8eb46
157 changed files with 1036 additions and 1554 deletions

View file

@ -37,12 +37,12 @@ public class EntityAIAttackRangedBow extends EntityAIBase
*/
public boolean shouldExecute()
{
return this.entity.getAttackTarget() == null ? false : this.isBowInMainhand();
return this.entity.getAttackTarget() != null && this.isBowInMainhand();
}
protected boolean isBowInMainhand()
{
return this.entity.getHeldItemMainhand() != null && this.entity.getHeldItemMainhand().getItem() instanceof ItemBow;
return this.entity.getHeldItemMainhand().getItem() instanceof ItemBow;
}
/**

View file

@ -37,7 +37,7 @@ public class EntityAIAttackStealthMelee extends EntityAIBase
public EntityAIAttackStealthMelee(EntityCorruptedChicken creature, double speedIn, boolean useLongMemory)
{
this.chicken = creature;
this.worldObj = creature.worldObj;
this.worldObj = creature.getEntityWorld();
this.speedTowardsTarget = speedIn;
this.longMemory = useLongMemory;
this.setMutexBits(3);

View file

@ -20,7 +20,7 @@ public class EntityAIEatAndCorruptBlock extends EntityAIBase
public EntityAIEatAndCorruptBlock(EntityAspectedDemonBase entity)
{
this.grassEaterEntity = entity;
this.world = entity.worldObj;
this.world = entity.getEntityWorld();
this.setMutexBits(7);
}

View file

@ -29,7 +29,7 @@ public class EntityAIFollowOwner extends EntityAIBase
public EntityAIFollowOwner(EntityDemonBase thePetIn, double followSpeedIn, float minDistIn, float maxDistIn)
{
this.thePet = thePetIn;
this.theWorld = thePetIn.worldObj;
this.theWorld = thePetIn.getEntityWorld();
this.followSpeed = followSpeedIn;
this.petPathfinder = thePetIn.getNavigator();
this.minDist = minDistIn;
@ -100,7 +100,7 @@ public class EntityAIFollowOwner extends EntityAIBase
{
IBlockState iblockstate = this.theWorld.getBlockState(pos);
Block block = iblockstate.getBlock();
return block == Blocks.AIR ? true : !iblockstate.isFullCube();
return block == Blocks.AIR || !iblockstate.isFullCube();
}
/**
@ -122,9 +122,9 @@ public class EntityAIFollowOwner extends EntityAIBase
{
if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)
{
int i = MathHelper.floor_double(this.theOwner.posX) - 2;
int j = MathHelper.floor_double(this.theOwner.posZ) - 2;
int k = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY);
int i = MathHelper.floor(this.theOwner.posX) - 2;
int j = MathHelper.floor(this.theOwner.posZ) - 2;
int k = MathHelper.floor(this.theOwner.getEntityBoundingBox().minY);
for (int l = 0; l <= 4; ++l)
{

View file

@ -32,7 +32,7 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase
public EntityAIGrabEffectsFromOwner(EntitySentientSpecter thePetIn, double followSpeedIn, float minDistIn)
{
this.thePet = thePetIn;
this.theWorld = thePetIn.worldObj;
this.theWorld = thePetIn.getEntityWorld();
this.followSpeed = followSpeedIn;
this.petPathfinder = thePetIn.getNavigator();
this.minDist = minDistIn;
@ -105,7 +105,7 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase
{
IBlockState iblockstate = this.theWorld.getBlockState(pos);
Block block = iblockstate.getBlock();
return block == Blocks.AIR ? true : !iblockstate.isFullCube();
return block == Blocks.AIR || !iblockstate.isFullCube();
}
/**
@ -135,9 +135,9 @@ public class EntityAIGrabEffectsFromOwner extends EntityAIBase
{
if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)
{
int i = MathHelper.floor_double(this.theOwner.posX) - 2;
int j = MathHelper.floor_double(this.theOwner.posZ) - 2;
int k = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY);
int i = MathHelper.floor(this.theOwner.posX) - 2;
int j = MathHelper.floor(this.theOwner.posZ) - 2;
int k = MathHelper.floor(this.theOwner.getEntityBoundingBox().minY);
for (int l = 0; l <= 4; ++l)
{

View file

@ -40,7 +40,7 @@ public class EntityAIPickUpAlly extends EntityAIBase
public EntityAIPickUpAlly(EntityAspectedDemonBase creature, double speedIn, boolean useLongMemory)
{
this.entity = creature;
this.worldObj = creature.worldObj;
this.worldObj = creature.getEntityWorld();
this.speedTowardsTarget = speedIn;
this.longMemory = useLongMemory;
this.setMutexBits(3);
@ -57,7 +57,7 @@ public class EntityAIPickUpAlly extends EntityAIBase
}
AxisAlignedBB bb = new AxisAlignedBB(entity.posX - 0.5, entity.posY - 0.5, entity.posZ - 0.5, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5).expandXyz(5);
List<EntityLivingBase> list = this.entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bb, new EntityAspectedDemonBase.WillTypePredicate(entity.getType()));
List<EntityLivingBase> list = this.entity.getEntityWorld().getEntitiesWithinAABB(EntityLivingBase.class, bb, new EntityAspectedDemonBase.WillTypePredicate(entity.getType()));
for (EntityLivingBase testEntity : list)
{
if (testEntity != this.entity)

View file

@ -21,7 +21,7 @@ public class EntityAIProtectAlly extends EntityAIBase
public EntityAIProtectAlly(EntityCorruptedSheep entity)
{
this.entity = entity;
this.world = entity.worldObj;
this.world = entity.getEntityWorld();
this.setMutexBits(7);
}

View file

@ -69,7 +69,7 @@ public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase
}
//This part almost doesn't matter
List<T> list = this.theEntity.worldObj.<T>getEntitiesWithinAABB(this.classToAvoid, this.theEntity.getEntityBoundingBox().expand((double) this.avoidDistance, 3.0D, (double) this.avoidDistance), Predicates.and(new Predicate[] { EntitySelectors.CAN_AI_TARGET, this.canBeSeenSelector, this.avoidTargetSelector }));
List<T> list = this.theEntity.getEntityWorld().<T>getEntitiesWithinAABB(this.classToAvoid, this.theEntity.getEntityBoundingBox().expand((double) this.avoidDistance, 3.0D, (double) this.avoidDistance), Predicates.and(new Predicate[] { EntitySelectors.CAN_AI_TARGET, this.canBeSeenSelector, this.avoidTargetSelector }));
if (list.isEmpty())
{

View file

@ -82,7 +82,7 @@ public class EntityAIStealthRetreat extends EntityAIBase
@Override
public void startExecuting()
{
ticksLeft = this.entity.worldObj.rand.nextInt(100) + 100;
ticksLeft = this.entity.getEntityWorld().rand.nextInt(100) + 100;
this.entityPathNavigate.setPath(this.entityPathEntity, this.farSpeed);
}

View file

@ -47,7 +47,7 @@ public class EntityAIStealthTowardsTarget extends EntityAIBase
return false;
} else
{
ticksLeft = this.entity.worldObj.rand.nextInt(200) + 100;
ticksLeft = this.entity.getEntityWorld().rand.nextInt(200) + 100;
this.xPosition = vec3d.xCoord;
this.yPosition = vec3d.yCoord;
this.zPosition = vec3d.zCoord;
@ -75,7 +75,7 @@ public class EntityAIStealthTowardsTarget extends EntityAIBase
if (this.entity.getNavigator().noPath())
{
EntityLivingBase target = this.entity.getAttackTarget();
Vec3d vec3d = null;
Vec3d vec3d;
if (target instanceof EntityCreature)
{
vec3d = RandomPositionGenerator.findRandomTarget((EntityCreature) target, 10, 7);

View file

@ -180,15 +180,15 @@ public abstract class EntityAspectedDemonBase extends EntityDemonBase
float newAmount = amount;
if (source.isProjectile())
{
newAmount *= MathHelper.clamp_double(1 - getProjectileResist(), 0, 1);
newAmount *= MathHelper.clamp(1 - getProjectileResist(), 0, 1);
} else
{
newAmount *= MathHelper.clamp_double(1 - getMeleeResist(), 0, 1);
newAmount *= MathHelper.clamp(1 - getMeleeResist(), 0, 1);
}
if (source.isMagicDamage())
{
newAmount *= MathHelper.clamp_double(1 - getMagicResist(), 0, 1);
newAmount *= MathHelper.clamp(1 - getMagicResist(), 0, 1);
}
return super.attackEntityFrom(source, newAmount);

View file

@ -139,7 +139,7 @@ public class EntityCorruptedChicken extends EntityAspectedDemonBase
this.oFlap = this.wingRotation;
this.oFlapSpeed = this.destPos;
this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1 : 4) * 0.3D);
this.destPos = MathHelper.clamp_float(this.destPos, 0.0F, 1.0F);
this.destPos = MathHelper.clamp(this.destPos, 0.0F, 1.0F);
if (!this.onGround && this.wingRotDelta < 1.0F)
{
@ -155,7 +155,7 @@ public class EntityCorruptedChicken extends EntityAspectedDemonBase
this.wingRotation += this.wingRotDelta * 2.0F;
if (!this.worldObj.isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0)
if (!this.getEntityWorld().isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0)
{
this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
this.dropItem(Items.EGG, 1);

View file

@ -121,7 +121,7 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
@Override
public void onLivingUpdate()
{
if (this.worldObj.isRemote)
if (this.getEntityWorld().isRemote)
{
this.sheepTimer = Math.max(0, this.sheepTimer - 1);
this.castTimer = Math.max(0, castTimer - 1);
@ -359,7 +359,7 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{
livingdata = super.onInitialSpawn(difficulty, livingdata);
this.setFleeceColor(getRandomSheepColor(this.worldObj.rand));
this.setFleeceColor(getRandomSheepColor(this.getEntityWorld().rand));
return livingdata;
}

View file

@ -52,7 +52,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
this.tasks.addTask(5, new EntityAIWander(this, 0.8D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(6, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class, 10, true, false, new EntityAspectedDemonBase.TeamAttackPredicate(this)));
@ -95,7 +95,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
}
@Override
protected PathNavigate getNewNavigator(World worldIn)
protected PathNavigate createNavigator(World worldIn)
{
return new PathNavigateClimber(this, worldIn);
}
@ -104,7 +104,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
protected void entityInit()
{
super.entityInit();
this.dataManager.register(CLIMBING, Byte.valueOf((byte) 0));
this.dataManager.register(CLIMBING, (byte) 0);
}
@Override
@ -112,7 +112,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
{
super.onUpdate();
if (!this.worldObj.isRemote)
if (!this.getEntityWorld().isRemote)
{
this.setBesideClimbableBlock(this.isCollidedHorizontally);
}
@ -168,17 +168,17 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
@Override
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
return potioneffectIn.getPotion() == MobEffects.POISON ? false : super.isPotionApplicable(potioneffectIn);
return potioneffectIn.getPotion() != MobEffects.POISON && super.isPotionApplicable(potioneffectIn);
}
public boolean isBesideClimbableBlock()
{
return (((Byte) this.dataManager.get(CLIMBING)).byteValue() & 1) != 0;
return (this.dataManager.get(CLIMBING) & 1) != 0;
}
public void setBesideClimbableBlock(boolean climbing)
{
byte b0 = ((Byte) this.dataManager.get(CLIMBING)).byteValue();
byte b0 = this.dataManager.get(CLIMBING);
if (climbing)
{
@ -188,7 +188,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
b0 = (byte) (b0 & -2);
}
this.dataManager.set(CLIMBING, Byte.valueOf(b0));
this.dataManager.set(CLIMBING, b0);
}
@Override
@ -213,7 +213,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
if (f >= 0.5F && this.attacker.getRNG().nextInt(100) == 0)
{
this.attacker.setAttackTarget((EntityLivingBase) null);
this.attacker.setAttackTarget(null);
return false;
} else
{
@ -240,7 +240,7 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase
public boolean shouldExecute()
{
float f = this.taskOwner.getBrightness(1.0F);
return f >= 0.5F ? false : super.shouldExecute();
return !(f >= 0.5F) && super.shouldExecute();
}
}
}

View file

@ -73,17 +73,17 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
@Override
public void setCombatTask()
{
if (this.worldObj != null && !this.worldObj.isRemote)
if (!this.getEntityWorld().isRemote)
{
this.tasks.removeTask(this.aiAttackOnCollide);
this.tasks.removeTask(this.aiArrowAttack);
ItemStack itemstack = this.getHeldItemMainhand();
if (itemstack != null && itemstack.getItem() instanceof ItemBow)
if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemBow)
{
int i = 20;
if (this.worldObj.getDifficulty() != EnumDifficulty.HARD)
if (this.getEntityWorld().getDifficulty() != EnumDifficulty.HARD)
{
i = 40;
}
@ -100,7 +100,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
@Override
public boolean attackEntityFrom(DamageSource source, float amount)
{
return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount);
return !this.isEntityInvulnerable(source) && super.attackEntityFrom(source, amount);
}
/**
@ -128,7 +128,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
*/
public double absorbWillFromAuraToHeal(double toHeal)
{
if (worldObj.isRemote)
if (getEntityWorld().isRemote)
{
return 0;
}
@ -139,13 +139,13 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
return 0;
}
double will = WorldDemonWillHandler.getCurrentWill(worldObj, getPosition(), getType());
double will = WorldDemonWillHandler.getCurrentWill(getEntityWorld(), getPosition(), getType());
toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth()));
if (toHeal > 0)
{
this.heal((float) toHeal);
return WorldDemonWillHandler.drainWill(worldObj, getPosition(), getType(), toHeal * getWillToHealth(), true);
return WorldDemonWillHandler.drainWill(getEntityWorld(), getPosition(), getType(), toHeal * getWillToHealth(), true);
}
return 0;
@ -164,7 +164,7 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
public void onUpdate()
{
if (!this.worldObj.isRemote && this.ticksExisted % 20 == 0)
if (!this.getEntityWorld().isRemote && this.ticksExisted % 20 == 0)
{
absorbWillFromAuraToHeal(2);
}
@ -174,15 +174,8 @@ public class EntityCorruptedZombie extends EntityAspectedDemonBase
//TODO: Change to fit the given AI
@Override
public boolean shouldAttackEntity(EntityLivingBase attacker, EntityLivingBase owner)
{
if (!(attacker instanceof EntityCreeper) && !(attacker instanceof EntityGhast))
{
return super.shouldAttackEntity(attacker, owner);
} else
{
return false;
}
public boolean shouldAttackEntity(EntityLivingBase attacker, EntityLivingBase owner) {
return !(attacker instanceof EntityCreeper) && !(attacker instanceof EntityGhast) && super.shouldAttackEntity(attacker, owner);
}
@Override

View file

@ -39,8 +39,8 @@ import com.google.common.base.Predicate;
public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{
protected static final DataParameter<Byte> TAMED = EntityDataManager.<Byte>createKey(EntityDemonBase.class, DataSerializers.BYTE);
protected static final DataParameter<Optional<UUID>> OWNER_UNIQUE_ID = EntityDataManager.<Optional<UUID>>createKey(EntityDemonBase.class, DataSerializers.OPTIONAL_UNIQUE_ID);
protected static final DataParameter<Byte> TAMED = EntityDataManager.createKey(EntityDemonBase.class, DataSerializers.BYTE);
protected static final DataParameter<Optional<UUID>> OWNER_UNIQUE_ID = EntityDataManager.createKey(EntityDemonBase.class, DataSerializers.OPTIONAL_UNIQUE_ID);
public EntityDemonBase(World worldIn)
{
@ -51,7 +51,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
protected void entityInit()
{
super.entityInit();
this.dataManager.register(TAMED, Byte.valueOf((byte) 0));
this.dataManager.register(TAMED, (byte) 0);
this.dataManager.register(OWNER_UNIQUE_ID, Optional.<UUID>absent());
}
@ -84,7 +84,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
@Override
public boolean attackEntityFrom(DamageSource source, float amount)
{
return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount);
return !this.isEntityInvulnerable(source) && super.attackEntityFrom(source, amount);
}
/**
@ -106,7 +106,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
if (flag)
{
if (i > 0 && attackedEntity instanceof EntityLivingBase)
if (i > 0)
{
((EntityLivingBase) attackedEntity).knockBack(this, (float) i * 0.5F, (double) MathHelper.sin(this.rotationYaw * 0.017453292F), (double) (-MathHelper.cos(this.rotationYaw * 0.017453292F)));
this.motionX *= 0.6D;
@ -124,16 +124,16 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{
EntityPlayer entityplayer = (EntityPlayer) attackedEntity;
ItemStack itemstack = this.getHeldItemMainhand();
ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null;
ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : ItemStack.EMPTY;
if (itemstack != null && itemstack1 != null && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD)
if (!itemstack.isEmpty() && !itemstack1.isEmpty() && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD)
{
float f1 = 0.25F + (float) EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;
if (this.rand.nextFloat() < f1)
{
entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
this.worldObj.setEntityState(entityplayer, (byte) 30);
this.getEntityWorld().setEntityState(entityplayer, (byte) 30);
}
}
}
@ -149,7 +149,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{
super.setItemStackToSlot(slotIn, stack);
if (!this.worldObj.isRemote && slotIn == EntityEquipmentSlot.MAINHAND)
if (!this.getEntityWorld().isRemote && slotIn == EntityEquipmentSlot.MAINHAND)
{
this.setCombatTask();
}
@ -169,10 +169,10 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{
this.heal((float) toHeal);
if (worldObj instanceof WorldServer)
if (getEntityWorld() instanceof WorldServer)
{
WorldServer server = (WorldServer) worldObj;
server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0, new int[0]);
WorldServer server = (WorldServer) getEntityWorld();
server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0);
}
}
@ -207,7 +207,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
{
super.readEntityFromNBT(tag);
String s = "";
String s;
if (tag.hasKey("OwnerUUID", 8))
{
@ -248,7 +248,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
}
}
return attacker instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) attacker) ? false : !(attacker instanceof EntityHorse) || !((EntityHorse) attacker).isTame();
return !(attacker instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) attacker)) && (!(attacker instanceof EntityHorse) || !((EntityHorse) attacker).isTame());
} else
{
return false;
@ -262,19 +262,19 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
public boolean isTamed()
{
return (((Byte) this.dataManager.get(TAMED)).byteValue() & 4) != 0;
return (this.dataManager.get(TAMED) & 4) != 0;
}
public void setTamed(boolean tamed)
{
byte b0 = ((Byte) this.dataManager.get(TAMED)).byteValue();
byte b0 = this.dataManager.get(TAMED);
if (tamed)
{
this.dataManager.set(TAMED, Byte.valueOf((byte) (b0 | 4)));
this.dataManager.set(TAMED, (byte) (b0 | 4));
} else
{
this.dataManager.set(TAMED, Byte.valueOf((byte) (b0 & -5)));
this.dataManager.set(TAMED, (byte) (b0 & -5));
}
// this.setupTamedAI();
@ -316,7 +316,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
@Override
public UUID getOwnerId()
{
return (UUID) (this.dataManager.get(OWNER_UNIQUE_ID)).orNull();
return (this.dataManager.get(OWNER_UNIQUE_ID)).orNull();
}
public void setOwnerId(UUID uuid)
@ -330,7 +330,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable
try
{
UUID uuid = this.getOwnerId();
return uuid == null ? null : this.worldObj.getPlayerEntityByUUID(uuid);
return uuid == null ? null : this.getEntityWorld().getPlayerEntityByUUID(uuid);
} catch (IllegalArgumentException var2)
{
return null;

View file

@ -43,7 +43,7 @@ public class EntityMimic extends EntityDemonBase
/**
* Copy of EntitySpider's AI (should be pretty evident...)
*/
private static final DataParameter<Byte> CLIMBING = EntityDataManager.<Byte>createKey(EntityMimic.class, DataSerializers.BYTE);
private static final DataParameter<Byte> CLIMBING = EntityDataManager.createKey(EntityMimic.class, DataSerializers.BYTE);
public boolean dropItemsOnBreak = true;
public NBTTagCompound tileTag = new NBTTagCompound();
@ -64,7 +64,7 @@ public class EntityMimic extends EntityDemonBase
this.tasks.addTask(8, new EntityAILookIdle(this));
this.tasks.addTask(7, new EntityAIMimicReform(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityMimic.AISpiderTarget(this, EntityPlayer.class));
this.targetTasks.addTask(3, new EntityMimic.AISpiderTarget(this, EntityIronGolem.class));
}
@ -160,7 +160,7 @@ public class EntityMimic extends EntityDemonBase
}
BlockPos newPos = centerPos.add(i, j, k);
if (spawnMimicBlockAtPosition(worldObj, newPos))
if (spawnMimicBlockAtPosition(getEntityWorld(), newPos))
{
return true;
}
@ -178,7 +178,7 @@ public class EntityMimic extends EntityDemonBase
{
super.onDeath(cause);
if (!worldObj.isRemote)
if (!getEntityWorld().isRemote)
{
BlockPos centerPos = this.getPosition();
@ -201,7 +201,7 @@ public class EntityMimic extends EntityDemonBase
}
BlockPos newPos = centerPos.add(i, j, k);
if (spawnHeldBlockOnDeath(worldObj, newPos))
if (spawnHeldBlockOnDeath(getEntityWorld(), newPos))
{
return;
}
@ -227,7 +227,7 @@ public class EntityMimic extends EntityDemonBase
* Returns new PathNavigateGround instance
*/
@Override
protected PathNavigate getNewNavigator(World worldIn)
protected PathNavigate createNavigator(World worldIn)
{
return new PathNavigateClimber(this, worldIn);
}
@ -236,7 +236,7 @@ public class EntityMimic extends EntityDemonBase
protected void entityInit()
{
super.entityInit();
this.dataManager.register(CLIMBING, Byte.valueOf((byte) 0));
this.dataManager.register(CLIMBING, (byte) 0);
// this.dataManager.register(ITEMSTACK, null);
}
@ -246,7 +246,7 @@ public class EntityMimic extends EntityDemonBase
@Override
public void onUpdate()
{
if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL)
if (!this.getEntityWorld().isRemote && this.getEntityWorld().getDifficulty() == EnumDifficulty.PEACEFUL)
{
if (reformIntoMimicBlock(this.getPosition()))
{
@ -256,7 +256,7 @@ public class EntityMimic extends EntityDemonBase
super.onUpdate();
if (!this.worldObj.isRemote)
if (!this.getEntityWorld().isRemote)
{
this.setBesideClimbableBlock(this.isCollidedHorizontally);
}
@ -324,7 +324,7 @@ public class EntityMimic extends EntityDemonBase
@Override
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
return potioneffectIn.getPotion() == MobEffects.POISON ? false : super.isPotionApplicable(potioneffectIn);
return potioneffectIn.getPotion() != MobEffects.POISON && super.isPotionApplicable(potioneffectIn);
}
/**
@ -333,7 +333,7 @@ public class EntityMimic extends EntityDemonBase
*/
public boolean isBesideClimbableBlock()
{
return (((Byte) this.dataManager.get(CLIMBING)).byteValue() & 1) != 0;
return (this.dataManager.get(CLIMBING) & 1) != 0;
}
/**
@ -342,7 +342,7 @@ public class EntityMimic extends EntityDemonBase
*/
public void setBesideClimbableBlock(boolean climbing)
{
byte b0 = ((Byte) this.dataManager.get(CLIMBING)).byteValue();
byte b0 = this.dataManager.get(CLIMBING);
if (climbing)
{
@ -352,7 +352,7 @@ public class EntityMimic extends EntityDemonBase
b0 = (byte) (b0 & -2);
}
this.dataManager.set(CLIMBING, Byte.valueOf(b0));
this.dataManager.set(CLIMBING, b0);
}
public float getEyeHeight()

View file

@ -107,17 +107,17 @@ public class EntitySentientSpecter extends EntityDemonBase
@Override
public void setCombatTask()
{
if (this.worldObj != null && !this.worldObj.isRemote)
if (!this.getEntityWorld().isRemote)
{
this.tasks.removeTask(this.aiAttackOnCollide);
this.tasks.removeTask(this.aiArrowAttack);
ItemStack itemstack = this.getHeldItemMainhand();
if (itemstack != null && itemstack.getItem() instanceof ItemBow)
if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemBow)
{
int i = 20;
if (this.worldObj.getDifficulty() != EnumDifficulty.HARD)
if (this.getEntityWorld().getDifficulty() != EnumDifficulty.HARD)
{
i = 40;
}
@ -132,16 +132,11 @@ public class EntitySentientSpecter extends EntityDemonBase
}
@Override
public boolean isPotionApplicable(PotionEffect effect)
{
public boolean isPotionApplicable(PotionEffect effect) {
Potion potion = effect.getPotion();
if (potion == MobEffects.REGENERATION || potion == MobEffects.INSTANT_HEALTH) //Specter cannot be healed by normal means
{
return false;
}
return super.isPotionApplicable(effect);
//Specter cannot be healed by normal means
return !(potion == MobEffects.REGENERATION || potion == MobEffects.INSTANT_HEALTH) && super.isPotionApplicable(effect);
}
public boolean canStealEffectFromOwner(EntityLivingBase owner, PotionEffect effect)
@ -280,7 +275,7 @@ public class EntitySentientSpecter extends EntityDemonBase
@Override
public boolean attackEntityFrom(DamageSource source, float amount)
{
return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount);
return !this.isEntityInvulnerable(source) && super.attackEntityFrom(source, amount);
}
/**
@ -311,7 +306,7 @@ public class EntitySentientSpecter extends EntityDemonBase
{
super.onDeath(cause);
if (!worldObj.isRemote && getHeldItemMainhand() != null)
if (!getEntityWorld().isRemote && !getHeldItemMainhand().isEmpty())
{
this.entityDropItem(getHeldItemMainhand(), 0);
}
@ -339,20 +334,21 @@ public class EntitySentientSpecter extends EntityDemonBase
}
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
ItemStack stack = player.getHeldItem(hand);
if (this.isTamed() && player.equals(this.getOwner()) && hand == EnumHand.MAIN_HAND)
{
if (stack == null && player.isSneaking()) //Should return to the entity
if (stack.isEmpty() && player.isSneaking()) //Should return to the entity
{
if (!worldObj.isRemote)
if (!getEntityWorld().isRemote)
{
if (getHeldItemMainhand() != null)
if (!getHeldItemMainhand().isEmpty())
{
this.entityDropItem(getHeldItemMainhand(), 0);
}
if (getHeldItemOffhand() != null)
if (!getHeldItemOffhand().isEmpty())
{
this.entityDropItem(getHeldItemOffhand(), 0);
}
@ -367,7 +363,7 @@ public class EntitySentientSpecter extends EntityDemonBase
}
}
return super.processInteract(player, hand, stack);
return super.processInteract(player, hand);
}
public boolean isEntityInvulnerable(DamageSource source)
@ -380,9 +376,9 @@ public class EntitySentientSpecter extends EntityDemonBase
{
this.heal((float) toHeal);
if (worldObj instanceof WorldServer)
if (getEntityWorld() instanceof WorldServer)
{
WorldServer server = (WorldServer) worldObj;
WorldServer server = (WorldServer) getEntityWorld();
server.spawnParticle(EnumParticleTypes.HEART, this.posX + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, this.posY + 0.5D + (double) (this.rand.nextFloat() * this.height), this.posZ + (double) (this.rand.nextFloat() * this.width * 2.0F) - (double) this.width, 7, 0.2, 0.2, 0.2, 0, new int[0]);
}
}
@ -394,7 +390,7 @@ public class EntitySentientSpecter extends EntityDemonBase
*/
public double absorbWillFromAuraToHeal(double toHeal)
{
if (worldObj.isRemote)
if (getEntityWorld().isRemote)
{
return 0;
}
@ -405,13 +401,13 @@ public class EntitySentientSpecter extends EntityDemonBase
return 0;
}
double will = WorldDemonWillHandler.getCurrentWill(worldObj, getPosition(), getType());
double will = WorldDemonWillHandler.getCurrentWill(getEntityWorld(), getPosition(), getType());
toHeal = Math.min(healthMissing, Math.min(toHeal, will / getWillToHealth()));
if (toHeal > 0)
{
this.heal((float) toHeal);
return WorldDemonWillHandler.drainWill(worldObj, getPosition(), getType(), toHeal * getWillToHealth(), true);
return WorldDemonWillHandler.drainWill(getEntityWorld(), getPosition(), getType(), toHeal * getWillToHealth(), true);
}
return 0;
@ -430,7 +426,7 @@ public class EntitySentientSpecter extends EntityDemonBase
public void onUpdate()
{
if (!this.worldObj.isRemote && this.ticksExisted % 20 == 0)
if (!this.getEntityWorld().isRemote && this.ticksExisted % 20 == 0)
{
absorbWillFromAuraToHeal(2);
}
@ -485,7 +481,7 @@ public class EntitySentientSpecter extends EntityDemonBase
ItemStack heldStack = this.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND);
if (heldStack != null && heldStack.getItem() == ModItems.SENTIENT_BOW)
{
EntityTippedArrow arrowEntity = ((ItemSentientBow) heldStack.getItem()).getArrowEntity(worldObj, heldStack, target, this, velocity);
EntityTippedArrow arrowEntity = ((ItemSentientBow) heldStack.getItem()).getArrowEntity(getEntityWorld(), heldStack, target, this, velocity);
if (arrowEntity != null)
{
List<PotionEffect> effects = getPotionEffectsForArrowRemovingDuration(0.2f);
@ -495,19 +491,19 @@ public class EntitySentientSpecter extends EntityDemonBase
}
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(arrowEntity);
this.getEntityWorld().spawnEntity(arrowEntity);
}
} else
{
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.worldObj, this); //TODO: Change to an arrow created by the Sentient Bow
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.getEntityWorld(), this); //TODO: Change to an arrow created by the Sentient Bow
double d0 = target.posX - this.posX;
double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entitytippedarrow.posY;
double d2 = target.posZ - this.posZ;
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2);
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.2, d2, 1.6F, 0); //TODO: Yes, it is an accurate arrow. Don't be hatin'
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
entitytippedarrow.setDamage((double) (velocity * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.worldObj.getDifficulty().getDifficultyId() * 0.11F));
entitytippedarrow.setDamage((double) (velocity * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.getEntityWorld().getDifficulty().getDifficultyId() * 0.11F));
if (i > 0)
{
@ -533,7 +529,7 @@ public class EntitySentientSpecter extends EntityDemonBase
}
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(entitytippedarrow);
this.getEntityWorld().spawnEntity(entitytippedarrow);
}
}

View file

@ -61,7 +61,7 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
@Override
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8)
{
float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5);
float var9 = MathHelper.sqrt(var1 * var1 + var3 * var3 + var5 * var5);
var1 /= var9;
var3 /= var9;
var5 /= var9;
@ -74,7 +74,7 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
motionX = var1;
motionY = var3;
motionZ = var5;
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5);
float var10 = MathHelper.sqrt(var1 * var1 + var5 * var5);
prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI);
}
@ -105,9 +105,9 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
EnumFacing sideHit = mop.sideHit;
BlockPos blockPos = mop.getBlockPos().offset(sideHit);
if (worldObj.isAirBlock(blockPos))
if (getEntityWorld().isAirBlock(blockPos))
{
worldObj.setBlockState(blockPos, ModBlocks.BLOOD_LIGHT.getDefaultState());
getEntityWorld().setBlockState(blockPos, ModBlocks.BLOOD_LIGHT.getDefaultState());
}
}
@ -129,9 +129,9 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
}
}
if (worldObj.isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ)))
if (getEntityWorld().isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ)))
{
worldObj.setBlockState(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ), Blocks.FIRE.getDefaultState());
getEntityWorld().setBlockState(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ), Blocks.FIRE.getDefaultState());
}
// spawnHitParticles("magicCrit", 8);

View file

@ -95,12 +95,12 @@ public class EntityMeteor extends EntityThrowable implements IThrowableEntity
public void generateMeteor(BlockPos pos)
{
MeteorRegistry.generateMeteorForItem(meteorStack, worldObj, pos, Blocks.STONE.getDefaultState(), radiusModifier, explosionModifier, fillerChance);
MeteorRegistry.generateMeteorForItem(meteorStack, getEntityWorld(), pos, Blocks.STONE.getDefaultState(), radiusModifier, explosionModifier, fillerChance);
}
public DamageSource getDamageSource()
{
return DamageSource.anvil;
return DamageSource.ANVIL;
}
@Override
@ -127,7 +127,7 @@ public class EntityMeteor extends EntityThrowable implements IThrowableEntity
radiusModifier = nbt.getDouble("radiusModifier");
explosionModifier = nbt.getDouble("explosionModifier");
fillerChance = nbt.getDouble("fillerChance");
meteorStack = ItemStack.loadItemStackFromNBT(nbt);
meteorStack = new ItemStack(nbt);
}
@Override

View file

@ -41,7 +41,7 @@ public class EntitySentientArrow extends EntityTippedArrow
{
if (this.shootingEntity instanceof EntityPlayer)
{
if (hitEntity.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob))
if (hitEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob))
{
return;
}

View file

@ -39,7 +39,7 @@ public class EntitySoulSnare extends EntityThrowable
if (result.entityHit != null && result.entityHit != this.getThrower())
{
if (result.entityHit instanceof EntityLivingBase && result.entityHit.worldObj.rand.nextDouble() < 0.25)
if (result.entityHit instanceof EntityLivingBase && result.entityHit.getEntityWorld().rand.nextDouble() < 0.25)
{
((EntityLivingBase) result.entityHit).addPotionEffect(new PotionEffect(ModPotions.soulSnare, 300, 0));
}
@ -49,10 +49,10 @@ public class EntitySoulSnare extends EntityThrowable
for (int j = 0; j < 8; ++j)
{
this.worldObj.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
this.getEntityWorld().spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isRemote)
if (!this.getEntityWorld().isRemote)
{
this.setDead();
}