Custom Sky

This commit is contained in:
peytonplayz595 2023-08-31 01:44:59 -05:00
parent e2c9926fd9
commit fd9b51e9e0
25 changed files with 3013 additions and 4 deletions

View File

@ -0,0 +1,121 @@
package net.PeytonPlayz585.shadow;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
public class Blender {
public static final int BLEND_ALPHA = 0;
public static final int BLEND_ADD = 1;
public static final int BLEND_SUBSTRACT = 2;
public static final int BLEND_MULTIPLY = 3;
public static final int BLEND_DODGE = 4;
public static final int BLEND_BURN = 5;
public static final int BLEND_SCREEN = 6;
public static final int BLEND_OVERLAY = 7;
public static final int BLEND_REPLACE = 8;
public static final int BLEND_DEFAULT = 1;
public static int parseBlend(String p_parseBlend_0_) {
if (p_parseBlend_0_ == null) {
return 1;
} else {
p_parseBlend_0_ = p_parseBlend_0_.toLowerCase().trim();
if (p_parseBlend_0_.equals("alpha")) {
return 0;
} else if (p_parseBlend_0_.equals("add")) {
return 1;
} else if (p_parseBlend_0_.equals("subtract")) {
return 2;
} else if (p_parseBlend_0_.equals("multiply")) {
return 3;
} else if (p_parseBlend_0_.equals("dodge")) {
return 4;
} else if (p_parseBlend_0_.equals("burn")) {
return 5;
} else if (p_parseBlend_0_.equals("screen")) {
return 6;
} else if (p_parseBlend_0_.equals("overlay")) {
return 7;
} else if (p_parseBlend_0_.equals("replace")) {
return 8;
} else {
Config.warn("Unknown blend: " + p_parseBlend_0_);
return 1;
}
}
}
public static void setupBlend(int p_setupBlend_0_, float p_setupBlend_1_) {
switch (p_setupBlend_0_) {
case 0:
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 771);
GlStateManager.color(1.0F, 1.0F, 1.0F, p_setupBlend_1_);
break;
case 1:
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 1);
GlStateManager.color(1.0F, 1.0F, 1.0F, p_setupBlend_1_);
break;
case 2:
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(775, 0);
GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F);
break;
case 3:
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(774, 771);
GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_);
break;
case 4:
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(1, 1);
GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F);
break;
case 5:
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(0, 769);
GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F);
break;
case 6:
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(1, 769);
GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F);
break;
case 7:
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(774, 768);
GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F);
break;
case 8:
GlStateManager.enableAlpha();
GlStateManager.disableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, p_setupBlend_1_);
}
GlStateManager.enableTexture2D();
}
public static void clearBlend(float p_clearBlend_0_) {
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 1);
GlStateManager.color(1.0F, 1.0F, 1.0F, p_clearBlend_0_);
}
}

View File

@ -1,10 +1,31 @@
package net.PeytonPlayz585.shadow; package net.PeytonPlayz585.shadow;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultResourcePack;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.ResourcePackRepository;
import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.GameSettings;
import net.minecraft.util.ResourceLocation;
public class Config { public class Config {
private static final Logger LOGGER = LogManager.getLogger();
private static DefaultResourcePack defaultResourcePackLazy = null;
public static boolean isAnimatedWater() { public static boolean isAnimatedWater() {
return Minecraft.getMinecraft().gameSettings.ofAnimatedWater != 2; return Minecraft.getMinecraft().gameSettings.ofAnimatedWater != 2;
} }
@ -72,6 +93,10 @@ public class Config {
public static float getAmbientOcclusionLevel() { public static float getAmbientOcclusionLevel() {
return isShaders() ? 1.0F : Minecraft.getMinecraft().gameSettings.ofAoLevel; return isShaders() ? 1.0F : Minecraft.getMinecraft().gameSettings.ofAoLevel;
} }
public static boolean isCustomSky() {
return Minecraft.getMinecraft().gameSettings.ofCustomSky;
}
public static int limit(int p_limit_0_, int p_limit_1_, int p_limit_2_) { public static int limit(int p_limit_0_, int p_limit_1_, int p_limit_2_) {
return p_limit_0_ < p_limit_1_ ? p_limit_1_ : (p_limit_0_ > p_limit_2_ ? p_limit_2_ : p_limit_0_); return p_limit_0_ < p_limit_1_ ? p_limit_1_ : (p_limit_0_ > p_limit_2_ ? p_limit_2_ : p_limit_0_);
@ -89,8 +114,231 @@ public class Config {
return p_limitTo1_0_ < 0.0F ? 0.0F : (p_limitTo1_0_ > 1.0F ? 1.0F : p_limitTo1_0_); return p_limitTo1_0_ < 0.0F ? 0.0F : (p_limitTo1_0_ > 1.0F ? 1.0F : p_limitTo1_0_);
} }
public static Object[] addObjectToArray(Object[] p_addObjectToArray_0_, Object p_addObjectToArray_1_) {
if (p_addObjectToArray_0_ == null) {
throw new NullPointerException("The given array is NULL");
} else {
int i = p_addObjectToArray_0_.length;
int j = i + 1;
Object[] aobject = (Object[])((Object[])Array.newInstance(p_addObjectToArray_0_.getClass().getComponentType(), j));
System.arraycopy(p_addObjectToArray_0_, 0, aobject, 0, i);
aobject[i] = p_addObjectToArray_1_;
return aobject;
}
}
public static Object[] addObjectToArray(Object[] p_addObjectToArray_0_, Object p_addObjectToArray_1_, int p_addObjectToArray_2_) {
List<Object> list = new ArrayList<Object>(Arrays.asList(p_addObjectToArray_0_));
list.add(p_addObjectToArray_2_, p_addObjectToArray_1_);
Object[] aobject = (Object[])((Object[])Array.newInstance(p_addObjectToArray_0_.getClass().getComponentType(), list.size()));
return list.toArray(aobject);
}
public static Object[] addObjectsToArray(Object[] p_addObjectsToArray_0_, Object[] p_addObjectsToArray_1_) {
if (p_addObjectsToArray_0_ == null) {
throw new NullPointerException("The given array is NULL");
} else if (p_addObjectsToArray_1_.length == 0) {
return p_addObjectsToArray_0_;
} else {
int i = p_addObjectsToArray_0_.length;
int j = i + p_addObjectsToArray_1_.length;
Object[] aobject = (Object[])((Object[])Array.newInstance(p_addObjectsToArray_0_.getClass().getComponentType(), j));
System.arraycopy(p_addObjectsToArray_0_, 0, aobject, 0, i);
System.arraycopy(p_addObjectsToArray_1_, 0, aobject, i, p_addObjectsToArray_1_.length);
return aobject;
}
}
public static int[] addIntToArray(int[] p_addIntToArray_0_, int p_addIntToArray_1_) {
return addIntsToArray(p_addIntToArray_0_, new int[] {p_addIntToArray_1_});
}
public static int[] addIntsToArray(int[] p_addIntsToArray_0_, int[] p_addIntsToArray_1_) {
if (p_addIntsToArray_0_ != null && p_addIntsToArray_1_ != null) {
int i = p_addIntsToArray_0_.length;
int j = i + p_addIntsToArray_1_.length;
int[] aint = new int[j];
System.arraycopy(p_addIntsToArray_0_, 0, aint, 0, i);
for (int k = 0; k < p_addIntsToArray_1_.length; ++k) {
aint[k + i] = p_addIntsToArray_1_[k];
}
return aint;
} else {
throw new NullPointerException("The given array is NULL");
}
}
public static String arrayToString(Object[] p_arrayToString_0_) {
if (p_arrayToString_0_ == null) {
return "";
} else {
StringBuffer stringbuffer = new StringBuffer(p_arrayToString_0_.length * 5);
for (int i = 0; i < p_arrayToString_0_.length; ++i) {
Object object = p_arrayToString_0_[i];
if (i > 0) {
stringbuffer.append(", ");
}
stringbuffer.append(String.valueOf(object));
}
return stringbuffer.toString();
}
}
public static String arrayToString(int[] p_arrayToString_0_) {
if (p_arrayToString_0_ == null) {
return "";
} else {
StringBuffer stringbuffer = new StringBuffer(p_arrayToString_0_.length * 5);
for (int i = 0; i < p_arrayToString_0_.length; ++i) {
int j = p_arrayToString_0_[i];
if (i > 0) {
stringbuffer.append(", ");
}
stringbuffer.append(String.valueOf(j));
}
return stringbuffer.toString();
}
}
public static String[] tokenize(String p_tokenize_0_, String p_tokenize_1_) {
StringTokenizer stringtokenizer = new StringTokenizer(p_tokenize_0_, p_tokenize_1_);
List<String> list = new ArrayList<String>();
while (stringtokenizer.hasMoreTokens()) {
String s = stringtokenizer.nextToken();
list.add(s);
}
String[] astring = (String[])((String[])list.toArray(new String[list.size()]));
return astring;
}
public static int parseInt(String p_parseInt_0_, int p_parseInt_1_) {
try {
if (p_parseInt_0_ == null) {
return p_parseInt_1_;
} else {
p_parseInt_0_ = p_parseInt_0_.trim();
return Integer.parseInt(p_parseInt_0_);
}
} catch (NumberFormatException var3) {
return p_parseInt_1_;
}
}
public static float parseFloat(String p_parseFloat_0_, float p_parseFloat_1_) {
try {
if (p_parseFloat_0_ == null) {
return p_parseFloat_1_;
} else {
p_parseFloat_0_ = p_parseFloat_0_.trim();
return Float.parseFloat(p_parseFloat_0_);
}
} catch (NumberFormatException var3) {
return p_parseFloat_1_;
}
}
public static void dbg(String p_dbg_0_) {
LOGGER.info("[Shadow Client] " + p_dbg_0_);
}
public static void warn(String p_warn_0_) {
LOGGER.warn("[Shadow Client] " + p_warn_0_);
}
public static void error(String p_error_0_) {
LOGGER.error("[Shadow Client] " + p_error_0_);
}
public static void log(String p_log_0_) {
dbg(p_log_0_);
}
public static boolean hasResource(ResourceLocation p_hasResource_0_) {
IResourcePack iresourcepack = getDefiningResourcePack(p_hasResource_0_);
return iresourcepack != null;
}
public static boolean hasResource(IResourceManager p_hasResource_0_, ResourceLocation p_hasResource_1_) {
try {
IResource iresource = p_hasResource_0_.getResource(p_hasResource_1_);
return iresource != null;
} catch (IOException var3) {
return false;
}
}
public static IResourcePack getDefiningResourcePack(ResourceLocation p_getDefiningResourcePack_0_) {
ResourcePackRepository resourcepackrepository = Minecraft.getMinecraft().getResourcePackRepository();
IResourcePack iresourcepack = resourcepackrepository.getResourcePackInstance();
if (iresourcepack != null && iresourcepack.resourceExists(p_getDefiningResourcePack_0_)) {
return iresourcepack;
} else {
List<ResourcePackRepository.Entry> list = (List)Reflector.getFieldValue(resourcepackrepository, Reflector.ResourcePackRepository_repositoryEntries);
if (list != null) {
for (int i = list.size() - 1; i >= 0; --i) {
ResourcePackRepository.Entry resourcepackrepository$entry = (ResourcePackRepository.Entry)list.get(i);
IResourcePack iresourcepack1 = resourcepackrepository$entry.getResourcePack();
if (iresourcepack1.resourceExists(p_getDefiningResourcePack_0_)) {
return iresourcepack1;
}
}
}
return getDefaultResourcePack().resourceExists(p_getDefiningResourcePack_0_) ? getDefaultResourcePack() : null;
}
}
public static DefaultResourcePack getDefaultResourcePack() {
if (defaultResourcePackLazy == null) {
Minecraft minecraft = Minecraft.getMinecraft();
defaultResourcePackLazy = (DefaultResourcePack)Reflector.getFieldValue(minecraft, Reflector.Minecraft_defaultResourcePack);
if (defaultResourcePackLazy == null) {
ResourcePackRepository resourcepackrepository = minecraft.getResourcePackRepository();
if (resourcepackrepository != null) {
defaultResourcePackLazy = (DefaultResourcePack)resourcepackrepository.rprDefaultResourcePack;
}
}
}
return defaultResourcePackLazy;
}
public static InputStream getResourceStream(ResourceLocation p_getResourceStream_0_) throws IOException {
return getResourceStream(Minecraft.getMinecraft().getResourceManager(), p_getResourceStream_0_);
}
public static InputStream getResourceStream(IResourceManager p_getResourceStream_0_, ResourceLocation p_getResourceStream_1_) throws IOException {
IResource iresource = p_getResourceStream_0_.getResource(p_getResourceStream_1_);
return iresource == null ? null : iresource.getInputStream();
}
public static boolean isShaders() { public static boolean isShaders() {
return Minecraft.getMinecraft().gameSettings.shaders; return Minecraft.getMinecraft().gameSettings.shaders;
} }
public static GameSettings getGameSettings() {
return Minecraft.getMinecraft().gameSettings;
}
public static TextureManager getTextureManager() {
return Minecraft.getMinecraft().getTextureManager();
}
} }

View File

@ -0,0 +1,601 @@
package net.PeytonPlayz585.shadow;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.PeytonPlayz585.shadow.math.RangeInt;
import net.PeytonPlayz585.shadow.math.RangeListInt;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.biome.BiomeGenBase;
public class ConnectedParser {
private String context = null;
private static final MatchBlock[] NO_MATCH_BLOCKS = new MatchBlock[0];
public ConnectedParser(String p_i31_1_) {
this.context = p_i31_1_;
}
public String parseName(String p_parseName_1_) {
String s = p_parseName_1_;
int i = p_parseName_1_.lastIndexOf(47);
if (i >= 0) {
s = p_parseName_1_.substring(i + 1);
}
int j = s.lastIndexOf(46);
if (j >= 0) {
s = s.substring(0, j);
}
return s;
}
public String parseBasePath(String p_parseBasePath_1_) {
int i = p_parseBasePath_1_.lastIndexOf(47);
return i < 0 ? "" : p_parseBasePath_1_.substring(0, i);
}
public MatchBlock[] parseMatchBlocks(String p_parseMatchBlocks_1_) {
if (p_parseMatchBlocks_1_ == null) {
return null;
} else {
List list = new ArrayList();
String[] astring = Config.tokenize(p_parseMatchBlocks_1_, " ");
for (int i = 0; i < astring.length; ++i) {
String s = astring[i];
MatchBlock[] amatchblock = this.parseMatchBlock(s);
if (amatchblock == null) {
return NO_MATCH_BLOCKS;
}
list.addAll(Arrays.asList(amatchblock));
}
MatchBlock[] amatchblock1 = (MatchBlock[])((MatchBlock[]) list.toArray(new MatchBlock[list.size()]));
return amatchblock1;
}
}
public MatchBlock[] parseMatchBlock(String p_parseMatchBlock_1_) {
if (p_parseMatchBlock_1_ == null) {
return null;
} else {
p_parseMatchBlock_1_ = p_parseMatchBlock_1_.trim();
if (p_parseMatchBlock_1_.length() <= 0) {
return null;
} else {
String[] astring = Config.tokenize(p_parseMatchBlock_1_, ":");
String s = "minecraft";
int i = 0;
if (astring.length > 1 && this.isFullBlockName(astring)) {
s = astring[0];
i = 1;
} else {
s = "minecraft";
i = 0;
}
String s1 = astring[i];
String[] astring1 = (String[]) Arrays.copyOfRange(astring, i + 1, astring.length);
Block[] ablock = this.parseBlockPart(s, s1);
if (ablock == null) {
return null;
} else {
MatchBlock[] amatchblock = new MatchBlock[ablock.length];
for (int j = 0; j < ablock.length; ++j) {
Block block = ablock[j];
int k = Block.getIdFromBlock(block);
int[] aint = null;
if (astring1.length > 0) {
aint = this.parseBlockMetadatas(block, astring1);
if (aint == null) {
return null;
}
}
MatchBlock matchblock = new MatchBlock(k, aint);
amatchblock[j] = matchblock;
}
return amatchblock;
}
}
}
}
public boolean isFullBlockName(String[] p_isFullBlockName_1_) {
if (p_isFullBlockName_1_.length < 2) {
return false;
} else {
String s = p_isFullBlockName_1_[1];
return s.length() < 1 ? false : (this.startsWithDigit(s) ? false : !s.contains("="));
}
}
public boolean startsWithDigit(String p_startsWithDigit_1_) {
if (p_startsWithDigit_1_ == null) {
return false;
} else if (p_startsWithDigit_1_.length() < 1) {
return false;
} else {
char c0 = p_startsWithDigit_1_.charAt(0);
return Character.isDigit(c0);
}
}
public Block[] parseBlockPart(String p_parseBlockPart_1_, String p_parseBlockPart_2_) {
if (this.startsWithDigit(p_parseBlockPart_2_)) {
int[] aint = this.parseIntList(p_parseBlockPart_2_);
if (aint == null) {
return null;
} else {
Block[] ablock1 = new Block[aint.length];
for (int j = 0; j < aint.length; ++j) {
int i = aint[j];
Block block1 = Block.getBlockById(i);
if (block1 == null) {
this.warn("Block not found for id: " + i);
return null;
}
ablock1[j] = block1;
}
return ablock1;
}
} else {
String s = p_parseBlockPart_1_ + ":" + p_parseBlockPart_2_;
Block block = Block.getBlockFromName(s);
if (block == null) {
this.warn("Block not found for name: " + s);
return null;
} else {
Block[] ablock = new Block[] {
block
};
return ablock;
}
}
}
public int[] parseBlockMetadatas(Block p_parseBlockMetadatas_1_, String[] p_parseBlockMetadatas_2_) {
if (p_parseBlockMetadatas_2_.length <= 0) {
return null;
} else {
String s = p_parseBlockMetadatas_2_[0];
if (this.startsWithDigit(s)) {
int[] aint = this.parseIntList(s);
return aint;
} else {
IBlockState iblockstate = p_parseBlockMetadatas_1_.getDefaultState();
Collection collection = iblockstate.getPropertyNames();
Map < IProperty, List < Comparable >> map = new HashMap();
for (int i = 0; i < p_parseBlockMetadatas_2_.length; ++i) {
String s1 = p_parseBlockMetadatas_2_[i];
if (s1.length() > 0) {
String[] astring = Config.tokenize(s1, "=");
if (astring.length != 2) {
this.warn("Invalid block property: " + s1);
return null;
}
String s2 = astring[0];
String s3 = astring[1];
IProperty iproperty = ConnectedProperties.getProperty(s2, collection);
if (iproperty == null) {
this.warn("Property not found: " + s2 + ", block: " + p_parseBlockMetadatas_1_);
return null;
}
List < Comparable > list = (List) map.get(s2);
if (list == null) {
list = new ArrayList();
map.put(iproperty, list);
}
String[] astring1 = Config.tokenize(s3, ",");
for (int j = 0; j < astring1.length; ++j) {
String s4 = astring1[j];
Comparable comparable = parsePropertyValue(iproperty, s4);
if (comparable == null) {
this.warn("Property value not found: " + s4 + ", property: " + s2 + ", block: " + p_parseBlockMetadatas_1_);
return null;
}
list.add(comparable);
}
}
}
if (map.isEmpty()) {
return null;
} else {
List list1 = new ArrayList();
for (int k = 0; k < 16; ++k) {
int l = k;
try {
IBlockState iblockstate1 = this.getStateFromMeta(p_parseBlockMetadatas_1_, l);
if (this.matchState(iblockstate1, map)) {
list1.add(Integer.valueOf(l));
}
} catch (IllegalArgumentException var18) {
;
}
}
if (list1.size() == 16) {
return null;
} else {
int[] aint1 = new int[list1.size()];
for (int i1 = 0; i1 < aint1.length; ++i1) {
aint1[i1] = ((Integer) list1.get(i1)).intValue();
}
return aint1;
}
}
}
}
}
private IBlockState getStateFromMeta(Block p_getStateFromMeta_1_, int p_getStateFromMeta_2_) {
try {
IBlockState iblockstate = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_);
if (p_getStateFromMeta_1_ == Blocks.double_plant && p_getStateFromMeta_2_ > 7) {
IBlockState iblockstate1 = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_ & 7);
iblockstate = iblockstate.withProperty(BlockDoublePlant.VARIANT, iblockstate1.getValue(BlockDoublePlant.VARIANT));
}
return iblockstate;
} catch (IllegalArgumentException var5) {
return p_getStateFromMeta_1_.getDefaultState();
}
}
public static Comparable parsePropertyValue(IProperty p_parsePropertyValue_0_, String p_parsePropertyValue_1_) {
Class oclass = p_parsePropertyValue_0_.getValueClass();
Comparable comparable = parseValue(p_parsePropertyValue_1_, oclass);
if (comparable == null) {
Collection collection = p_parsePropertyValue_0_.getAllowedValues();
comparable = getPropertyValue(p_parsePropertyValue_1_, collection);
}
return comparable;
}
public static Comparable getPropertyValue(String p_getPropertyValue_0_, Collection p_getPropertyValue_1_) {
for (Object comparable: p_getPropertyValue_1_) {
if (String.valueOf((Object) comparable).equals(p_getPropertyValue_0_)) {
return (Comparable) comparable;
}
}
return null;
}
public static Comparable parseValue(String p_parseValue_0_, Class p_parseValue_1_) {
return (Comparable)(p_parseValue_1_ == String.class ? p_parseValue_0_ : (p_parseValue_1_ == Boolean.class ? Boolean.valueOf(p_parseValue_0_) : (p_parseValue_1_ == Float.class ? Float.valueOf(p_parseValue_0_) : (p_parseValue_1_ == Double.class ? Double.valueOf(p_parseValue_0_) : (p_parseValue_1_ == Integer.class ? Integer.valueOf(p_parseValue_0_) : (p_parseValue_1_ == Long.class ? Long.valueOf(p_parseValue_0_) : null))))));
}
public boolean matchState(IBlockState p_matchState_1_, Map < IProperty, List < Comparable >> p_matchState_2_) {
for (IProperty iproperty: p_matchState_2_.keySet()) {
List < Comparable > list = (List) p_matchState_2_.get(iproperty);
Comparable comparable = p_matchState_1_.getValue(iproperty);
if (comparable == null) {
return false;
}
if (!list.contains(comparable)) {
return false;
}
}
return true;
}
public BiomeGenBase[] parseBiomes(String p_parseBiomes_1_) {
if (p_parseBiomes_1_ == null) {
return null;
} else {
String[] astring = Config.tokenize(p_parseBiomes_1_, " ");
List list = new ArrayList();
for (int i = 0; i < astring.length; ++i) {
String s = astring[i];
BiomeGenBase biomegenbase = this.findBiome(s);
if (biomegenbase == null) {
this.warn("Biome not found: " + s);
} else {
list.add(biomegenbase);
}
}
BiomeGenBase[] abiomegenbase = (BiomeGenBase[])((BiomeGenBase[]) list.toArray(new BiomeGenBase[list.size()]));
return abiomegenbase;
}
}
public BiomeGenBase findBiome(String p_findBiome_1_) {
p_findBiome_1_ = p_findBiome_1_.toLowerCase();
if (p_findBiome_1_.equals("nether")) {
return BiomeGenBase.hell;
} else {
BiomeGenBase[] abiomegenbase = BiomeGenBase.getBiomeGenArray();
for (int i = 0; i < abiomegenbase.length; ++i) {
BiomeGenBase biomegenbase = abiomegenbase[i];
if (biomegenbase != null) {
String s = biomegenbase.biomeName.replace(" ", "").toLowerCase();
if (s.equals(p_findBiome_1_)) {
return biomegenbase;
}
}
}
return null;
}
}
public int parseInt(String p_parseInt_1_) {
if (p_parseInt_1_ == null) {
return -1;
} else {
int i = Config.parseInt(p_parseInt_1_, -1);
if (i < 0) {
this.warn("Invalid number: " + p_parseInt_1_);
}
return i;
}
}
public int parseInt(String p_parseInt_1_, int p_parseInt_2_) {
if (p_parseInt_1_ == null) {
return p_parseInt_2_;
} else {
int i = Config.parseInt(p_parseInt_1_, -1);
if (i < 0) {
this.warn("Invalid number: " + p_parseInt_1_);
return p_parseInt_2_;
} else {
return i;
}
}
}
public int[] parseIntList(String p_parseIntList_1_) {
if (p_parseIntList_1_ == null) {
return null;
} else {
List list = new ArrayList();
String[] astring = Config.tokenize(p_parseIntList_1_, " ,");
for (int i = 0; i < astring.length; ++i) {
String s = astring[i];
if (s.contains("-")) {
String[] astring1 = Config.tokenize(s, "-");
if (astring1.length != 2) {
this.warn("Invalid interval: " + s + ", when parsing: " + p_parseIntList_1_);
} else {
int k = Config.parseInt(astring1[0], -1);
int l = Config.parseInt(astring1[1], -1);
if (k >= 0 && l >= 0 && k <= l) {
for (int i1 = k; i1 <= l; ++i1) {
list.add(Integer.valueOf(i1));
}
} else {
this.warn("Invalid interval: " + s + ", when parsing: " + p_parseIntList_1_);
}
}
} else {
int j = Config.parseInt(s, -1);
if (j < 0) {
this.warn("Invalid number: " + s + ", when parsing: " + p_parseIntList_1_);
} else {
list.add(Integer.valueOf(j));
}
}
}
int[] aint = new int[list.size()];
for (int j1 = 0; j1 < aint.length; ++j1) {
aint[j1] = ((Integer) list.get(j1)).intValue();
}
return aint;
}
}
public boolean[] parseFaces(String p_parseFaces_1_, boolean[] p_parseFaces_2_) {
if (p_parseFaces_1_ == null) {
return p_parseFaces_2_;
} else {
EnumSet enumset = EnumSet.allOf(EnumFacing.class);
String[] astring = Config.tokenize(p_parseFaces_1_, " ,");
for (int i = 0; i < astring.length; ++i) {
String s = astring[i];
if (s.equals("sides")) {
enumset.add(EnumFacing.NORTH);
enumset.add(EnumFacing.SOUTH);
enumset.add(EnumFacing.WEST);
enumset.add(EnumFacing.EAST);
} else if (s.equals("all")) {
enumset.addAll(Arrays.asList(EnumFacing.VALUES));
} else {
EnumFacing enumfacing = this.parseFace(s);
if (enumfacing != null) {
enumset.add(enumfacing);
}
}
}
boolean[] aboolean = new boolean[EnumFacing.VALUES.length];
for (int j = 0; j < aboolean.length; ++j) {
aboolean[j] = enumset.contains(EnumFacing.VALUES[j]);
}
return aboolean;
}
}
public EnumFacing parseFace(String p_parseFace_1_) {
p_parseFace_1_ = p_parseFace_1_.toLowerCase();
if (!p_parseFace_1_.equals("bottom") && !p_parseFace_1_.equals("down")) {
if (!p_parseFace_1_.equals("top") && !p_parseFace_1_.equals("up")) {
if (p_parseFace_1_.equals("north")) {
return EnumFacing.NORTH;
} else if (p_parseFace_1_.equals("south")) {
return EnumFacing.SOUTH;
} else if (p_parseFace_1_.equals("east")) {
return EnumFacing.EAST;
} else if (p_parseFace_1_.equals("west")) {
return EnumFacing.WEST;
} else {
Config.warn("Unknown face: " + p_parseFace_1_);
return null;
}
} else {
return EnumFacing.UP;
}
} else {
return EnumFacing.DOWN;
}
}
public void dbg(String p_dbg_1_) {
Config.dbg("" + this.context + ": " + p_dbg_1_);
}
public void warn(String p_warn_1_) {
Config.warn("" + this.context + ": " + p_warn_1_);
}
public RangeListInt parseRangeListInt(String p_parseRangeListInt_1_) {
if (p_parseRangeListInt_1_ == null) {
return null;
} else {
RangeListInt rangelistint = new RangeListInt();
String[] astring = Config.tokenize(p_parseRangeListInt_1_, " ,");
for (int i = 0; i < astring.length; ++i) {
String s = astring[i];
RangeInt rangeint = this.parseRangeInt(s);
if (rangeint == null) {
return null;
}
rangelistint.addRange(rangeint);
}
return rangelistint;
}
}
private RangeInt parseRangeInt(String p_parseRangeInt_1_) {
if (p_parseRangeInt_1_ == null) {
return null;
} else if (p_parseRangeInt_1_.indexOf(45) >= 0) {
String[] astring = Config.tokenize(p_parseRangeInt_1_, "-");
if (astring.length != 2) {
this.warn("Invalid range: " + p_parseRangeInt_1_);
return null;
} else {
int j = Config.parseInt(astring[0], -1);
int k = Config.parseInt(astring[1], -1);
if (j >= 0 && k >= 0) {
return new RangeInt(j, k);
} else {
this.warn("Invalid range: " + p_parseRangeInt_1_);
return null;
}
}
} else {
int i = Config.parseInt(p_parseRangeInt_1_, -1);
if (i < 0) {
this.warn("Invalid integer: " + p_parseRangeInt_1_);
return null;
} else {
return new RangeInt(i, i);
}
}
}
public static boolean parseBoolean(String p_parseBoolean_0_) {
return p_parseBoolean_0_ == null ? false : p_parseBoolean_0_.toLowerCase().equals("true");
}
public static int parseColor(String p_parseColor_0_, int p_parseColor_1_) {
if (p_parseColor_0_ == null) {
return p_parseColor_1_;
} else {
p_parseColor_0_ = p_parseColor_0_.trim();
try {
int i = Integer.parseInt(p_parseColor_0_, 16) & 16777215;
return i;
} catch (NumberFormatException var3) {
return p_parseColor_1_;
}
}
}
}

View File

@ -0,0 +1,724 @@
package net.PeytonPlayz585.shadow;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
import net.minecraft.block.properties.IProperty;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.BiomeGenBase;
public class ConnectedProperties {
public String name = null;
public String basePath = null;
public MatchBlock[] matchBlocks = null;
public int[] metadatas = null;
public String[] matchTiles = null;
public int method = 0;
public String[] tiles = null;
public int connect = 0;
public int faces = 63;
public BiomeGenBase[] biomes = null;
public int minHeight = 0;
public int maxHeight = 1024;
public int renderPass = 0;
public boolean innerSeams = false;
public int width = 0;
public int height = 0;
public int[] weights = null;
public int symmetry = 1;
public int[] sumWeights = null;
public int sumAllWeights = 1;
public EaglerTextureAtlasSprite[] matchTileIcons = null;
public EaglerTextureAtlasSprite[] tileIcons = null;
public static final int METHOD_NONE = 0;
public static final int METHOD_CTM = 1;
public static final int METHOD_HORIZONTAL = 2;
public static final int METHOD_TOP = 3;
public static final int METHOD_RANDOM = 4;
public static final int METHOD_REPEAT = 5;
public static final int METHOD_VERTICAL = 6;
public static final int METHOD_FIXED = 7;
public static final int METHOD_HORIZONTAL_VERTICAL = 8;
public static final int METHOD_VERTICAL_HORIZONTAL = 9;
public static final int CONNECT_NONE = 0;
public static final int CONNECT_BLOCK = 1;
public static final int CONNECT_TILE = 2;
public static final int CONNECT_MATERIAL = 3;
public static final int CONNECT_UNKNOWN = 128;
public static final int FACE_BOTTOM = 1;
public static final int FACE_TOP = 2;
public static final int FACE_NORTH = 4;
public static final int FACE_SOUTH = 8;
public static final int FACE_WEST = 16;
public static final int FACE_EAST = 32;
public static final int FACE_SIDES = 60;
public static final int FACE_ALL = 63;
public static final int FACE_UNKNOWN = 128;
public static final int SYMMETRY_NONE = 1;
public static final int SYMMETRY_OPPOSITE = 2;
public static final int SYMMETRY_ALL = 6;
public static final int SYMMETRY_UNKNOWN = 128;
public ConnectedProperties(Properties p_i32_1_, String p_i32_2_) {
ConnectedParser connectedparser = new ConnectedParser("ConnectedTextures");
this.name = connectedparser.parseName(p_i32_2_);
this.basePath = connectedparser.parseBasePath(p_i32_2_);
this.matchBlocks = connectedparser.parseMatchBlocks(p_i32_1_.getProperty("matchBlocks"));
this.metadatas = connectedparser.parseIntList(p_i32_1_.getProperty("metadata"));
this.matchTiles = this.parseMatchTiles(p_i32_1_.getProperty("matchTiles"));
this.method = parseMethod(p_i32_1_.getProperty("method"));
this.tiles = this.parseTileNames(p_i32_1_.getProperty("tiles"));
this.connect = parseConnect(p_i32_1_.getProperty("connect"));
this.faces = parseFaces(p_i32_1_.getProperty("faces"));
this.biomes = connectedparser.parseBiomes(p_i32_1_.getProperty("biomes"));
this.minHeight = connectedparser.parseInt(p_i32_1_.getProperty("minHeight"), -1);
this.maxHeight = connectedparser.parseInt(p_i32_1_.getProperty("maxHeight"), 1024);
this.renderPass = connectedparser.parseInt(p_i32_1_.getProperty("renderPass"));
this.innerSeams = ConnectedParser.parseBoolean(p_i32_1_.getProperty("innerSeams"));
this.width = connectedparser.parseInt(p_i32_1_.getProperty("width"));
this.height = connectedparser.parseInt(p_i32_1_.getProperty("height"));
this.weights = connectedparser.parseIntList(p_i32_1_.getProperty("weights"));
this.symmetry = parseSymmetry(p_i32_1_.getProperty("symmetry"));
}
private String[] parseMatchTiles(String p_parseMatchTiles_1_) {
if (p_parseMatchTiles_1_ == null) {
return null;
} else {
String[] astring = Config.tokenize(p_parseMatchTiles_1_, " ");
for (int i = 0; i < astring.length; ++i) {
String s = astring[i];
if (s.endsWith(".png")) {
s = s.substring(0, s.length() - 4);
}
s = TextureUtils.fixResourcePath(s, this.basePath);
astring[i] = s;
}
return astring;
}
}
private static String parseName(String p_parseName_0_) {
String s = p_parseName_0_;
int i = p_parseName_0_.lastIndexOf(47);
if (i >= 0) {
s = p_parseName_0_.substring(i + 1);
}
int j = s.lastIndexOf(46);
if (j >= 0) {
s = s.substring(0, j);
}
return s;
}
private static String parseBasePath(String p_parseBasePath_0_) {
int i = p_parseBasePath_0_.lastIndexOf(47);
return i < 0 ? "" : p_parseBasePath_0_.substring(0, i);
}
private String[] parseTileNames(String p_parseTileNames_1_) {
if (p_parseTileNames_1_ == null) {
return null;
} else {
List list = new ArrayList();
String[] astring = Config.tokenize(p_parseTileNames_1_, " ,");
label32:
for (int i = 0; i < astring.length; ++i) {
String s = astring[i];
if (s.contains("-")) {
String[] astring1 = Config.tokenize(s, "-");
if (astring1.length == 2) {
int j = Config.parseInt(astring1[0], -1);
int k = Config.parseInt(astring1[1], -1);
if (j >= 0 && k >= 0) {
if (j > k) {
Config.warn("Invalid interval: " + s + ", when parsing: " + p_parseTileNames_1_);
continue;
}
int l = j;
while (true) {
if (l > k) {
continue label32;
}
list.add(String.valueOf(l));
++l;
}
}
}
}
list.add(s);
}
String[] astring2 = (String[])((String[]) list.toArray(new String[list.size()]));
for (int i1 = 0; i1 < astring2.length; ++i1) {
String s1 = astring2[i1];
s1 = TextureUtils.fixResourcePath(s1, this.basePath);
if (!s1.startsWith(this.basePath) && !s1.startsWith("textures/") && !s1.startsWith("mcpatcher/")) {
s1 = this.basePath + "/" + s1;
}
if (s1.endsWith(".png")) {
s1 = s1.substring(0, s1.length() - 4);
}
String s2 = "textures/blocks/";
if (s1.startsWith(s2)) {
s1 = s1.substring(s2.length());
}
if (s1.startsWith("/")) {
s1 = s1.substring(1);
}
astring2[i1] = s1;
}
return astring2;
}
}
private static int parseSymmetry(String p_parseSymmetry_0_) {
if (p_parseSymmetry_0_ == null) {
return 1;
} else if (p_parseSymmetry_0_.equals("opposite")) {
return 2;
} else if (p_parseSymmetry_0_.equals("all")) {
return 6;
} else {
Config.warn("Unknown symmetry: " + p_parseSymmetry_0_);
return 1;
}
}
private static int parseFaces(String p_parseFaces_0_) {
if (p_parseFaces_0_ == null) {
return 63;
} else {
String[] astring = Config.tokenize(p_parseFaces_0_, " ,");
int i = 0;
for (int j = 0; j < astring.length; ++j) {
String s = astring[j];
int k = parseFace(s);
i |= k;
}
return i;
}
}
private static int parseFace(String p_parseFace_0_) {
p_parseFace_0_ = p_parseFace_0_.toLowerCase();
if (!p_parseFace_0_.equals("bottom") && !p_parseFace_0_.equals("down")) {
if (!p_parseFace_0_.equals("top") && !p_parseFace_0_.equals("up")) {
if (p_parseFace_0_.equals("north")) {
return 4;
} else if (p_parseFace_0_.equals("south")) {
return 8;
} else if (p_parseFace_0_.equals("east")) {
return 32;
} else if (p_parseFace_0_.equals("west")) {
return 16;
} else if (p_parseFace_0_.equals("sides")) {
return 60;
} else if (p_parseFace_0_.equals("all")) {
return 63;
} else {
Config.warn("Unknown face: " + p_parseFace_0_);
return 128;
}
} else {
return 2;
}
} else {
return 1;
}
}
private static int parseConnect(String p_parseConnect_0_) {
if (p_parseConnect_0_ == null) {
return 0;
} else if (p_parseConnect_0_.equals("block")) {
return 1;
} else if (p_parseConnect_0_.equals("tile")) {
return 2;
} else if (p_parseConnect_0_.equals("material")) {
return 3;
} else {
Config.warn("Unknown connect: " + p_parseConnect_0_);
return 128;
}
}
public static IProperty getProperty(String p_getProperty_0_, Collection p_getProperty_1_) {
for (Object iproperty: p_getProperty_1_) {
if (p_getProperty_0_.equals(((IProperty) iproperty).getName())) {
return (IProperty) iproperty;
}
}
return null;
}
private static int parseMethod(String p_parseMethod_0_) {
if (p_parseMethod_0_ == null) {
return 1;
} else if (!p_parseMethod_0_.equals("ctm") && !p_parseMethod_0_.equals("glass")) {
if (!p_parseMethod_0_.equals("horizontal") && !p_parseMethod_0_.equals("bookshelf")) {
if (p_parseMethod_0_.equals("vertical")) {
return 6;
} else if (p_parseMethod_0_.equals("top")) {
return 3;
} else if (p_parseMethod_0_.equals("random")) {
return 4;
} else if (p_parseMethod_0_.equals("repeat")) {
return 5;
} else if (p_parseMethod_0_.equals("fixed")) {
return 7;
} else if (!p_parseMethod_0_.equals("horizontal+vertical") && !p_parseMethod_0_.equals("h+v")) {
if (!p_parseMethod_0_.equals("vertical+horizontal") && !p_parseMethod_0_.equals("v+h")) {
Config.warn("Unknown method: " + p_parseMethod_0_);
return 0;
} else {
return 9;
}
} else {
return 8;
}
} else {
return 2;
}
} else {
return 1;
}
}
public boolean isValid(String p_isValid_1_) {
if (this.name != null && this.name.length() > 0) {
if (this.basePath == null) {
Config.warn("No base path found: " + p_isValid_1_);
return false;
} else {
if (this.matchBlocks == null) {
this.matchBlocks = this.detectMatchBlocks();
}
if (this.matchTiles == null && this.matchBlocks == null) {
this.matchTiles = this.detectMatchTiles();
}
if (this.matchBlocks == null && this.matchTiles == null) {
Config.warn("No matchBlocks or matchTiles specified: " + p_isValid_1_);
return false;
} else if (this.method == 0) {
Config.warn("No method: " + p_isValid_1_);
return false;
} else if (this.tiles != null && this.tiles.length > 0) {
if (this.connect == 0) {
this.connect = this.detectConnect();
}
if (this.connect == 128) {
Config.warn("Invalid connect in: " + p_isValid_1_);
return false;
} else if (this.renderPass > 0) {
Config.warn("Render pass not supported: " + this.renderPass);
return false;
} else if ((this.faces & 128) != 0) {
Config.warn("Invalid faces in: " + p_isValid_1_);
return false;
} else if ((this.symmetry & 128) != 0) {
Config.warn("Invalid symmetry in: " + p_isValid_1_);
return false;
} else {
switch (this.method) {
case 1:
return this.isValidCtm(p_isValid_1_);
case 2:
return this.isValidHorizontal(p_isValid_1_);
case 3:
return this.isValidTop(p_isValid_1_);
case 4:
return this.isValidRandom(p_isValid_1_);
case 5:
return this.isValidRepeat(p_isValid_1_);
case 6:
return this.isValidVertical(p_isValid_1_);
case 7:
return this.isValidFixed(p_isValid_1_);
case 8:
return this.isValidHorizontalVertical(p_isValid_1_);
case 9:
return this.isValidVerticalHorizontal(p_isValid_1_);
default:
Config.warn("Unknown method: " + p_isValid_1_);
return false;
}
}
} else {
Config.warn("No tiles specified: " + p_isValid_1_);
return false;
}
}
} else {
Config.warn("No name found: " + p_isValid_1_);
return false;
}
}
private int detectConnect() {
return this.matchBlocks != null ? 1 : (this.matchTiles != null ? 2 : 128);
}
private MatchBlock[] detectMatchBlocks() {
int[] aint = this.detectMatchBlockIds();
if (aint == null) {
return null;
} else {
MatchBlock[] amatchblock = new MatchBlock[aint.length];
for (int i = 0; i < amatchblock.length; ++i) {
amatchblock[i] = new MatchBlock(aint[i]);
}
return amatchblock;
}
}
private int[] detectMatchBlockIds() {
if (!this.name.startsWith("block")) {
return null;
} else {
int i = "block".length();
int j;
for (j = i; j < this.name.length(); ++j) {
char c0 = this.name.charAt(j);
if (c0 < 48 || c0 > 57) {
break;
}
}
if (j == i) {
return null;
} else {
String s = this.name.substring(i, j);
int k = Config.parseInt(s, -1);
return k < 0 ? null : new int[] {
k
};
}
}
}
private String[] detectMatchTiles() {
EaglerTextureAtlasSprite textureatlassprite = getIcon(this.name);
return textureatlassprite == null ? null : new String[] {
this.name
};
}
private static EaglerTextureAtlasSprite getIcon(String p_getIcon_0_) {
TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks();
EaglerTextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite(p_getIcon_0_);
if (textureatlassprite != null) {
return textureatlassprite;
} else {
textureatlassprite = texturemap.getAtlasSprite("blocks/" + p_getIcon_0_);
return textureatlassprite;
}
}
private boolean isValidCtm(String p_isValidCtm_1_) {
if (this.tiles == null) {
this.tiles = this.parseTileNames("0-11 16-27 32-43 48-58");
}
if (this.tiles.length < 47) {
Config.warn("Invalid tiles, must be at least 47: " + p_isValidCtm_1_);
return false;
} else {
return true;
}
}
private boolean isValidHorizontal(String p_isValidHorizontal_1_) {
if (this.tiles == null) {
this.tiles = this.parseTileNames("12-15");
}
if (this.tiles.length != 4) {
Config.warn("Invalid tiles, must be exactly 4: " + p_isValidHorizontal_1_);
return false;
} else {
return true;
}
}
private boolean isValidVertical(String p_isValidVertical_1_) {
if (this.tiles == null) {
Config.warn("No tiles defined for vertical: " + p_isValidVertical_1_);
return false;
} else if (this.tiles.length != 4) {
Config.warn("Invalid tiles, must be exactly 4: " + p_isValidVertical_1_);
return false;
} else {
return true;
}
}
private boolean isValidHorizontalVertical(String p_isValidHorizontalVertical_1_) {
if (this.tiles == null) {
Config.warn("No tiles defined for horizontal+vertical: " + p_isValidHorizontalVertical_1_);
return false;
} else if (this.tiles.length != 7) {
Config.warn("Invalid tiles, must be exactly 7: " + p_isValidHorizontalVertical_1_);
return false;
} else {
return true;
}
}
private boolean isValidVerticalHorizontal(String p_isValidVerticalHorizontal_1_) {
if (this.tiles == null) {
Config.warn("No tiles defined for vertical+horizontal: " + p_isValidVerticalHorizontal_1_);
return false;
} else if (this.tiles.length != 7) {
Config.warn("Invalid tiles, must be exactly 7: " + p_isValidVerticalHorizontal_1_);
return false;
} else {
return true;
}
}
private boolean isValidRandom(String p_isValidRandom_1_) {
if (this.tiles != null && this.tiles.length > 0) {
if (this.weights != null) {
if (this.weights.length > this.tiles.length) {
Config.warn("More weights defined than tiles, trimming weights: " + p_isValidRandom_1_);
int[] aint = new int[this.tiles.length];
System.arraycopy(this.weights, 0, aint, 0, aint.length);
this.weights = aint;
}
if (this.weights.length < this.tiles.length) {
Config.warn("Less weights defined than tiles, expanding weights: " + p_isValidRandom_1_);
int[] aint1 = new int[this.tiles.length];
System.arraycopy(this.weights, 0, aint1, 0, this.weights.length);
int i = MathUtils.getAverage(this.weights);
for (int j = this.weights.length; j < aint1.length; ++j) {
aint1[j] = i;
}
this.weights = aint1;
}
this.sumWeights = new int[this.weights.length];
int k = 0;
for (int l = 0; l < this.weights.length; ++l) {
k += this.weights[l];
this.sumWeights[l] = k;
}
this.sumAllWeights = k;
if (this.sumAllWeights <= 0) {
Config.warn("Invalid sum of all weights: " + k);
this.sumAllWeights = 1;
}
}
return true;
} else {
Config.warn("Tiles not defined: " + p_isValidRandom_1_);
return false;
}
}
private boolean isValidRepeat(String p_isValidRepeat_1_) {
if (this.tiles == null) {
Config.warn("Tiles not defined: " + p_isValidRepeat_1_);
return false;
} else if (this.width > 0 && this.width <= 16) {
if (this.height > 0 && this.height <= 16) {
if (this.tiles.length != this.width * this.height) {
Config.warn("Number of tiles does not equal width x height: " + p_isValidRepeat_1_);
return false;
} else {
return true;
}
} else {
Config.warn("Invalid height: " + p_isValidRepeat_1_);
return false;
}
} else {
Config.warn("Invalid width: " + p_isValidRepeat_1_);
return false;
}
}
private boolean isValidFixed(String p_isValidFixed_1_) {
if (this.tiles == null) {
Config.warn("Tiles not defined: " + p_isValidFixed_1_);
return false;
} else if (this.tiles.length != 1) {
Config.warn("Number of tiles should be 1 for method: fixed.");
return false;
} else {
return true;
}
}
private boolean isValidTop(String p_isValidTop_1_) {
if (this.tiles == null) {
this.tiles = this.parseTileNames("66");
}
if (this.tiles.length != 1) {
Config.warn("Invalid tiles, must be exactly 1: " + p_isValidTop_1_);
return false;
} else {
return true;
}
}
public void updateIcons(TextureMap p_updateIcons_1_) {
if (this.matchTiles != null) {
this.matchTileIcons = registerIcons(this.matchTiles, p_updateIcons_1_);
}
if (this.tiles != null) {
this.tileIcons = registerIcons(this.tiles, p_updateIcons_1_);
}
}
private static EaglerTextureAtlasSprite[] registerIcons(String[] p_registerIcons_0_, TextureMap p_registerIcons_1_) {
if (p_registerIcons_0_ == null) {
return null;
} else {
List list = new ArrayList();
for (int i = 0; i < p_registerIcons_0_.length; ++i) {
String s = p_registerIcons_0_[i];
ResourceLocation resourcelocation = new ResourceLocation(s);
String s1 = resourcelocation.getResourceDomain();
String s2 = resourcelocation.getResourcePath();
if (!s2.contains("/")) {
s2 = "textures/blocks/" + s2;
}
String s3 = s2 + ".png";
ResourceLocation resourcelocation1 = new ResourceLocation(s1, s3);
boolean flag = Config.hasResource(resourcelocation1);
if (!flag) {
Config.warn("File not found: " + s3);
}
String s4 = "textures/";
String s5 = s2;
if (s2.startsWith(s4)) {
s5 = s2.substring(s4.length());
}
ResourceLocation resourcelocation2 = new ResourceLocation(s1, s5);
EaglerTextureAtlasSprite textureatlassprite = p_registerIcons_1_.registerSprite(resourcelocation2);
list.add(textureatlassprite);
}
EaglerTextureAtlasSprite[] atextureatlassprite = (EaglerTextureAtlasSprite[])((EaglerTextureAtlasSprite[]) list.toArray(new EaglerTextureAtlasSprite[list.size()]));
return atextureatlassprite;
}
}
public boolean matchesBlockId(int p_matchesBlockId_1_) {
return Matches.blockId(p_matchesBlockId_1_, this.matchBlocks);
}
public boolean matchesBlock(int p_matchesBlock_1_, int p_matchesBlock_2_) {
return !Matches.block(p_matchesBlock_1_, p_matchesBlock_2_, this.matchBlocks) ? false : Matches.metadata(p_matchesBlock_2_, this.metadatas);
}
public boolean matchesIcon(EaglerTextureAtlasSprite p_matchesIcon_1_) {
return Matches.sprite(p_matchesIcon_1_, this.matchTileIcons);
}
public String toString() {
return "CTM name: " + this.name + ", basePath: " + this.basePath + ", matchBlocks: " + Config.arrayToString((Object[]) this.matchBlocks) + ", matchTiles: " + Config.arrayToString((Object[]) this.matchTiles);
}
public boolean matchesBiome(BiomeGenBase p_matchesBiome_1_) {
return Matches.biome(p_matchesBiome_1_, this.biomes);
}
public int getMetadataMax() {
int i = -1;
i = this.getMax(this.metadatas, i);
if (this.matchBlocks != null) {
for (int j = 0; j < this.matchBlocks.length; ++j) {
MatchBlock matchblock = this.matchBlocks[j];
i = this.getMax(matchblock.getMetadatas(), i);
}
}
return i;
}
private int getMax(int[] p_getMax_1_, int p_getMax_2_) {
if (p_getMax_1_ == null) {
return p_getMax_2_;
} else {
for (int i = 0; i < p_getMax_1_.length; ++i) {
int j = p_getMax_1_[i];
if (j > p_getMax_2_) {
p_getMax_2_ = j;
}
}
return p_getMax_2_;
}
}
}

View File

@ -0,0 +1,136 @@
package net.PeytonPlayz585.shadow;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class CustomSky {
private static CustomSkyLayer[][] worldSkyLayers = (CustomSkyLayer[][])null;
public static void reset() {
worldSkyLayers = (CustomSkyLayer[][])null;
}
public static void update() {
reset();
if (Config.isCustomSky()) {
worldSkyLayers = readCustomSkies();
}
}
private static CustomSkyLayer[][] readCustomSkies() {
CustomSkyLayer[][] acustomskylayer = new CustomSkyLayer[10][0];
String s = "mcpatcher/sky/world";
int i = -1;
for (int j = 0; j < acustomskylayer.length; ++j) {
String s1 = s + j + "/sky";
List list = new ArrayList();
for (int k = 1; k < 1000; ++k) {
String s2 = s1 + k + ".properties";
try {
ResourceLocation resourcelocation = new ResourceLocation(s2);
InputStream inputstream = Config.getResourceStream(resourcelocation);
if (inputstream == null) {
break;
}
Properties properties = new Properties();
properties.load(inputstream);
inputstream.close();
String s3 = s1 + k + ".png";
CustomSkyLayer customskylayer = new CustomSkyLayer(properties, s3);
if (customskylayer.isValid(s2)) {
ResourceLocation resourcelocation1 = new ResourceLocation(customskylayer.source);
ITextureObject itextureobject = TextureUtils.getTexture(resourcelocation1);
if (!(itextureobject == null)) {
customskylayer.textureId = itextureobject.getGlTextureId();
list.add(customskylayer);
inputstream.close();
}
}
} catch (FileNotFoundException var15) {
break;
} catch (IOException ioexception) {
ioexception.printStackTrace();
}
}
if (list.size() > 0) {
CustomSkyLayer[] acustomskylayer2 = (CustomSkyLayer[])((CustomSkyLayer[])list.toArray(new CustomSkyLayer[list.size()]));
acustomskylayer[j] = acustomskylayer2;
i = j;
}
}
if (i < 0) {
return (CustomSkyLayer[][])null;
} else {
int l = i + 1;
CustomSkyLayer[][] acustomskylayer1 = new CustomSkyLayer[l][0];
for (int i1 = 0; i1 < acustomskylayer1.length; ++i1) {
acustomskylayer1[i1] = acustomskylayer[i1];
}
return acustomskylayer1;
}
}
public static void renderSky(World p_renderSky_0_, TextureManager p_renderSky_1_, float p_renderSky_2_, float p_renderSky_3_) {
if (worldSkyLayers != null) {
if (Config.getGameSettings().renderDistanceChunks >= 8) {
int i = p_renderSky_0_.provider.getDimensionId();
if (i >= 0 && i < worldSkyLayers.length) {
CustomSkyLayer[] acustomskylayer = worldSkyLayers[i];
if (acustomskylayer != null) {
long j = p_renderSky_0_.getWorldTime();
int k = (int)(j % 24000L);
for (int l = 0; l < acustomskylayer.length; ++l) {
CustomSkyLayer customskylayer = acustomskylayer[l];
if (customskylayer.isActive(p_renderSky_0_, k)) {
customskylayer.render(k, p_renderSky_2_, p_renderSky_3_);
}
}
Blender.clearBlend(p_renderSky_3_);
}
}
}
}
}
public static boolean hasSkyLayers(World p_hasSkyLayers_0_) {
if (worldSkyLayers == null) {
return false;
} else if (Config.getGameSettings().renderDistanceChunks < 8) {
return false;
} else {
int i = p_hasSkyLayers_0_.provider.getDimensionId();
if (i >= 0 && i < worldSkyLayers.length) {
CustomSkyLayer[] acustomskylayer = worldSkyLayers[i];
return acustomskylayer == null ? false : acustomskylayer.length > 0;
} else {
return false;
}
}
}
}

View File

@ -0,0 +1,297 @@
package net.PeytonPlayz585.shadow;
import java.util.Properties;
import net.PeytonPlayz585.shadow.math.RangeListInt;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.world.World;
public class CustomSkyLayer {
public String source = null;
private int startFadeIn = -1;
private int endFadeIn = -1;
private int startFadeOut = -1;
private int endFadeOut = -1;
private int blend = 1;
private boolean rotate = false;
private float speed = 1.0F;
private float[] axis;
private RangeListInt days;
private int daysLoop;
public int textureId;
public static final float[] DEFAULT_AXIS = new float[] {
1.0F, 0.0F, 0.0F
};
public CustomSkyLayer(Properties p_i35_1_, String p_i35_2_) {
this.axis = DEFAULT_AXIS;
this.days = null;
this.daysLoop = 8;
this.textureId = -1;
ConnectedParser connectedparser = new ConnectedParser("CustomSky");
this.source = p_i35_1_.getProperty("source", p_i35_2_);
this.startFadeIn = this.parseTime(p_i35_1_.getProperty("startFadeIn"));
this.endFadeIn = this.parseTime(p_i35_1_.getProperty("endFadeIn"));
this.startFadeOut = this.parseTime(p_i35_1_.getProperty("startFadeOut"));
this.endFadeOut = this.parseTime(p_i35_1_.getProperty("endFadeOut"));
this.blend = Blender.parseBlend(p_i35_1_.getProperty("blend"));
this.rotate = this.parseBoolean(p_i35_1_.getProperty("rotate"), true);
this.speed = this.parseFloat(p_i35_1_.getProperty("speed"), 1.0F);
this.axis = this.parseAxis(p_i35_1_.getProperty("axis"), DEFAULT_AXIS);
this.days = connectedparser.parseRangeListInt(p_i35_1_.getProperty("days"));
this.daysLoop = connectedparser.parseInt(p_i35_1_.getProperty("daysLoop"), 8);
}
private int parseTime(String p_parseTime_1_) {
if (p_parseTime_1_ == null) {
return -1;
} else {
String[] astring = Config.tokenize(p_parseTime_1_, ":");
if (astring.length != 2) {
Config.warn("Invalid time: " + p_parseTime_1_);
return -1;
} else {
String s = astring[0];
String s1 = astring[1];
int i = Config.parseInt(s, -1);
int j = Config.parseInt(s1, -1);
if (i >= 0 && i <= 23 && j >= 0 && j <= 59) {
i = i - 6;
if (i < 0) {
i += 24;
}
int k = i * 1000 + (int)((double) j / 60.0D * 1000.0D);
return k;
} else {
Config.warn("Invalid time: " + p_parseTime_1_);
return -1;
}
}
}
}
private boolean parseBoolean(String p_parseBoolean_1_, boolean p_parseBoolean_2_) {
if (p_parseBoolean_1_ == null) {
return p_parseBoolean_2_;
} else if (p_parseBoolean_1_.toLowerCase().equals("true")) {
return true;
} else if (p_parseBoolean_1_.toLowerCase().equals("false")) {
return false;
} else {
Config.warn("Unknown boolean: " + p_parseBoolean_1_);
return p_parseBoolean_2_;
}
}
private float parseFloat(String p_parseFloat_1_, float p_parseFloat_2_) {
if (p_parseFloat_1_ == null) {
return p_parseFloat_2_;
} else {
float f = Config.parseFloat(p_parseFloat_1_, Float.MIN_VALUE);
if (f == Float.MIN_VALUE) {
Config.warn("Invalid value: " + p_parseFloat_1_);
return p_parseFloat_2_;
} else {
return f;
}
}
}
private float[] parseAxis(String p_parseAxis_1_, float[] p_parseAxis_2_) {
if (p_parseAxis_1_ == null) {
return p_parseAxis_2_;
} else {
String[] astring = Config.tokenize(p_parseAxis_1_, " ");
if (astring.length != 3) {
Config.warn("Invalid axis: " + p_parseAxis_1_);
return p_parseAxis_2_;
} else {
float[] afloat = new float[3];
for (int i = 0; i < astring.length; ++i) {
afloat[i] = Config.parseFloat(astring[i], Float.MIN_VALUE);
if (afloat[i] == Float.MIN_VALUE) {
Config.warn("Invalid axis: " + p_parseAxis_1_);
return p_parseAxis_2_;
}
if (afloat[i] < -1.0F || afloat[i] > 1.0F) {
Config.warn("Invalid axis values: " + p_parseAxis_1_);
return p_parseAxis_2_;
}
}
float f2 = afloat[0];
float f = afloat[1];
float f1 = afloat[2];
if (f2 * f2 + f * f + f1 * f1 < 1.0E-5F) {
Config.warn("Invalid axis values: " + p_parseAxis_1_);
return p_parseAxis_2_;
} else {
float[] afloat1 = new float[] {
f1,
f,
-f2
};
return afloat1;
}
}
}
}
public boolean isValid(String p_isValid_1_) {
if (this.source == null) {
Config.warn("No source texture: " + p_isValid_1_);
return false;
} else {
this.source = TextureUtils.fixResourcePath(this.source, TextureUtils.getBasePath(p_isValid_1_));
if (this.startFadeIn >= 0 && this.endFadeIn >= 0 && this.endFadeOut >= 0) {
int i = this.normalizeTime(this.endFadeIn - this.startFadeIn);
if (this.startFadeOut < 0) {
this.startFadeOut = this.normalizeTime(this.endFadeOut - i);
if (this.timeBetween(this.startFadeOut, this.startFadeIn, this.endFadeIn)) {
this.startFadeOut = this.endFadeIn;
}
}
int j = this.normalizeTime(this.startFadeOut - this.endFadeIn);
int k = this.normalizeTime(this.endFadeOut - this.startFadeOut);
int l = this.normalizeTime(this.startFadeIn - this.endFadeOut);
int i1 = i + j + k + l;
if (i1 != 24000) {
Config.warn("Invalid fadeIn/fadeOut times, sum is not 24h: " + i1);
return false;
} else if (this.speed < 0.0F) {
Config.warn("Invalid speed: " + this.speed);
return false;
} else if (this.daysLoop <= 0) {
Config.warn("Invalid daysLoop: " + this.daysLoop);
return false;
} else {
return true;
}
} else {
Config.warn("Invalid times, required are: startFadeIn, endFadeIn and endFadeOut.");
return false;
}
}
}
private int normalizeTime(int p_normalizeTime_1_) {
while (p_normalizeTime_1_ >= 24000) {
p_normalizeTime_1_ -= 24000;
}
while (p_normalizeTime_1_ < 0) {
p_normalizeTime_1_ += 24000;
}
return p_normalizeTime_1_;
}
public void render(int p_render_1_, float p_render_2_, float p_render_3_) {
float f = p_render_3_ * this.getFadeBrightness(p_render_1_);
f = Config.limit(f, 0.0F, 1.0F);
if (f >= 1.0E-4F) {
GlStateManager.bindTexture(this.textureId);
Blender.setupBlend(this.blend, f);
GlStateManager.pushMatrix();
if (this.rotate) {
GlStateManager.rotate(p_render_2_ * 360.0F * this.speed, this.axis[0], this.axis[1], this.axis[2]);
}
Tessellator tessellator = Tessellator.getInstance();
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
this.renderSide(tessellator, 4);
GlStateManager.pushMatrix();
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
this.renderSide(tessellator, 1);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
this.renderSide(tessellator, 0);
GlStateManager.popMatrix();
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
this.renderSide(tessellator, 5);
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
this.renderSide(tessellator, 2);
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
this.renderSide(tessellator, 3);
GlStateManager.popMatrix();
}
}
private float getFadeBrightness(int p_getFadeBrightness_1_) {
if (this.timeBetween(p_getFadeBrightness_1_, this.startFadeIn, this.endFadeIn)) {
int k = this.normalizeTime(this.endFadeIn - this.startFadeIn);
int l = this.normalizeTime(p_getFadeBrightness_1_ - this.startFadeIn);
return (float) l / (float) k;
} else if (this.timeBetween(p_getFadeBrightness_1_, this.endFadeIn, this.startFadeOut)) {
return 1.0F;
} else if (this.timeBetween(p_getFadeBrightness_1_, this.startFadeOut, this.endFadeOut)) {
int i = this.normalizeTime(this.endFadeOut - this.startFadeOut);
int j = this.normalizeTime(p_getFadeBrightness_1_ - this.startFadeOut);
return 1.0F - (float) j / (float) i;
} else {
return 0.0F;
}
}
private void renderSide(Tessellator p_renderSide_1_, int p_renderSide_2_) {
WorldRenderer worldrenderer = p_renderSide_1_.getWorldRenderer();
double d0 = (double)(p_renderSide_2_ % 3) / 3.0D;
double d1 = (double)(p_renderSide_2_ / 3) / 2.0D;
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-100.0D, -100.0D, -100.0D).tex(d0, d1).endVertex();
worldrenderer.pos(-100.0D, -100.0D, 100.0D).tex(d0, d1 + 0.5D).endVertex();
worldrenderer.pos(100.0D, -100.0D, 100.0D).tex(d0 + 0.3333333333333333D, d1 + 0.5D).endVertex();
worldrenderer.pos(100.0D, -100.0D, -100.0D).tex(d0 + 0.3333333333333333D, d1).endVertex();
p_renderSide_1_.draw();
}
public boolean isActive(World p_isActive_1_, int p_isActive_2_) {
if (this.timeBetween(p_isActive_2_, this.endFadeOut, this.startFadeIn)) {
return false;
} else {
if (this.days != null) {
long i = p_isActive_1_.getWorldTime();
long j;
for (j = i - (long) this.startFadeIn; j < 0L; j += (long)(24000 * this.daysLoop)) {
;
}
int k = (int)(j / 24000L);
int l = k % this.daysLoop;
if (!this.days.isInRange(l)) {
return false;
}
}
return true;
}
}
private boolean timeBetween(int p_timeBetween_1_, int p_timeBetween_2_, int p_timeBetween_3_) {
return p_timeBetween_2_ <= p_timeBetween_3_ ? p_timeBetween_1_ >= p_timeBetween_2_ && p_timeBetween_1_ <= p_timeBetween_3_ : p_timeBetween_1_ >= p_timeBetween_2_ || p_timeBetween_1_ <= p_timeBetween_3_;
}
}

View File

@ -0,0 +1,15 @@
package net.PeytonPlayz585.shadow;
import java.lang.reflect.Field;
public class FieldLocatorFixed implements IFieldLocator {
private Field field;
public FieldLocatorFixed(Field p_i37_1_) {
this.field = p_i37_1_;
}
public Field getField() {
return this.field;
}
}

View File

@ -0,0 +1,36 @@
package net.PeytonPlayz585.shadow;
import java.lang.reflect.Field;
public class FieldLocatorName implements IFieldLocator {
private ReflectorClass reflectorClass = null;
private String targetFieldName = null;
public FieldLocatorName(ReflectorClass p_i38_1_, String p_i38_2_) {
this.reflectorClass = p_i38_1_;
this.targetFieldName = p_i38_2_;
}
public Field getField() {
Class oclass = this.reflectorClass.getTargetClass();
if (oclass == null) {
return null;
} else {
try {
Field field = oclass.getDeclaredField(this.targetFieldName);
field.setAccessible(true);
return field;
} catch (NoSuchFieldException var3) {
Config.log("(Reflector) Field not present: " + oclass.getName() + "." + this.targetFieldName);
return null;
} catch (SecurityException securityexception) {
securityexception.printStackTrace();
return null;
} catch (Throwable throwable) {
throwable.printStackTrace();
return null;
}
}
}
}

View File

@ -0,0 +1,56 @@
package net.PeytonPlayz585.shadow;
import java.lang.reflect.Field;
public class FieldLocatorType implements IFieldLocator {
private ReflectorClass reflectorClass;
private Class targetFieldType;
private int targetFieldIndex;
public FieldLocatorType(ReflectorClass p_i39_1_, Class p_i39_2_) {
this(p_i39_1_, p_i39_2_, 0);
}
public FieldLocatorType(ReflectorClass p_i40_1_, Class p_i40_2_, int p_i40_3_) {
this.reflectorClass = null;
this.targetFieldType = null;
this.reflectorClass = p_i40_1_;
this.targetFieldType = p_i40_2_;
this.targetFieldIndex = p_i40_3_;
}
public Field getField() {
Class oclass = this.reflectorClass.getTargetClass();
if (oclass == null) {
return null;
} else {
try {
Field[] afield = oclass.getDeclaredFields();
int i = 0;
for (int j = 0; j < afield.length; ++j) {
Field field = afield[j];
if (field.getType() == this.targetFieldType) {
if (i == this.targetFieldIndex) {
field.setAccessible(true);
return field;
}
++i;
}
}
Config.log("(Reflector) Field not present: " + oclass.getName() + ".(type: " + this.targetFieldType + ", index: " + this.targetFieldIndex + ")");
return null;
} catch (SecurityException securityexception) {
securityexception.printStackTrace();
return null;
} catch (Throwable throwable) {
throwable.printStackTrace();
return null;
}
}
}
}

View File

@ -0,0 +1,7 @@
package net.PeytonPlayz585.shadow;
import java.lang.reflect.Field;
public interface IFieldLocator {
Field getField();
}

View File

@ -0,0 +1,61 @@
package net.PeytonPlayz585.shadow;
import net.minecraft.block.state.BlockStateBase;
public class MatchBlock {
private int blockId = -1;
private int[] metadatas = null;
public MatchBlock(int p_i63_1_) {
this.blockId = p_i63_1_;
}
public MatchBlock(int p_i64_1_, int p_i64_2_) {
this.blockId = p_i64_1_;
if (p_i64_2_ >= 0 && p_i64_2_ <= 15) {
this.metadatas = new int[] {
p_i64_2_
};
}
}
public MatchBlock(int p_i65_1_, int[] p_i65_2_) {
this.blockId = p_i65_1_;
this.metadatas = p_i65_2_;
}
public int getBlockId() {
return this.blockId;
}
public int[] getMetadatas() {
return this.metadatas;
}
public boolean matches(BlockStateBase p_matches_1_) {
return p_matches_1_.getBlockId() != this.blockId ? false : Matches.metadata(p_matches_1_.getMetadata(), this.metadatas);
}
public boolean matches(int p_matches_1_, int p_matches_2_) {
return p_matches_1_ != this.blockId ? false : Matches.metadata(p_matches_2_, this.metadatas);
}
public void addMetadata(int p_addMetadata_1_) {
if (this.metadatas != null) {
if (p_addMetadata_1_ >= 0 && p_addMetadata_1_ <= 15) {
for (int i = 0; i < this.metadatas.length; ++i) {
if (this.metadatas[i] == p_addMetadata_1_) {
return;
}
}
this.metadatas = Config.addIntToArray(this.metadatas, p_addMetadata_1_);
}
}
}
public String toString() {
return "" + this.blockId + ":" + Config.arrayToString(this.metadatas);
}
}

View File

@ -0,0 +1,97 @@
package net.PeytonPlayz585.shadow;
import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
import net.minecraft.block.state.BlockStateBase;
import net.minecraft.world.biome.BiomeGenBase;
public class Matches {
public static boolean block(BlockStateBase p_block_0_, MatchBlock[] p_block_1_) {
if (p_block_1_ == null) {
return true;
} else {
for (int i = 0; i < p_block_1_.length; ++i) {
MatchBlock matchblock = p_block_1_[i];
if (matchblock.matches(p_block_0_)) {
return true;
}
}
return false;
}
}
public static boolean block(int p_block_0_, int p_block_1_, MatchBlock[] p_block_2_) {
if (p_block_2_ == null) {
return true;
} else {
for (int i = 0; i < p_block_2_.length; ++i) {
MatchBlock matchblock = p_block_2_[i];
if (matchblock.matches(p_block_0_, p_block_1_)) {
return true;
}
}
return false;
}
}
public static boolean blockId(int p_blockId_0_, MatchBlock[] p_blockId_1_) {
if (p_blockId_1_ == null) {
return true;
} else {
for (int i = 0; i < p_blockId_1_.length; ++i) {
MatchBlock matchblock = p_blockId_1_[i];
if (matchblock.getBlockId() == p_blockId_0_) {
return true;
}
}
return false;
}
}
public static boolean metadata(int p_metadata_0_, int[] p_metadata_1_) {
if (p_metadata_1_ == null) {
return true;
} else {
for (int i = 0; i < p_metadata_1_.length; ++i) {
if (p_metadata_1_[i] == p_metadata_0_) {
return true;
}
}
return false;
}
}
public static boolean sprite(EaglerTextureAtlasSprite p_sprite_0_, EaglerTextureAtlasSprite[] p_sprite_1_) {
if (p_sprite_1_ == null) {
return true;
} else {
for (int i = 0; i < p_sprite_1_.length; ++i) {
if (p_sprite_1_[i] == p_sprite_0_) {
return true;
}
}
return false;
}
}
public static boolean biome(BiomeGenBase p_biome_0_, BiomeGenBase[] p_biome_1_) {
if (p_biome_1_ == null) {
return true;
} else {
for (int i = 0; i < p_biome_1_.length; ++i) {
if (p_biome_1_[i] == p_biome_0_) {
return true;
}
}
return false;
}
}
}

View File

@ -0,0 +1,19 @@
package net.PeytonPlayz585.shadow;
public class MathUtils {
public static int getAverage(int[] p_getAverage_0_) {
if (p_getAverage_0_.length <= 0) {
return 0;
} else {
int i = 0;
for (int j = 0; j < p_getAverage_0_.length; ++j) {
int k = p_getAverage_0_[j];
i += k;
}
int l = i / p_getAverage_0_.length;
return l;
}
}
}

View File

@ -0,0 +1,93 @@
package net.PeytonPlayz585.shadow;
import java.lang.reflect.Field;
import java.util.List;
import net.minecraft.client.resources.DefaultResourcePack;
public class Reflector {
public static ReflectorClass ResourcePackRepository = new ReflectorClass(net.minecraft.client.resources.ResourcePackRepository.class);
public static ReflectorField ResourcePackRepository_repositoryEntries = new ReflectorField(ResourcePackRepository, List.class, 1);
public static ReflectorClass Minecraft = new ReflectorClass(net.minecraft.client.Minecraft.class);
public static ReflectorField Minecraft_defaultResourcePack = new ReflectorField(Minecraft, DefaultResourcePack.class);
public static Object getFieldValue(ReflectorField p_getFieldValue_0_) {
return getFieldValue((Object) null, p_getFieldValue_0_);
}
public static Object getFieldValue(Object p_getFieldValue_0_, ReflectorField p_getFieldValue_1_) {
try {
Field field = p_getFieldValue_1_.getTargetField();
if (field == null) {
return null;
} else {
Object object = field.get(p_getFieldValue_0_);
return object;
}
} catch (Throwable throwable) {
throwable.printStackTrace();
return null;
}
}
public static Object getFieldValue(ReflectorFields p_getFieldValue_0_, int p_getFieldValue_1_) {
ReflectorField reflectorfield = p_getFieldValue_0_.getReflectorField(p_getFieldValue_1_);
return reflectorfield == null ? null : getFieldValue(reflectorfield);
}
public static Object getFieldValue(Object p_getFieldValue_0_, ReflectorFields p_getFieldValue_1_, int p_getFieldValue_2_) {
ReflectorField reflectorfield = p_getFieldValue_1_.getReflectorField(p_getFieldValue_2_);
return reflectorfield == null ? null : getFieldValue(p_getFieldValue_0_, reflectorfield);
}
public static float getFieldValueFloat(Object p_getFieldValueFloat_0_, ReflectorField p_getFieldValueFloat_1_, float p_getFieldValueFloat_2_) {
Object object = getFieldValue(p_getFieldValueFloat_0_, p_getFieldValueFloat_1_);
if (!(object instanceof Float)) {
return p_getFieldValueFloat_2_;
} else {
Float f = (Float) object;
return f.floatValue();
}
}
public static boolean setFieldValue(ReflectorField p_setFieldValue_0_, Object p_setFieldValue_1_) {
return setFieldValue((Object) null, p_setFieldValue_0_, p_setFieldValue_1_);
}
public static boolean setFieldValue(Object p_setFieldValue_0_, ReflectorField p_setFieldValue_1_, Object p_setFieldValue_2_) {
try {
Field field = p_setFieldValue_1_.getTargetField();
if (field == null) {
return false;
} else {
field.set(p_setFieldValue_0_, p_setFieldValue_2_);
return true;
}
} catch (Throwable throwable) {
throwable.printStackTrace();
return false;
}
}
public static boolean matchesTypes(Class[] p_matchesTypes_0_, Class[] p_matchesTypes_1_) {
if (p_matchesTypes_0_.length != p_matchesTypes_1_.length) {
return false;
} else {
for (int i = 0; i < p_matchesTypes_1_.length; ++i) {
Class<?> oclass = p_matchesTypes_0_[i];
Class<?> oclass1 = p_matchesTypes_1_[i];
if (oclass != oclass1) {
return false;
}
}
return true;
}
}
}

View File

@ -0,0 +1,77 @@
package net.PeytonPlayz585.shadow;
public class ReflectorClass {
private String targetClassName;
private boolean checked;
private Class targetClass;
public ReflectorClass(String p_i81_1_) {
this(p_i81_1_, false);
}
public ReflectorClass(String p_i82_1_, boolean p_i82_2_) {
this.targetClassName = null;
this.checked = false;
this.targetClass = null;
this.targetClassName = p_i82_1_;
if (!p_i82_2_) {
Class oclass = this.getTargetClass();
}
}
public ReflectorClass(Class p_i83_1_) {
this.targetClassName = null;
this.checked = false;
this.targetClass = null;
this.targetClass = p_i83_1_;
this.targetClassName = p_i83_1_.getName();
this.checked = true;
}
public Class getTargetClass() {
if (this.checked) {
return this.targetClass;
} else {
this.checked = true;
try {
this.targetClass = Class.forName(this.targetClassName);
} catch (ClassNotFoundException var2) {
Config.log("(Reflector) Class not present: " + this.targetClassName);
} catch (Throwable throwable) {
throwable.printStackTrace();
}
return this.targetClass;
}
}
public boolean exists() {
return this.getTargetClass() != null;
}
public String getTargetClassName() {
return this.targetClassName;
}
public boolean isInstance(Object p_isInstance_1_) {
return this.getTargetClass() == null ? false : this.getTargetClass().isInstance(p_isInstance_1_);
}
public ReflectorField makeField(String p_makeField_1_) {
return new ReflectorField(this, p_makeField_1_);
}
public ReflectorMethod makeMethod(String p_makeMethod_1_) {
return new ReflectorMethod(this, p_makeMethod_1_);
}
public ReflectorMethod makeMethod(String p_makeMethod_1_, Class[] p_makeMethod_2_) {
return new ReflectorMethod(this, p_makeMethod_1_, p_makeMethod_2_);
}
public ReflectorMethod makeMethod(String p_makeMethod_1_, Class[] p_makeMethod_2_, boolean p_makeMethod_3_) {
return new ReflectorMethod(this, p_makeMethod_1_, p_makeMethod_2_, p_makeMethod_3_);
}
}

View File

@ -0,0 +1,64 @@
package net.PeytonPlayz585.shadow;
import java.lang.reflect.Field;
public class ReflectorField {
private IFieldLocator fieldLocator;
private boolean checked;
private Field targetField;
public ReflectorField(ReflectorClass p_i85_1_, String p_i85_2_) {
this((IFieldLocator)(new FieldLocatorName(p_i85_1_, p_i85_2_)));
}
public ReflectorField(ReflectorClass p_i86_1_, Class p_i86_2_) {
this(p_i86_1_, p_i86_2_, 0);
}
public ReflectorField(ReflectorClass p_i87_1_, Class p_i87_2_, int p_i87_3_) {
this((IFieldLocator)(new FieldLocatorType(p_i87_1_, p_i87_2_, p_i87_3_)));
}
public ReflectorField(Field p_i88_1_) {
this((IFieldLocator)(new FieldLocatorFixed(p_i88_1_)));
}
public ReflectorField(IFieldLocator p_i89_1_) {
this.fieldLocator = null;
this.checked = false;
this.targetField = null;
this.fieldLocator = p_i89_1_;
this.getTargetField();
}
public Field getTargetField() {
if (this.checked) {
return this.targetField;
} else {
this.checked = true;
this.targetField = this.fieldLocator.getField();
if (this.targetField != null) {
this.targetField.setAccessible(true);
}
return this.targetField;
}
}
public Object getValue() {
return Reflector.getFieldValue((Object) null, this);
}
public void setValue(Object p_setValue_1_) {
Reflector.setFieldValue((Object) null, this, p_setValue_1_);
}
public void setValue(Object p_setValue_1_, Object p_setValue_2_) {
Reflector.setFieldValue(p_setValue_1_, this, p_setValue_2_);
}
public boolean exists() {
return this.getTargetField() != null;
}
}

View File

@ -0,0 +1,39 @@
package net.PeytonPlayz585.shadow;
public class ReflectorFields {
private ReflectorClass reflectorClass;
private Class fieldType;
private int fieldCount;
private ReflectorField[] reflectorFields;
public ReflectorFields(ReflectorClass p_i90_1_, Class p_i90_2_, int p_i90_3_) {
this.reflectorClass = p_i90_1_;
this.fieldType = p_i90_2_;
if (p_i90_1_.exists()) {
if (p_i90_2_ != null) {
this.reflectorFields = new ReflectorField[p_i90_3_];
for (int i = 0; i < this.reflectorFields.length; ++i) {
this.reflectorFields[i] = new ReflectorField(p_i90_1_, p_i90_2_, i);
}
}
}
}
public ReflectorClass getReflectorClass() {
return this.reflectorClass;
}
public Class getFieldType() {
return this.fieldType;
}
public int getFieldCount() {
return this.fieldCount;
}
public ReflectorField getReflectorField(int p_getReflectorField_1_) {
return p_getReflectorField_1_ >= 0 && p_getReflectorField_1_ < this.reflectorFields.length ? this.reflectorFields[p_getReflectorField_1_] : null;
}
}

View File

@ -0,0 +1,134 @@
package net.PeytonPlayz585.shadow;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
public class ReflectorMethod {
private ReflectorClass reflectorClass;
private String targetMethodName;
private Class[] targetMethodParameterTypes;
private boolean checked;
private Method targetMethod;
public ReflectorMethod(ReflectorClass p_i91_1_, String p_i91_2_) {
this(p_i91_1_, p_i91_2_, (Class[]) null, false);
}
public ReflectorMethod(ReflectorClass p_i92_1_, String p_i92_2_, Class[] p_i92_3_) {
this(p_i92_1_, p_i92_2_, p_i92_3_, false);
}
public ReflectorMethod(ReflectorClass p_i93_1_, String p_i93_2_, Class[] p_i93_3_, boolean p_i93_4_) {
this.reflectorClass = null;
this.targetMethodName = null;
this.targetMethodParameterTypes = null;
this.checked = false;
this.targetMethod = null;
this.reflectorClass = p_i93_1_;
this.targetMethodName = p_i93_2_;
this.targetMethodParameterTypes = p_i93_3_;
if (!p_i93_4_) {
Method method = this.getTargetMethod();
}
}
public Method getTargetMethod() {
if (this.checked) {
return this.targetMethod;
} else {
this.checked = true;
Class oclass = this.reflectorClass.getTargetClass();
if (oclass == null) {
return null;
} else {
try {
if (this.targetMethodParameterTypes == null) {
Method[] amethod = getMethods(oclass, this.targetMethodName);
if (amethod.length <= 0) {
Config.log("(Reflector) Method not present: " + oclass.getName() + "." + this.targetMethodName);
return null;
}
if (amethod.length > 1) {
Config.warn("(Reflector) More than one method found: " + oclass.getName() + "." + this.targetMethodName);
for (int i = 0; i < amethod.length; ++i) {
Method method = amethod[i];
Config.warn("(Reflector) - " + method);
}
return null;
}
this.targetMethod = amethod[0];
} else {
this.targetMethod = getMethod(oclass, this.targetMethodName, this.targetMethodParameterTypes);
}
if (this.targetMethod == null) {
Config.log("(Reflector) Method not present: " + oclass.getName() + "." + this.targetMethodName);
return null;
} else {
this.targetMethod.setAccessible(true);
return this.targetMethod;
}
} catch (Throwable throwable) {
throwable.printStackTrace();
return null;
}
}
}
}
public boolean exists() {
return this.checked ? this.targetMethod != null : this.getTargetMethod() != null;
}
public Class getReturnType() {
Method method = this.getTargetMethod();
return method == null ? null : method.getReturnType();
}
public void deactivate() {
this.checked = true;
this.targetMethod = null;
}
public static Method getMethod(Class p_getMethod_0_, String p_getMethod_1_, Class[] p_getMethod_2_) {
Method[] amethod = p_getMethod_0_.getDeclaredMethods();
for (int i = 0; i < amethod.length; ++i) {
Method method = amethod[i];
if (method.getName().equals(p_getMethod_1_)) {
Class[] aclass = method.getParameterTypes();
if (Reflector.matchesTypes(p_getMethod_2_, aclass)) {
return method;
}
}
}
return null;
}
public static Method[] getMethods(Class p_getMethods_0_, String p_getMethods_1_) {
List list = new ArrayList();
Method[] amethod = p_getMethods_0_.getDeclaredMethods();
for (int i = 0; i < amethod.length; ++i) {
Method method = amethod[i];
if (method.getName().equals(p_getMethods_1_)) {
list.add(method);
}
}
Method[] amethod1 = (Method[])((Method[]) list.toArray(new Method[list.size()]));
return amethod1;
}
}

View File

@ -1,5 +1,9 @@
package net.PeytonPlayz585.shadow; package net.PeytonPlayz585.shadow;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.util.ResourceLocation;
public class TextureUtils { public class TextureUtils {
static TextureMap texturemap = new TextureMap(); static TextureMap texturemap = new TextureMap();
@ -24,6 +28,60 @@ public class TextureUtils {
public static String iconCompass = texturemap.getSpriteSafe(s1 + "compass"); public static String iconCompass = texturemap.getSpriteSafe(s1 + "compass");
public static String iconClock = texturemap.getSpriteSafe(s1 + "clock"); public static String iconClock = texturemap.getSpriteSafe(s1 + "clock");
public static String fixResourcePath(String p_fixResourcePath_0_, String p_fixResourcePath_1_) {
String s = "assets/minecraft/";
if (p_fixResourcePath_0_.startsWith(s)) {
p_fixResourcePath_0_ = p_fixResourcePath_0_.substring(s.length());
return p_fixResourcePath_0_;
} else if (p_fixResourcePath_0_.startsWith("./")) {
p_fixResourcePath_0_ = p_fixResourcePath_0_.substring(2);
if (!p_fixResourcePath_1_.endsWith("/")) {
p_fixResourcePath_1_ = p_fixResourcePath_1_ + "/";
}
p_fixResourcePath_0_ = p_fixResourcePath_1_ + p_fixResourcePath_0_;
return p_fixResourcePath_0_;
} else {
if (p_fixResourcePath_0_.startsWith("/~")) {
p_fixResourcePath_0_ = p_fixResourcePath_0_.substring(1);
}
String s1 = "mcpatcher/";
if (p_fixResourcePath_0_.startsWith("~/")) {
p_fixResourcePath_0_ = p_fixResourcePath_0_.substring(2);
p_fixResourcePath_0_ = s1 + p_fixResourcePath_0_;
return p_fixResourcePath_0_;
} else if (p_fixResourcePath_0_.startsWith("/")) {
p_fixResourcePath_0_ = s1 + p_fixResourcePath_0_.substring(1);
return p_fixResourcePath_0_;
} else {
return p_fixResourcePath_0_;
}
}
}
public static String getBasePath(String p_getBasePath_0_) {
int i = p_getBasePath_0_.lastIndexOf(47);
return i < 0 ? "" : p_getBasePath_0_.substring(0, i);
}
public static ITextureObject getTexture(ResourceLocation p_getTexture_0_) {
ITextureObject itextureobject = Config.getTextureManager().getTexture(p_getTexture_0_);
if (itextureobject != null) {
return itextureobject;
} else if (!Config.hasResource(p_getTexture_0_)) {
return null;
} else {
SimpleTexture simpletexture = new SimpleTexture(p_getTexture_0_);
Config.getTextureManager().loadTexture(p_getTexture_0_, simpletexture);
return simpletexture;
}
}
static class TextureMap { static class TextureMap {
public TextureMap() { public TextureMap() {

View File

@ -0,0 +1,27 @@
package net.PeytonPlayz585.shadow.math;
public class RangeInt {
private int min;
private int max;
public RangeInt(int p_i80_1_, int p_i80_2_) {
this.min = Math.min(p_i80_1_, p_i80_2_);
this.max = Math.max(p_i80_1_, p_i80_2_);
}
public boolean isInRange(int p_isInRange_1_) {
return p_isInRange_1_ < this.min ? false : p_isInRange_1_ <= this.max;
}
public int getMin() {
return this.min;
}
public int getMax() {
return this.max;
}
public String toString() {
return "min: " + this.min + ", max: " + this.max;
}
}

View File

@ -0,0 +1,50 @@
package net.PeytonPlayz585.shadow.math;
import net.PeytonPlayz585.shadow.Config;
public class RangeListInt {
private RangeInt[] ranges = new RangeInt[0];
public void addRange(RangeInt p_addRange_1_) {
this.ranges = (RangeInt[])((RangeInt[])Config.addObjectToArray(this.ranges, p_addRange_1_));
}
public boolean isInRange(int p_isInRange_1_) {
for (int i = 0; i < this.ranges.length; ++i) {
RangeInt rangeint = this.ranges[i];
if (rangeint.isInRange(p_isInRange_1_)) {
return true;
}
}
return false;
}
public int getCountRanges() {
return this.ranges.length;
}
public RangeInt getRange(int p_getRange_1_) {
return this.ranges[p_getRange_1_];
}
public String toString() {
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append("[");
for (int i = 0; i < this.ranges.length; ++i) {
RangeInt rangeint = this.ranges[i];
if (i > 0)
{
stringbuffer.append(", ");
}
stringbuffer.append(rangeint.toString());
}
stringbuffer.append("]");
return stringbuffer.toString();
}
}

View File

@ -23,6 +23,34 @@ public abstract class BlockStateBase implements IBlockState {
} }
} }
}; };
private int blockId = -1;
private int blockStateId = -1;
private int metadata = -1;
public int getBlockId() {
if (this.blockId < 0) {
this.blockId = Block.getIdFromBlock(this.getBlock());
}
return this.blockId;
}
public int getBlockStateId() {
if (this.blockStateId < 0) {
this.blockStateId = Block.getStateId(this);
}
return this.blockStateId;
}
public int getMetadata() {
if (this.metadata < 0) {
this.metadata = this.getBlock().getMetaFromState(this);
}
return this.metadata;
}
public <T extends Comparable<T>> IBlockState cycleProperty(IProperty<T> property) { public <T extends Comparable<T>> IBlockState cycleProperty(IProperty<T> property) {
return this.withProperty(property, return this.withProperty(property,

View File

@ -10,6 +10,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import net.PeytonPlayz585.shadow.Config; import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.CustomSky;
import net.PeytonPlayz585.shadow.opengl.OpenGLManager; import net.PeytonPlayz585.shadow.opengl.OpenGLManager;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.HString; import net.lax1dude.eaglercraft.v1_8.HString;
@ -1357,6 +1358,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
float f16 = 1.0F - this.theWorld.getRainStrength(partialTicks); float f16 = 1.0F - this.theWorld.getRainStrength(partialTicks);
GlStateManager.color(1.0F, 1.0F, 1.0F, f16); GlStateManager.color(1.0F, 1.0F, 1.0F, f16);
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
CustomSky.renderSky(this.theWorld, this.renderEngine, this.theWorld.getCelestialAngle(partialTicks), f16);
GlStateManager.rotate(this.theWorld.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(this.theWorld.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
float f17 = 30.0F; float f17 = 30.0F;
this.renderEngine.bindTexture(locationSunPng); this.renderEngine.bindTexture(locationSunPng);
@ -1396,7 +1398,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
GlStateManager.color(0.0F, 0.0F, 0.0F); GlStateManager.color(0.0F, 0.0F, 0.0F);
double d0 = this.mc.thePlayer.getPositionEyes(partialTicks).yCoord - this.theWorld.getHorizon(); double d0 = this.mc.thePlayer.getPositionEyes(partialTicks).yCoord - this.theWorld.getHorizon();
if (d0 < 0.0D) { if (d0 < 0.0D && !CustomSky.hasSkyLayers(this.theWorld)) {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 12.0F, 0.0F); GlStateManager.translate(0.0F, 12.0F, 0.0F);
GlStateManager.callList(this.glSkyList2); GlStateManager.callList(this.glSkyList2);

View File

@ -17,6 +17,7 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import net.PeytonPlayz585.shadow.Config; import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.CustomSky;
import net.lax1dude.eaglercraft.v1_8.ArrayUtils; import net.lax1dude.eaglercraft.v1_8.ArrayUtils;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglerInputStream; import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
@ -198,6 +199,9 @@ public class GameSettings {
public float ofAoLevel = 1.0F; public float ofAoLevel = 1.0F;
public boolean useVbo = false; public boolean useVbo = false;
//Quality Settings
public boolean ofCustomSky = true;
//Optifine Animations //Optifine Animations
public int ofAnimatedWater = 0; public int ofAnimatedWater = 0;
public int ofAnimatedLava = 0; public int ofAnimatedLava = 0;
@ -555,6 +559,11 @@ public class GameSettings {
this.useVbo = !this.useVbo; this.useVbo = !this.useVbo;
this.mc.renderGlobal.loadRenderers(); this.mc.renderGlobal.loadRenderers();
} }
if (parOptions == GameSettings.Options.CUSTOM_SKY) {
this.ofCustomSky = !this.ofCustomSky;
CustomSky.update();
}
this.saveOptions(); this.saveOptions();
} }
@ -624,6 +633,8 @@ public class GameSettings {
return this.mc.isFullScreen(); return this.mc.isFullScreen();
case USE_VBO: case USE_VBO:
return this.useVbo; return this.useVbo;
case CUSTOM_SKY:
return this.ofCustomSky;
default: default:
return false; return false;
} }
@ -748,7 +759,9 @@ public class GameSettings {
return this.ofAnimatedTextures ? s + "ON" : s + "OFF"; return this.ofAnimatedTextures ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.USE_VBO) { } else if (parOptions == GameSettings.Options.USE_VBO) {
return this.useVbo ? s + "ON" : s + "OFF"; return this.useVbo ? s + "ON" : s + "OFF";
} else { } else if (parOptions == GameSettings.Options.CUSTOM_SKY) {
return this.ofCustomSky ? s + "ON" : s + "OFF";
} else {
return s; return s;
} }
} }
@ -1106,6 +1119,10 @@ public class GameSettings {
if (astring[0].equals("useVbo")) { if (astring[0].equals("useVbo")) {
this.useVbo = astring[1].equals("true"); this.useVbo = astring[1].equals("true");
} }
if (astring[0].equals("ofCustomSky") && astring.length >= 2) {
this.ofCustomSky = Boolean.valueOf(astring[1]).booleanValue();
}
Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode()); Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
@ -1232,6 +1249,7 @@ public class GameSettings {
printwriter.println("ofAnimatedTextures:" + this.ofAnimatedTextures); printwriter.println("ofAnimatedTextures:" + this.ofAnimatedTextures);
printwriter.println("ofAoLevel:" + this.ofAoLevel); printwriter.println("ofAoLevel:" + this.ofAoLevel);
printwriter.println("useVbo:" + this.useVbo); printwriter.println("useVbo:" + this.useVbo);
printwriter.println("ofCustomSky:" + this.ofCustomSky);
for (KeyBinding keybinding : this.keyBindings) { for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode()); printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -1393,7 +1411,8 @@ public class GameSettings {
ANIMATED_TERRAIN("Terrain Animated", false, false), ANIMATED_TERRAIN("Terrain Animated", false, false),
ANIMATED_TEXTURES("Textures Animated", false, false), ANIMATED_TEXTURES("Textures Animated", false, false),
AO_LEVEL("Smooth Lighting Level", true, false), AO_LEVEL("Smooth Lighting Level", true, false),
USE_VBO("Use VBOs", false, false); USE_VBO("Use VBOs", false, false),
CUSTOM_SKY("Custom Sky", false, false);
private final boolean enumFloat; private final boolean enumFloat;
private final boolean enumBoolean; private final boolean enumBoolean;

View File

@ -44,7 +44,7 @@ public enum EnumFacing implements IStringSerializable {
/**+ /**+
* All facings in D-U-N-S-W-E order * All facings in D-U-N-S-W-E order
*/ */
private static final EnumFacing[] VALUES = new EnumFacing[6]; public static final EnumFacing[] VALUES = new EnumFacing[6];
/**+ /**+
* All Facings with horizontal axis in order S-W-N-E * All Facings with horizontal axis in order S-W-N-E
*/ */