Fix issues pointed out by the static analyzer.

This commit is contained in:
raoulvdberge
2018-05-30 10:39:01 +02:00
parent 68bf3e78f5
commit 1cf5729640
8 changed files with 11 additions and 13 deletions

View File

@@ -93,9 +93,9 @@ public class CraftingManager implements ICraftingManager {
tasksToAdd.stream().filter(ICraftingTask::isValid).forEach(tasks::add);
tasksToAdd.clear();
changed = tasks.removeIf(ICraftingTask::update);
boolean anyFinished = tasks.removeIf(ICraftingTask::update);
if (changed) {
if (changed || anyFinished) {
markCraftingMonitorForUpdate();
}
}

View File

@@ -38,7 +38,7 @@ public class CapabilityNetworkNodeProxy {
private static class Factory implements Callable<INetworkNodeProxy> {
@Override
public INetworkNodeProxy call() throws Exception {
public INetworkNodeProxy call() {
return new INetworkNodeProxy() {
@Nonnull
@Override

View File

@@ -76,10 +76,12 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
if (node.getNetwork() == null) {
return new Object[]{null, "not connected"};
}
List<ItemStack> patterns = new LinkedList<ItemStack>();
List<ItemStack> patterns = new LinkedList<>();
for (ICraftingPattern pattern : node.getNetwork().getCraftingManager().getPatterns()) {
patterns.addAll(pattern.getOutputs());
}
return new Object[]{patterns};
}

View File

@@ -67,9 +67,7 @@ public class MessageCraftingMonitorElements implements IMessage, IMessageHandler
@Override
public IMessage onMessage(MessageCraftingMonitorElements message, MessageContext ctx) {
GuiBase.executeLater(GuiCraftingMonitor.class, craftingMonitor -> {
craftingMonitor.setElements(message.elements);
});
GuiBase.executeLater(GuiCraftingMonitor.class, craftingMonitor -> craftingMonitor.setElements(message.elements));
return null;
}

View File

@@ -70,7 +70,7 @@ public class BakedModelDiskDrive implements IBakedModel {
private LoadingCache<CacheKey, List<BakedQuad>> cache = CacheBuilder.newBuilder().build(new CacheLoader<CacheKey, List<BakedQuad>>() {
@Override
public List<BakedQuad> load(CacheKey key) throws Exception {
public List<BakedQuad> load(CacheKey key) {
EnumFacing facing = key.state.getValue(RSBlocks.DISK_DRIVE.getDirection().getProperty());
List<BakedQuad> quads = models.get(facing).getQuads(key.state, key.side, 0);

View File

@@ -71,7 +71,7 @@ public class BakedModelDiskManipulator implements IBakedModel {
private LoadingCache<CacheKey, List<BakedQuad>> cache = CacheBuilder.newBuilder().build(new CacheLoader<CacheKey, List<BakedQuad>>() {
@Override
public List<BakedQuad> load(CacheKey key) throws Exception {
public List<BakedQuad> load(CacheKey key) {
EnumFacing facing = key.state.getValue(RSBlocks.DISK_MANIPULATOR.getDirection().getProperty());
List<BakedQuad> quads = (key.state.getValue(BlockDiskManipulator.CONNECTED) ? modelsConnected : modelsDisconnected).get(facing).getQuads(key.state, key.side, 0);

View File

@@ -22,7 +22,7 @@ public class CustomModelLoaderDefault implements ICustomModelLoader {
}
@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception {
public IModel loadModel(ResourceLocation modelLocation) {
return model.get();
}

View File

@@ -61,9 +61,7 @@ public class PortableGrid implements IGrid, IPortableGrid {
private int tabPage;
private int size;
private StorageTrackerItem storageTracker = new StorageTrackerItem(() -> {
stack.getTagCompound().setTag(NBT_STORAGE_TRACKER, getStorageTracker().serializeNBT());
});
private StorageTrackerItem storageTracker = new StorageTrackerItem(() -> stack.getTagCompound().setTag(NBT_STORAGE_TRACKER, getStorageTracker().serializeNBT()));
private List<IFilter> filters = new ArrayList<>();
private List<IGridTab> tabs = new ArrayList<>();