mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-23 03:49:22 +01:00
Made ActAdd Java 6 compatible.
Yea.
This commit is contained in:
parent
f034a14a69
commit
3b0b6dab54
6 changed files with 39 additions and 40 deletions
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String, RenderSpecial> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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++){
|
||||
|
|
Loading…
Reference in a new issue