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

@ -219,12 +219,7 @@ public class ChatUtil {
public static class Handler implements IMessageHandler<PacketNoSpamChat, IMessage> {
@Override
public IMessage onMessage(final PacketNoSpamChat message, MessageContext ctx) {
Minecraft.getMinecraft().addScheduledTask(new Runnable() {
@Override
public void run() {
sendNoSpamMessages(message.chatLines);
}
});
Minecraft.getMinecraft().addScheduledTask(() -> sendNoSpamMessages(message.chatLines));
return null;
}
}

View file

@ -96,7 +96,7 @@ public class ItemStackWrapper {
}
public static List<ItemStackWrapper> toWrapperList(List<ItemStack> itemStackList) {
List<ItemStackWrapper> wrapperList = new ArrayList<ItemStackWrapper>();
List<ItemStackWrapper> wrapperList = new ArrayList<>();
for (ItemStack stack : itemStackList)
wrapperList.add(ItemStackWrapper.getHolder(stack));
@ -104,7 +104,7 @@ public class ItemStackWrapper {
}
public static List<ItemStack> toStackList(List<ItemStackWrapper> wrapperList) {
List<ItemStack> stackList = new ArrayList<ItemStack>();
List<ItemStack> stackList = new ArrayList<>();
for (ItemStackWrapper wrapper : wrapperList)
stackList.add(wrapper.toStack());

View file

@ -231,9 +231,7 @@ public class Utils {
public static boolean isInteger(String integer) {
try {
Integer.parseInt(integer);
} catch (NumberFormatException e) {
return false;
} catch (NullPointerException e) {
} catch (NumberFormatException | NullPointerException e) {
return false;
}
// only got here if we didn't return false
@ -365,7 +363,7 @@ public class Utils {
public static float applyArmor(EntityLivingBase entity, ItemStack[] inventory, DamageSource source, double damage) {
damage *= 25;
ArrayList<ArmorProperties> dmgVals = new ArrayList<ArmorProperties>();
ArrayList<ArmorProperties> dmgVals = new ArrayList<>();
for (int x = 0; x < inventory.length; x++) {
ItemStack stack = inventory[x];
if (stack.isEmpty()) {

View file

@ -55,7 +55,7 @@ import java.util.*;
public class ClientHandler {
// Quick toggle for error suppression. Set to false if you wish to hide model errors.
public static final boolean SUPPRESS_ASSET_ERRORS = true;
public static final List<HUDElement> hudElements = new ArrayList<HUDElement>();
public static final List<HUDElement> hudElements = new ArrayList<>();
public static TextureAtlasSprite ritualStoneBlank;
public static TextureAtlasSprite ritualStoneWater;
public static TextureAtlasSprite ritualStoneFire;
@ -191,13 +191,13 @@ public class ClientHandler {
Set<ModelResourceLocation> missingVariants = ReflectionHelper.getPrivateValue(ModelLoader.class, event.getModelLoader(), "missingVariants");
// Collect all Blood Magic model errors
List<ResourceLocation> errored = new ArrayList<ResourceLocation>();
List<ResourceLocation> errored = new ArrayList<>();
for (ResourceLocation modelError : modelErrors.keySet())
if (modelError.getResourceDomain().equalsIgnoreCase(BloodMagic.MODID))
errored.add(modelError);
// Collect all Blood Magic variant errors
List<ModelResourceLocation> missing = new ArrayList<ModelResourceLocation>();
List<ModelResourceLocation> missing = new ArrayList<>();
for (ModelResourceLocation missingVariant : missingVariants)
if (missingVariant.getResourceDomain().equalsIgnoreCase(BloodMagic.MODID))
missing.add(missingVariant);
@ -228,7 +228,7 @@ public class ClientHandler {
String mc = "minecraft";
String format = "textures/%s.png";
Set<ResourceLocation> toRemove = new HashSet<ResourceLocation>();
Set<ResourceLocation> toRemove = new HashSet<>();
// Find our missing textures and mark them for removal. Cannot directly remove as it would cause a CME
if (missingTextures.containsKey(mc)) {

View file

@ -127,7 +127,7 @@ public class CraftingHandler {
if (rightUpgrade != null) {
String key = ItemHelper.LivingUpgrades.getKey(event.getRight());
ItemStack outputStack = event.getLeft().copy();
List<String> keyList = new ArrayList<String>();
List<String> keyList = new ArrayList<>();
keyList.add(key);
if (((IUpgradeTrainer) event.getLeft().getItem()).setTrainedUpgrades(outputStack, keyList)) {
event.setCost(1);

View file

@ -34,7 +34,6 @@ import WayofTime.bloodmagic.potion.BMPotionUtils;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.helper.*;
import com.google.common.base.Strings;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.EnchantmentHelper;
@ -54,7 +53,6 @@ import net.minecraft.init.MobEffects;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
@ -74,7 +72,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
@ -85,10 +82,10 @@ import java.util.*;
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
public class GenericHandler {
public static Map<EntityPlayer, Double> bounceMap = new HashMap<EntityPlayer, Double>();
public static Map<EntityPlayer, Integer> filledHandMap = new HashMap<EntityPlayer, Integer>();
private static Map<EntityAnimal, EntityAITarget> targetTaskMap = new HashMap<EntityAnimal, EntityAITarget>();
private static Map<EntityAnimal, EntityAIBase> attackTaskMap = new HashMap<EntityAnimal, EntityAIBase>();
public static Map<EntityPlayer, Double> bounceMap = new HashMap<>();
public static Map<EntityPlayer, Integer> filledHandMap = new HashMap<>();
private static Map<EntityAnimal, EntityAITarget> targetTaskMap = new HashMap<>();
private static Map<EntityAnimal, EntityAIBase> attackTaskMap = new HashMap<>();
@SubscribeEvent
public static void onEntityFall(LivingFallEvent event) {
@ -218,7 +215,7 @@ public class GenericHandler {
EntityAnimal animal = (EntityAnimal) event.getEntityLiving();
if (animal.isPotionActive(RegistrarBloodMagic.SACRIFICIAL_LAMB)) {
if (!targetTaskMap.containsKey(animal)) {
EntityAITarget task = new EntityAINearestAttackableTarget<EntityMob>(animal, EntityMob.class, false);
EntityAITarget task = new EntityAINearestAttackableTarget<>(animal, EntityMob.class, false);
EntityAIBase attackTask = new EntityAIAttackMelee(animal, 1.0D, false);
animal.targetTasks.addTask(1, task);
animal.tasks.addTask(1, attackTask);

View file

@ -37,7 +37,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
@Mod.EventBusSubscriber(modid = BloodMagic.MODID)
public class WillHandler {
private static final HashMap<Integer, Integer> SERVER_TICKS = new HashMap<Integer, Integer>();
private static final HashMap<Integer, Integer> SERVER_TICKS = new HashMap<>();
// Adds Will to player
@SubscribeEvent

View file

@ -2,14 +2,12 @@ package WayofTime.bloodmagic.util.helper;
import WayofTime.bloodmagic.core.data.Binding;
import WayofTime.bloodmagic.iface.IBindable;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.event.SoulNetworkEvent;
import WayofTime.bloodmagic.orb.BloodOrb;
import WayofTime.bloodmagic.orb.IBloodOrb;
import WayofTime.bloodmagic.core.registry.OrbRegistry;
import WayofTime.bloodmagic.core.data.BMWorldSavedData;
import WayofTime.bloodmagic.core.data.SoulNetwork;
import com.google.common.base.Strings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

View file

@ -4,7 +4,7 @@ import java.util.TreeMap;
public class NumeralHelper {
private static final TreeMap<Integer, String> romanNumerals = new TreeMap<Integer, String>();
private static final TreeMap<Integer, String> romanNumerals = new TreeMap<>();
static {
romanNumerals.put(1000, "M");

View file

@ -36,7 +36,7 @@ public class TextHelper {
}
public static ArrayList<String> localizeAll(List<String> input) {
ArrayList<String> ret = new ArrayList<String>(input.size());
ArrayList<String> ret = new ArrayList<>(input.size());
for (int i = 0; i < input.size(); i++)
ret.add(i, localize(input.get(i)));
@ -44,7 +44,7 @@ public class TextHelper {
}
public static ArrayList<String> localizeAllEffect(List<String> input) {
ArrayList<String> ret = new ArrayList<String>(input.size());
ArrayList<String> ret = new ArrayList<>(input.size());
for (int i = 0; i < input.size(); i++)
ret.add(i, localizeEffect(input.get(i)));