Cleaned up a lot of different inspections

This commit is contained in:
Nicholas Ignoffo 2018-03-01 19:27:38 -08:00
parent 0dd0854bd9
commit 70d98455b7
207 changed files with 603 additions and 731 deletions

View file

@ -36,7 +36,7 @@ public class EntityAIRetreatToHeal<T extends Entity> extends EntityAIBase {
private Predicate<? super T> avoidTargetSelector;
public EntityAIRetreatToHeal(EntityDemonBase theEntityIn, Class<T> classToAvoidIn, float avoidDistanceIn, double farSpeedIn, double nearSpeedIn) {
this(theEntityIn, classToAvoidIn, Predicates.<T>alwaysTrue(), avoidDistanceIn, farSpeedIn, nearSpeedIn);
this(theEntityIn, classToAvoidIn, Predicates.alwaysTrue(), avoidDistanceIn, farSpeedIn, nearSpeedIn);
}
public EntityAIRetreatToHeal(EntityDemonBase theEntityIn, Class<T> classToAvoidIn, Predicate<? super T> avoidTargetSelectorIn, float avoidDistanceIn, double farSpeedIn, double nearSpeedIn) {

View file

@ -16,7 +16,7 @@ import net.minecraft.world.World;
import java.util.Locale;
public abstract class EntityAspectedDemonBase extends EntityDemonBase {
protected static final DataParameter<EnumDemonWillType> TYPE = EntityDataManager.<EnumDemonWillType>createKey(EntityAspectedDemonBase.class, Serializers.WILL_TYPE_SERIALIZER);
protected static final DataParameter<EnumDemonWillType> TYPE = EntityDataManager.createKey(EntityAspectedDemonBase.class, Serializers.WILL_TYPE_SERIALIZER);
public EntityAspectedDemonBase(World worldIn) {
super(worldIn);

View file

@ -63,8 +63,8 @@ public class EntityCorruptedChicken extends EntityAspectedDemonBase {
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.tasks.addTask(7, new EntityAILookIdle(this));
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)));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<>(this, EntityLivingBase.class, 10, true, false, new EntityAspectedDemonBase.TeamAttackPredicate(this)));
}
@Override

View file

@ -30,12 +30,13 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class EntityCorruptedSheep extends EntityAspectedDemonBase implements IShearable {
private static final DataParameter<Byte> DYE_COLOR = EntityDataManager.<Byte>createKey(EntityCorruptedSheep.class, DataSerializers.BYTE);
private static final DataParameter<Byte> DYE_COLOR = EntityDataManager.createKey(EntityCorruptedSheep.class, DataSerializers.BYTE);
private static final Map<EnumDyeColor, float[]> DYE_TO_RGB = Maps.newEnumMap(EnumDyeColor.class);
public static int maxProtectionCooldown = 90 * 20; //90 second cooldown
@ -93,8 +94,8 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.tasks.addTask(8, new EntityAILookIdle(this));
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)));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<>(this, EntityLivingBase.class, 10, true, false, new EntityAspectedDemonBase.TeamAttackPredicate(this)));
}
@Override
@ -180,7 +181,7 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
@Override
protected void entityInit() {
super.entityInit();
this.dataManager.register(DYE_COLOR, Byte.valueOf((byte) 0));
this.dataManager.register(DYE_COLOR, (byte) 0);
}
@Override
@ -255,34 +256,34 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
* Gets the wool color of this sheep.
*/
public EnumDyeColor getFleeceColor() {
return EnumDyeColor.byMetadata(this.dataManager.get(DYE_COLOR).byteValue() & 15);
return EnumDyeColor.byMetadata(this.dataManager.get(DYE_COLOR) & 15);
}
/**
* Sets the wool color of this sheep
*/
public void setFleeceColor(EnumDyeColor color) {
byte b0 = this.dataManager.get(DYE_COLOR).byteValue();
this.dataManager.set(DYE_COLOR, Byte.valueOf((byte) (b0 & 240 | color.getMetadata() & 15)));
byte b0 = this.dataManager.get(DYE_COLOR);
this.dataManager.set(DYE_COLOR, (byte) (b0 & 240 | color.getMetadata() & 15));
}
/**
* returns true if a sheeps wool has been sheared
*/
public boolean getSheared() {
return (this.dataManager.get(DYE_COLOR).byteValue() & 16) != 0;
return (this.dataManager.get(DYE_COLOR) & 16) != 0;
}
/**
* make a sheep sheared if set to true
*/
public void setSheared(boolean sheared) {
byte b0 = this.dataManager.get(DYE_COLOR).byteValue();
byte b0 = this.dataManager.get(DYE_COLOR);
if (sheared) {
this.dataManager.set(DYE_COLOR, Byte.valueOf((byte) (b0 | 16)));
this.dataManager.set(DYE_COLOR, (byte) (b0 | 16));
} else {
this.dataManager.set(DYE_COLOR, Byte.valueOf((byte) (b0 & -17)));
this.dataManager.set(DYE_COLOR, (byte) (b0 & -17));
}
}
@ -327,7 +328,7 @@ public class EntityCorruptedSheep extends EntityAspectedDemonBase implements ISh
this.setSheared(true);
int i = 1 + this.rand.nextInt(3);
java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
List<ItemStack> ret = new ArrayList<>();
for (int j = 0; j < i; ++j)
ret.add(new ItemStack(Item.getItemFromBlock(Blocks.WOOL), 1, this.getFleeceColor().getMetadata()));

View file

@ -20,7 +20,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class EntityCorruptedSpider extends EntityAspectedDemonBase {
private static final DataParameter<Byte> CLIMBING = EntityDataManager.<Byte>createKey(EntityCorruptedSpider.class, DataSerializers.BYTE);
private static final DataParameter<Byte> CLIMBING = EntityDataManager.createKey(EntityCorruptedSpider.class, DataSerializers.BYTE);
public EntityCorruptedSpider(World world) {
this(world, EnumDemonWillType.DEFAULT);
@ -43,8 +43,8 @@ public class EntityCorruptedSpider extends EntityAspectedDemonBase {
this.tasks.addTask(6, new EntityAILookIdle(this));
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)));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<>(this, EntityLivingBase.class, 10, true, false, new EntityAspectedDemonBase.TeamAttackPredicate(this)));
}
@Override

View file

@ -45,7 +45,7 @@ public class EntityDemonBase extends EntityCreature implements IEntityOwnable {
protected void entityInit() {
super.entityInit();
this.dataManager.register(TAMED, (byte) 0);
this.dataManager.register(OWNER_UNIQUE_ID, Optional.<UUID>absent());
this.dataManager.register(OWNER_UNIQUE_ID, Optional.absent());
}
@Override

View file

@ -57,7 +57,7 @@ public class EntitySentientSpecter extends EntityDemonBase {
this.setSize(0.6F, 1.95F);
// ((PathNavigateGround) getNavigator()).setCanSwim(false);
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIRetreatToHeal<EntityCreature>(this, EntityCreature.class, 6.0F, 1.0D, 1.2D));
this.tasks.addTask(2, new EntityAIRetreatToHeal<>(this, EntityCreature.class, 6.0F, 1.0D, 1.2D));
this.tasks.addTask(attackPriority, aiAttackOnCollide);
this.tasks.addTask(4, new EntityAIGrabEffectsFromOwner(this, 2.0D, 1.0F));
this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
@ -67,9 +67,9 @@ public class EntitySentientSpecter extends EntityDemonBase {
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true));
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, true));
this.targetTasks.addTask(4, new EntityAIHurtByTargetIgnoreTamed(this, false, new Class[0]));
this.targetTasks.addTask(4, new EntityAIHurtByTargetIgnoreTamed(this, false));
this.setCombatTask();
// this.targetTasks.addTask(8, new EntityAINearestAttackableTarget<EntityMob>(this, EntityMob.class, 10, true, false, new TargetPredicate(this)));
@ -138,7 +138,7 @@ public class EntitySentientSpecter extends EntityDemonBase {
boolean hasStolenEffect = false;
List<PotionEffect> removedEffects = new ArrayList<PotionEffect>();
List<PotionEffect> removedEffects = new ArrayList<>();
for (PotionEffect eff : owner.getActivePotionEffects()) {
if (canStealEffectFromOwner(owner, eff)) {
@ -157,7 +157,7 @@ public class EntitySentientSpecter extends EntityDemonBase {
public boolean applyNegativeEffectsToAttacked(EntityLivingBase attackedEntity, float percentTransmitted) {
boolean hasProvidedEffect = false;
List<PotionEffect> removedEffects = new ArrayList<PotionEffect>();
List<PotionEffect> removedEffects = new ArrayList<>();
for (PotionEffect eff : this.getActivePotionEffects()) {
if (eff.getPotion().isBadEffect() && attackedEntity.isPotionApplicable(eff)) {
if (!attackedEntity.isPotionActive(eff.getPotion())) {
@ -197,13 +197,13 @@ public class EntitySentientSpecter extends EntityDemonBase {
}
public List<PotionEffect> getPotionEffectsForArrowRemovingDuration(float percentTransmitted) {
List<PotionEffect> arrowEffects = new ArrayList<PotionEffect>();
List<PotionEffect> arrowEffects = new ArrayList<>();
if (type != EnumDemonWillType.CORROSIVE) {
return arrowEffects;
}
List<PotionEffect> removedEffects = new ArrayList<PotionEffect>();
List<PotionEffect> removedEffects = new ArrayList<>();
for (PotionEffect eff : this.getActivePotionEffects()) {
if (eff.getPotion().isBadEffect()) {
removedEffects.add(eff);
@ -310,7 +310,7 @@ public class EntitySentientSpecter extends EntityDemonBase {
if (getEntityWorld() instanceof WorldServer) {
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]);
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);
}
}