From d85dfd4f31047b2a6137184f2bb55bbe26780056 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Tue, 30 Jun 2015 00:48:05 -0400 Subject: [PATCH 1/3] Maintain java 6 source compatability in API classes --- .../java/mekanism/api/gas/GasNetwork.java | 5 +++-- .../api/transmitters/DynamicNetwork.java | 15 +++++++++------ .../TransmitterNetworkRegistry.java | 19 +++++++++++-------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/main/java/mekanism/api/gas/GasNetwork.java b/src/main/java/mekanism/api/gas/GasNetwork.java index 8ad11c02f..207c587c8 100644 --- a/src/main/java/mekanism/api/gas/GasNetwork.java +++ b/src/main/java/mekanism/api/gas/GasNetwork.java @@ -8,10 +8,11 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import com.google.common.collect.Lists; + import mekanism.api.Coord4D; import mekanism.api.transmitters.DynamicNetwork; import mekanism.api.transmitters.IGridTransmitter; - import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; @@ -137,7 +138,7 @@ public class GasNetwork extends DynamicNetwork public int tickEmit(GasStack stack) { - List availableAcceptors = new ArrayList<>(); + List availableAcceptors = Lists.newArrayList(); availableAcceptors.addAll(getAcceptors(stack.getGas())); diff --git a/src/main/java/mekanism/api/transmitters/DynamicNetwork.java b/src/main/java/mekanism/api/transmitters/DynamicNetwork.java index e227637fb..d0320988a 100644 --- a/src/main/java/mekanism/api/transmitters/DynamicNetwork.java +++ b/src/main/java/mekanism/api/transmitters/DynamicNetwork.java @@ -9,10 +9,13 @@ import java.util.LinkedHashSet; import java.util.Map.Entry; import java.util.Set; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + import mekanism.api.Coord4D; import mekanism.api.IClientTicker; import mekanism.api.Range4D; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -23,13 +26,13 @@ import cpw.mods.fml.common.eventhandler.Event; public abstract class DynamicNetwork> implements IClientTicker, INetworkDataHandler { - public LinkedHashSet> transmitters = new LinkedHashSet<>(); - public LinkedHashSet> transmittersToAdd = new LinkedHashSet<>(); - public LinkedHashSet> transmittersAdded = new LinkedHashSet<>(); + public LinkedHashSet> transmitters = Sets.newLinkedHashSet(); + public LinkedHashSet> transmittersToAdd = Sets.newLinkedHashSet(); + public LinkedHashSet> transmittersAdded = Sets.newLinkedHashSet(); public HashMap possibleAcceptors = new HashMap(); public HashMap> acceptorDirections = new HashMap>(); - public HashMap, EnumSet> changedAcceptors = new HashMap<>(); + public HashMap, EnumSet> changedAcceptors = Maps.newHashMap(); private Set updateQueue = new LinkedHashSet(); @@ -75,7 +78,7 @@ public abstract class DynamicNetwork> implemen updateCapacity(); clampBuffer(); - queueClientUpdate(new ArrayList<>(transmittersToAdd)); + queueClientUpdate(Lists.newArrayList(transmittersToAdd)); transmittersToAdd.clear(); } diff --git a/src/main/java/mekanism/api/transmitters/TransmitterNetworkRegistry.java b/src/main/java/mekanism/api/transmitters/TransmitterNetworkRegistry.java index e544c2a56..1e72b1de5 100644 --- a/src/main/java/mekanism/api/transmitters/TransmitterNetworkRegistry.java +++ b/src/main/java/mekanism/api/transmitters/TransmitterNetworkRegistry.java @@ -10,6 +10,9 @@ import net.minecraftforge.common.util.ForgeDirection; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; @@ -21,11 +24,11 @@ public class TransmitterNetworkRegistry private static TransmitterNetworkRegistry INSTANCE = new TransmitterNetworkRegistry(); private static boolean loaderRegistered = false; - private HashSet networks = new HashSet<>(); - private HashSet networksToChange = new HashSet<>(); + private HashSet networks = Sets.newHashSet(); + private HashSet networksToChange = Sets.newHashSet(); - private HashSet invalidTransmitters = new HashSet<>(); - private HashMap orphanTransmitters = new HashMap<>(); + private HashSet invalidTransmitters = Sets.newHashSet(); + private HashMap orphanTransmitters = Maps.newHashMap(); private Logger logger = LogManager.getLogger("MekanismTransmitters"); @@ -151,7 +154,7 @@ public class TransmitterNetworkRegistry { if(startOrphan.isValid() && startOrphan.isOrphan()) { - OrphanPathFinder finder = new OrphanPathFinder<>(startOrphan); + OrphanPathFinder finder = new OrphanPathFinder(startOrphan); finder.start(); N network; @@ -225,10 +228,10 @@ public class TransmitterNetworkRegistry { public IGridTransmitter startPoint; - public HashSet iterated = new HashSet<>(); + public HashSet iterated = Sets.newHashSet(); - public HashSet> connectedTransmitters = new HashSet<>(); - public HashSet networksFound = new HashSet<>(); + public HashSet> connectedTransmitters = Sets.newHashSet(); + public HashSet networksFound = Sets.newHashSet(); public OrphanPathFinder(IGridTransmitter start) { From 37b011c3273046a690887b18f31e0c14caffdf5f Mon Sep 17 00:00:00 2001 From: Halvor Lyche Strandvoll Date: Wed, 1 Jul 2015 15:47:11 +0200 Subject: [PATCH 2/3] Added the default transparent greyed out background to GuiScreen's. Added the default transparent greyed out background to the GuiPasswordEnter and GuiPasswordModify GuiScreen's. --- src/main/java/mekanism/client/gui/GuiPasswordEnter.java | 2 ++ src/main/java/mekanism/client/gui/GuiPasswordModify.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/mekanism/client/gui/GuiPasswordEnter.java b/src/main/java/mekanism/client/gui/GuiPasswordEnter.java index e2268ed32..822d4a682 100644 --- a/src/main/java/mekanism/client/gui/GuiPasswordEnter.java +++ b/src/main/java/mekanism/client/gui/GuiPasswordEnter.java @@ -161,6 +161,8 @@ public class GuiPasswordEnter extends GuiScreen @Override public void drawScreen(int mouseX, int mouseY, float partialTick) { + drawDefaultBackground(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiPasswordEnter.png")); diff --git a/src/main/java/mekanism/client/gui/GuiPasswordModify.java b/src/main/java/mekanism/client/gui/GuiPasswordModify.java index 873ab6cde..8147f2d3b 100644 --- a/src/main/java/mekanism/client/gui/GuiPasswordModify.java +++ b/src/main/java/mekanism/client/gui/GuiPasswordModify.java @@ -187,6 +187,8 @@ public class GuiPasswordModify extends GuiScreen @Override public void drawScreen(int mouseX, int mouseY, float partialTick) { + drawDefaultBackground(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiPasswordModify.png")); From bb6273cf86a3c91c4b77e43d7ead0adf917cbdcf Mon Sep 17 00:00:00 2001 From: Halvor Lyche Strandvoll Date: Thu, 2 Jul 2015 07:21:58 +0200 Subject: [PATCH 3/3] Replaced spaces with tabs in GuiPasswordEnter and GuiPasswordModify. --- src/main/java/mekanism/client/gui/GuiPasswordEnter.java | 2 +- src/main/java/mekanism/client/gui/GuiPasswordModify.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/mekanism/client/gui/GuiPasswordEnter.java b/src/main/java/mekanism/client/gui/GuiPasswordEnter.java index 822d4a682..f561849c0 100644 --- a/src/main/java/mekanism/client/gui/GuiPasswordEnter.java +++ b/src/main/java/mekanism/client/gui/GuiPasswordEnter.java @@ -161,7 +161,7 @@ public class GuiPasswordEnter extends GuiScreen @Override public void drawScreen(int mouseX, int mouseY, float partialTick) { - drawDefaultBackground(); + drawDefaultBackground(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiPasswordEnter.png")); diff --git a/src/main/java/mekanism/client/gui/GuiPasswordModify.java b/src/main/java/mekanism/client/gui/GuiPasswordModify.java index 8147f2d3b..2876146f5 100644 --- a/src/main/java/mekanism/client/gui/GuiPasswordModify.java +++ b/src/main/java/mekanism/client/gui/GuiPasswordModify.java @@ -187,7 +187,7 @@ public class GuiPasswordModify extends GuiScreen @Override public void drawScreen(int mouseX, int mouseY, float partialTick) { - drawDefaultBackground(); + drawDefaultBackground(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiPasswordModify.png"));