From 47281f2de151e51a652a69bb09c0524d44ab4f81 Mon Sep 17 00:00:00 2001 From: Uristqwerty Date: Fri, 14 Dec 2012 04:14:17 -0500 Subject: [PATCH] Simplify logic in tick start/end Change the EnumSet equivalent of "A &= ~ new(~B)" to "A &= B". This eliminates the need for one temporary object in a frequently called loop, and reduces the number of methods that need to be invoked. --- fml/common/cpw/mods/fml/common/FMLCommonHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fml/common/cpw/mods/fml/common/FMLCommonHandler.java b/fml/common/cpw/mods/fml/common/FMLCommonHandler.java index 05bb77cd8..12d1d4f04 100644 --- a/fml/common/cpw/mods/fml/common/FMLCommonHandler.java +++ b/fml/common/cpw/mods/fml/common/FMLCommonHandler.java @@ -112,7 +112,7 @@ public class FMLCommonHandler for (IScheduledTickHandler ticker : scheduledTicks) { EnumSet ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class))); - ticksToRun.removeAll(EnumSet.complementOf(ticks)); + ticksToRun.retainAll(ticks); if (!ticksToRun.isEmpty()) { ticker.tickStart(ticksToRun, data); @@ -131,7 +131,7 @@ public class FMLCommonHandler for (IScheduledTickHandler ticker : scheduledTicks) { EnumSet ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class))); - ticksToRun.removeAll(EnumSet.complementOf(ticks)); + ticksToRun.retainAll(ticks); if (!ticksToRun.isEmpty()) { ticker.tickEnd(ticksToRun, data);