diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java index 384246947..34515bf87 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/metalists/TheColoredLampColors.java @@ -12,6 +12,8 @@ package de.ellpeck.actuallyadditions.mod.blocks.metalists; import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import java.util.Locale; + public enum TheColoredLampColors{ WHITE("White"), @@ -40,9 +42,14 @@ public enum TheColoredLampColors{ public static TheColoredLampColors getColorFromDyeName(String color){ if(color.substring(0, 3).equals("dye")){ String actualName = color.substring(3); - for(int i = 0; i < values().length; i++){ - if(StringUtil.equalsToLowerCase(values()[i].name, actualName)){ - return values()[i]; + if(actualName != null){ + for(int i = 0; i < values().length; i++){ + String aName = values()[i].name; + if(aName != null){ + if(aName.toLowerCase(Locale.ROOT).equals(actualName.toLowerCase(Locale.ROOT))){ + return values()[i]; + } + } } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java index befb31b3d..cfe9bec79 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderSmileyCloud.java @@ -22,6 +22,8 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; +import java.util.Locale; + public class RenderSmileyCloud extends TileEntitySpecialRenderer{ @Override @@ -40,22 +42,24 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{ easterEggs: for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){ for(String triggerName : cloud.getTriggerNames()){ - if(StringUtil.equalsToLowerCase(triggerName, theCloud.name)){ - GlStateManager.pushMatrix(); - switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){ - case 1: - GlStateManager.rotate(180, 0, 1, 0); - break; - case 2: - GlStateManager.rotate(270, 0, 1, 0); - break; - case 3: - GlStateManager.rotate(90, 0, 1, 0); - break; + if(triggerName != null && theCloud.name != null){ + if(triggerName.toLowerCase(Locale.ROOT).equals(theCloud.name.toLowerCase(Locale.ROOT))){ + GlStateManager.pushMatrix(); + switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){ + case 1: + GlStateManager.rotate(180, 0, 1, 0); + break; + case 2: + GlStateManager.rotate(270, 0, 1, 0); + break; + case 3: + GlStateManager.rotate(90, 0, 1, 0); + break; + } + cloud.renderExtra(0.0625F); + GlStateManager.popMatrix(); + break easterEggs; } - cloud.renderExtra(0.0625F); - GlStateManager.popMatrix(); - break easterEggs; } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java index 61c5c63ae..a8f02ae4d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/SpecialRenderInit.java @@ -21,6 +21,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Properties; @@ -72,10 +73,13 @@ public class SpecialRenderInit{ if(!specialList.isEmpty()){ for(Map.Entry entry : specialList.entrySet()){ //Does the player have one of the names from the list? - if(StringUtil.equalsToLowerCase(entry.getKey(), event.getEntityPlayer().getName())){ - //Render the special Item/Block - entry.getValue().render(event.getEntityPlayer(), event.getPartialRenderTick()); - break; + String playerName = event.getEntityPlayer().getName(); + if(entry.getKey() != null && playerName != null){ + if(entry.getKey().toLowerCase(Locale.ROOT).equals(playerName.toLowerCase(Locale.ROOT))){ + //Render the special Item/Block + entry.getValue().render(event.getEntityPlayer(), event.getPartialRenderTick()); + break; + } } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index 70e5418a0..f28d555cf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -91,7 +91,7 @@ public class ClientProxy implements IProxy{ Calendar c = Calendar.getInstance(); pumpkinBlurPumpkinBlur = c.get(Calendar.MONTH) == Calendar.OCTOBER; jingleAllTheWay = c.get(Calendar.MONTH) == Calendar.DECEMBER && c.get(Calendar.DAY_OF_MONTH) >= 6 && c.get(Calendar.DAY_OF_MONTH) <= 26; - bulletForMyValentine = (c.get(Calendar.MONTH) == Calendar.FEBRUARY && c.get(Calendar.DAY_OF_MONTH) >= 12 && c.get(Calendar.DAY_OF_MONTH) <= 16) || StringUtil.equalsToLowerCase(Minecraft.getMinecraft().getSession().getUsername(), "pinkhrya"); + bulletForMyValentine = c.get(Calendar.MONTH) == Calendar.FEBRUARY && c.get(Calendar.DAY_OF_MONTH) >= 12 && c.get(Calendar.DAY_OF_MONTH) <= 16; } else{ ModUtil.LOGGER.warn("You have turned Seasonal Mode off. Therefore, you are evil."); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java index 6a54495ca..dc1d22cd8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntitySmileyCloud.java @@ -15,8 +15,6 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import java.util.Objects; - public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor{ public String name; @@ -44,7 +42,7 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac public void updateEntity(){ super.updateEntity(); if(!this.worldObj.isRemote){ - if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){ + if((this.nameBefore == null || !this.nameBefore.equals(this.name)) && this.sendUpdateWithInterval()){ this.nameBefore = this.name; this.markDirty(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java index 3594e4b48..f336099ac 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java @@ -16,7 +16,6 @@ import net.minecraftforge.fluids.FluidTank; import java.util.List; import java.util.Locale; -import java.util.Objects; public class StringUtil{ @@ -39,19 +38,6 @@ public class StringUtil{ return I18n.translateToLocalFormatted(text, replace); } - public static boolean equalsToLowerCase(String one, String two){ - return Objects.equals(toLowerCase(one), toLowerCase(two)); - } - - public static String toLowerCase(String string){ - if(string == null){ - return null; - } - else{ - return string.toLowerCase(Locale.ROOT); - } - } - public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){ List list = renderer.listFormattedStringToWidth(strg, width); for(int i = 0; i < list.size(); i++){