Cleanup some volatiles

This commit is contained in:
Vincent Lee committed 2017-07-05 20:14:02 -05:00
1 parent 7c008784d8
commit adfa6c92c0
2 files changed
+9 -10

No files matched your search

@@ -38,8 +38,8 @@ import java.util.Properties;
public final class ContributorFancinessHandler implements LayerRenderer<EntityPlayer> {
public volatile static Map<String, ItemStack> flowerMap = null;
private volatile static boolean startedLoading = false;
public static final Map<String, ItemStack> flowerMap = new HashMap<>();
private static boolean startedLoading = false;
@Override
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
@@ -60,7 +60,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
firstStart();
name = name.toLowerCase();
if(player.isWearing(EnumPlayerModelParts.CAPE) && flowerMap != null && flowerMap.containsKey(name))
if(player.isWearing(EnumPlayerModelParts.CAPE) && flowerMap.containsKey(name))
renderFlower(player, flowerMap.get(name));
GlStateManager.popMatrix();
@@ -79,7 +79,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
}
public static void load(Properties props) {
flowerMap = new HashMap<>();
flowerMap.clear();
for(String key : props.stringPropertyNames()) {
String value = props.getProperty(key);
@@ -146,7 +146,6 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
} catch (IOException e) {
Botania.LOGGER.info("Could not load contributors list. Either you're offline or github is down. Nothing to worry about, carry on~");
}
VersionChecker.doneChecking = true;
}
}
@@ -32,12 +32,12 @@ public final class VersionChecker {
private static final int FLAVOUR_MESSAGES = 65;
public static boolean doneChecking = false;
public static String onlineVersion = "";
public static volatile boolean doneChecking = false;
public static volatile String onlineVersion = "";
private static boolean triedToWarnPlayer = false;
public static boolean startedDownload = false;
public static boolean downloadedFile = false;
public static volatile boolean startedDownload = false;
public static volatile boolean downloadedFile = false;
public static void init() {
new ThreadVersionChecker();
@@ -45,7 +45,7 @@ public final class VersionChecker {
@SubscribeEvent
public static void onTick(ClientTickEvent event) {
if(doneChecking && event.phase == Phase.END && Minecraft.getMinecraft().player != null && !triedToWarnPlayer) {
if(event.phase == Phase.END && Minecraft.getMinecraft().player != null && !triedToWarnPlayer && doneChecking) {
if(!onlineVersion.isEmpty()) {
EntityPlayer player = Minecraft.getMinecraft().player;
int onlineBuild = Integer.parseInt(onlineVersion.split("-")[1]);