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,9 +42,14 @@ 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);
|
||||||
for(int i = 0; i < values().length; i++){
|
if(actualName != null){
|
||||||
if(StringUtil.equalsToLowerCase(values()[i].name, actualName)){
|
for(int i = 0; i < values().length; i++){
|
||||||
return values()[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.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,22 +42,24 @@ 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){
|
||||||
GlStateManager.pushMatrix();
|
if(triggerName.toLowerCase(Locale.ROOT).equals(theCloud.name.toLowerCase(Locale.ROOT))){
|
||||||
switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){
|
GlStateManager.pushMatrix();
|
||||||
case 1:
|
switch(PosUtil.getMetadata(theCloud.getPos(), theCloud.getWorld())){
|
||||||
GlStateManager.rotate(180, 0, 1, 0);
|
case 1:
|
||||||
break;
|
GlStateManager.rotate(180, 0, 1, 0);
|
||||||
case 2:
|
break;
|
||||||
GlStateManager.rotate(270, 0, 1, 0);
|
case 2:
|
||||||
break;
|
GlStateManager.rotate(270, 0, 1, 0);
|
||||||
case 3:
|
break;
|
||||||
GlStateManager.rotate(90, 0, 1, 0);
|
case 3:
|
||||||
break;
|
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 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,10 +73,13 @@ 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();
|
||||||
//Render the special Item/Block
|
if(entry.getKey() != null && playerName != null){
|
||||||
entry.getValue().render(event.getEntityPlayer(), event.getPartialRenderTick());
|
if(entry.getKey().toLowerCase(Locale.ROOT).equals(playerName.toLowerCase(Locale.ROOT))){
|
||||||
break;
|
//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();
|
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