mirror of
https://github.com/Eaglercraft-Archive/Eaglercraftx-1.8.8-src.git
synced 2025-06-28 10:58:15 -05:00
Update #48 - Added some features from OptiFine
This commit is contained in:
97
sources/main/java/net/optifine/config/Matches.java
Normal file
97
sources/main/java/net/optifine/config/Matches.java
Normal file
@ -0,0 +1,97 @@
|
||||
package net.optifine.config;
|
||||
|
||||
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 blockStateBase, MatchBlock[] matchBlocks) {
|
||||
if (matchBlocks == null) {
|
||||
return true;
|
||||
} else {
|
||||
for (int i = 0; i < matchBlocks.length; ++i) {
|
||||
MatchBlock matchblock = matchBlocks[i];
|
||||
|
||||
if (matchblock.matches(blockStateBase)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean block(int blockId, int metadata, MatchBlock[] matchBlocks) {
|
||||
if (matchBlocks == null) {
|
||||
return true;
|
||||
} else {
|
||||
for (int i = 0; i < matchBlocks.length; ++i) {
|
||||
MatchBlock matchblock = matchBlocks[i];
|
||||
|
||||
if (matchblock.matches(blockId, metadata)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean blockId(int blockId, MatchBlock[] matchBlocks) {
|
||||
if (matchBlocks == null) {
|
||||
return true;
|
||||
} else {
|
||||
for (int i = 0; i < matchBlocks.length; ++i) {
|
||||
MatchBlock matchblock = matchBlocks[i];
|
||||
|
||||
if (matchblock.getBlockId() == blockId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean metadata(int metadata, int[] metadatas) {
|
||||
if (metadatas == null) {
|
||||
return true;
|
||||
} else {
|
||||
for (int i = 0; i < metadatas.length; ++i) {
|
||||
if (metadatas[i] == metadata) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean sprite(EaglerTextureAtlasSprite sprite, EaglerTextureAtlasSprite[] sprites) {
|
||||
if (sprites == null) {
|
||||
return true;
|
||||
} else {
|
||||
for (int i = 0; i < sprites.length; ++i) {
|
||||
if (sprites[i] == sprite) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean biome(BiomeGenBase biome, BiomeGenBase[] biomes) {
|
||||
if (biomes == null) {
|
||||
return true;
|
||||
} else {
|
||||
for (int i = 0; i < biomes.length; ++i) {
|
||||
if (biomes[i] == biome) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user