mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +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 de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public enum TheColoredLampColors{
|
public enum TheColoredLampColors{
|
||||||
|
|
||||||
WHITE("White"),
|
WHITE("White"),
|
||||||
|
@ -40,12 +42,17 @@ public enum TheColoredLampColors{
|
||||||
public static TheColoredLampColors getColorFromDyeName(String color){
|
public static TheColoredLampColors getColorFromDyeName(String color){
|
||||||
if(color.substring(0, 3).equals("dye")){
|
if(color.substring(0, 3).equals("dye")){
|
||||||
String actualName = color.substring(3);
|
String actualName = color.substring(3);
|
||||||
|
if(actualName != null){
|
||||||
for(int i = 0; i < values().length; i++){
|
for(int i = 0; i < values().length; i++){
|
||||||
if(StringUtil.equalsToLowerCase(values()[i].name, actualName)){
|
String aName = values()[i].name;
|
||||||
|
if(aName != null){
|
||||||
|
if(aName.toLowerCase(Locale.ROOT).equals(actualName.toLowerCase(Locale.ROOT))){
|
||||||
return values()[i];
|
return values()[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,7 +42,8 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||||
easterEggs:
|
easterEggs:
|
||||||
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
|
for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){
|
||||||
for(String triggerName : cloud.getTriggerNames()){
|
for(String triggerName : cloud.getTriggerNames()){
|
||||||
if(StringUtil.equalsToLowerCase(triggerName, theCloud.name)){
|
if(triggerName != null && theCloud.name != null){
|
||||||
|
if(triggerName.toLowerCase(Locale.ROOT).equals(theCloud.name.toLowerCase(Locale.ROOT))){
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){
|
switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -60,6 +63,7 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){
|
if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){
|
||||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
@ -72,7 +73,9 @@ public class SpecialRenderInit{
|
||||||
if(!specialList.isEmpty()){
|
if(!specialList.isEmpty()){
|
||||||
for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){
|
for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){
|
||||||
//Does the player have one of the names from the list?
|
//Does the player have one of the names from the list?
|
||||||
if(StringUtil.equalsToLowerCase(entry.getKey(), event.getEntityPlayer().getName())){
|
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
|
//Render the special Item/Block
|
||||||
entry.getValue().render(event.getEntityPlayer(), event.getPartialRenderTick());
|
entry.getValue().render(event.getEntityPlayer(), event.getPartialRenderTick());
|
||||||
break;
|
break;
|
||||||
|
@ -80,5 +83,6 @@ public class SpecialRenderInit{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class ClientProxy implements IProxy{
|
||||||
Calendar c = Calendar.getInstance();
|
Calendar c = Calendar.getInstance();
|
||||||
pumpkinBlurPumpkinBlur = c.get(Calendar.MONTH) == Calendar.OCTOBER;
|
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;
|
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{
|
else{
|
||||||
ModUtil.LOGGER.warn("You have turned Seasonal Mode off. Therefore, you are evil.");
|
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.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor{
|
public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor{
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
|
@ -44,7 +42,7 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if(!this.worldObj.isRemote){
|
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.nameBefore = this.name;
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraftforge.fluids.FluidTank;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class StringUtil{
|
public class StringUtil{
|
||||||
|
|
||||||
|
@ -39,19 +38,6 @@ public class StringUtil{
|
||||||
return I18n.translateToLocalFormatted(text, replace);
|
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){
|
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){
|
||||||
List list = renderer.listFormattedStringToWidth(strg, width);
|
List list = renderer.listFormattedStringToWidth(strg, width);
|
||||||
for(int i = 0; i < list.size(); i++){
|
for(int i = 0; i < list.size(); i++){
|
||||||
|
|
Loading…
Reference in a new issue