1 package pcc.chemicraft.util;
3 import net.minecraft.entity.player.EntityPlayer;
4 import net.minecraft.world.World;
5 import net.minecraftforge.oredict.OreDictionary;
6 import pcc.chemicraft.util.Auxiliary.Probability;
7 import cpw.mods.fml.relauncher.Side;
8 import cpw.mods.fml.relauncher.SideOnly;
11 * いろいろなデータを格納しメソッドによってチェックするクラス。<br>
12 * 使用する場合はItemAtomInfoContainerを継承することを推奨します。
15 public final class AtomInfo {
20 public static final Integer[] GASES = new Integer[] {
21 1, 2, 7, 8, 9, 10, 17, 18, 36, 54, 86
28 public static final Integer[] LIQUIDS = new Integer[] {
36 public static final Integer[] UNKNOWN = new Integer[] {
37 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118
41 public static final Integer[] LANTHANOID = new Integer[] {
42 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71
46 public static final Integer[] ACTINOID = new Integer[] {
47 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103
51 public static final Integer[] UNOFFICIAL = new Integer[] {
52 113, 114, 115, 116, 117, 118
56 public static final Integer[] OREOFVANILLA = new Integer[] {
72 private String biomeName;
78 private String weather;
84 private EntityPlayer entityPlayer;
95 * AtomInfoのデータをupdateします
96 * @param par1World Worldのインスタンス
97 * @param par2EntityPlayer EntityPlayerのインスタンス
99 public void update(World par1World, EntityPlayer par2EntityPlayer){
100 this.posX = (int) par2EntityPlayer.posX;
101 this.posY = (int) par2EntityPlayer.posY;
102 this.posZ = (int) par2EntityPlayer.posZ;
104 this.biomeName = par1World.getBiomeGenForCoords(posX, posZ).biomeName;
106 if (par1World.isThundering()) {
107 this.weather = "Thunder";
108 } else if(par1World.isRaining()) {
109 this.weather = "Rain";
111 this.weather = "Sun";
117 public static boolean isGas(int par1) {
118 for (int var2:GASES) {
128 public static boolean isLiquid(int par1) {
129 for (int var2:LIQUIDS) {
139 public static boolean isSolid(int par1) {
140 if (!isGas(par1) && !isLiquid(par1) && !isUnknown(par1)) {
148 public static boolean isUnknown(int par1) {
149 for (int var2:UNKNOWN) {
159 public static boolean isLanthanoid(int par1) {
160 for (int var2:LANTHANOID) {
170 public static boolean isActinoid(int par1) {
171 for (int var2:ACTINOID) {
181 public static boolean isUnofficial(int par1) {
182 for (int var2:UNOFFICIAL) {
192 public static boolean isRI(int par1) {
193 return collapseUraniumSeries(par1) != -1;
198 public static int collapseUraniumSeries(int par1) {
200 Probability var2 = new Probability();
209 switch (var2.getProbability(1, 1)) {
225 switch (var2.getProbability(1, 1)) {
235 switch (var2.getProbability(1, 1)) {
245 switch (var2.getProbability(1, 1)) {
255 switch (var2.getProbability(1, 1)) {
278 public static boolean isOreOfVanilla(int par1) {
279 for (int var2:OREOFVANILLA) {
289 public static boolean isExisting(String par1) {
290 for (String var2:OreDictionary.getOreNames()) {
291 if ("ore" + par1 == var2) {
301 * 引数に指定されたBiomeと同等か比較します
302 * @param biomeName 比較するBiomeの名前
303 * @return Biomeが一致しているか
305 public boolean isEquivalentBiome(String biomeName) {
306 if(this.biomeName != null){
307 if(this.biomeName.equals(biomeName)){
313 System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください");
321 * 引数に指定された天候と同等か比較します
322 * 晴れ:Sun, 雨:Rain, 雷雨:Thunder
323 * @param weather 比較する天候
326 public boolean isEquivalentWeather(String weather) {
327 if (this.weather != null) {
328 if (this.weather.equals(weather)) {
334 System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください");
342 * 引数に指定されたY軸より高いか判定します
344 * @return 指定されたY軸より高いか
346 @SideOnly(Side.CLIENT)
347 public boolean isOverY(int par1) {
348 return this.posY >= par1;
354 * 引数に指定されたY軸と同等か判定します
356 * @return 指定されたY軸と同等かどうか
358 @SideOnly(Side.CLIENT)
359 public boolean isEquivalentY(int par1) {
360 return this.posY == par1;
366 * 引数に指定されたY軸より低いか判定します
368 * @return 指定されたY軸より低いか
370 @SideOnly(Side.CLIENT)
371 public boolean isBelowY(int par1) {
372 return this.posY <= par1;