mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
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.
This commit is contained in:
1 parent
70b9cd6e1f
commit
47281f2de1
1 file changed
+2
-2
@@ -112,7 +112,7 @@ public class FMLCommonHandler
|
||||
for (IScheduledTickHandler ticker : scheduledTicks)
|
||||
{
|
||||
EnumSet<TickType> 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<TickType> 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);
|
||||
|
||||
Reference in new issue
Block a user