1 package pcc.chemicraft.util;
3 import net.minecraft.entity.player.EntityPlayer;
4 import net.minecraft.world.World;
5 import pcc.chemicraft.util.Auxiliary.Probability;
6 import cpw.mods.fml.relauncher.Side;
7 import cpw.mods.fml.relauncher.SideOnly;
10 * いろいろなデータを格納しメソッドによってチェックするクラス。<br>
11 * 使用する場合はItemAtomInfoContainerを継承することを推奨します。
14 public final class AtomInfo {
19 public static final Integer[] GASES = new Integer[] {
20 1, 2, 7, 8, 9, 10, 17, 18, 36, 54, 86
27 public static final Integer[] LIQUIDS = new Integer[] {
35 public static final Integer[] UNKNOWN = new Integer[] {
36 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118
40 public static final Integer[] LANTHANOID = new Integer[] {
41 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71
45 public static final Integer[] ACTINOID = new Integer[] {
46 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103
50 public static final Integer[] UNOFFICIAL = new Integer[] {
51 113, 114, 115, 116, 117, 118
66 private String biomeName;
72 private String weather;
78 private EntityPlayer entityPlayer;
89 * AtomInfoのデータをupdateします
90 * @param par1World Worldのインスタンス
91 * @param par2EntityPlayer EntityPlayerのインスタンス
93 public void update(World par1World, EntityPlayer par2EntityPlayer){
94 this.posX = (int) par2EntityPlayer.posX;
95 this.posY = (int) par2EntityPlayer.posY;
96 this.posZ = (int) par2EntityPlayer.posZ;
98 this.biomeName = par1World.getBiomeGenForCoords(posX, posZ).biomeName;
100 if (par1World.isThundering()) {
101 this.weather = "Thunder";
102 } else if(par1World.isRaining()) {
103 this.weather = "Rain";
105 this.weather = "Sun";
111 public static boolean isGas(int par1) {
112 for (int var2:GASES) {
122 public static boolean isLiquid(int par1) {
123 for (int var2:LIQUIDS) {
133 public static boolean isSolid(int par1) {
134 if (!isGas(par1) && !isLiquid(par1) && !isUnknown(par1)) {
142 public static boolean isUnknown(int par1) {
143 for (int var2:UNKNOWN) {
153 public static boolean isLanthanoid(int par1) {
154 for (int var2:LANTHANOID) {
164 public static boolean isActinoid(int par1) {
165 for (int var2:ACTINOID) {
175 public static boolean isUnofficial(int par1) {
176 for (int var2:UNOFFICIAL) {
186 public static boolean isRI(int par1) {
187 return collapseUraniumSeries(par1) != -1;
192 public static int collapseUraniumSeries(int par1) {
194 Probability var2 = new Probability();
203 switch (var2.getProbability(1, 1)) {
219 switch (var2.getProbability(1, 1)) {
229 switch (var2.getProbability(1, 1)) {
239 switch (var2.getProbability(1, 1)) {
249 switch (var2.getProbability(1, 1)) {
272 public static boolean isExisting(String par1) {
279 * 引数に指定されたBiomeと同等か比較します
280 * @param biomeName 比較するBiomeの名前
281 * @return Biomeが一致しているか
283 public boolean isEquivalentBiome(String biomeName) {
284 if(this.biomeName != null){
285 if(this.biomeName.equals(biomeName)){
291 System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください");
299 * 引数に指定された天候と同等か比較します
300 * 晴れ:Sun, 雨:Rain, 雷雨:Thunder
301 * @param weather 比較する天候
304 public boolean isEquivalentWeather(String weather) {
305 if (this.weather != null) {
306 if (this.weather.equals(weather)) {
312 System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください");
320 * 引数に指定されたY軸より高いか判定します
322 * @return 指定されたY軸より高いか
324 @SideOnly(Side.CLIENT)
325 public boolean isOverY(int par1) {
326 if (this.posY >= par1) {
336 * 引数に指定されたY軸と同等か判定します
338 * @return 指定されたY軸と同等かどうか
340 @SideOnly(Side.CLIENT)
341 public boolean isEquivalentY(int par1) {
342 if (this.posY == par1) {
352 * 引数に指定されたY軸より低いか判定します
354 * @return 指定されたY軸より低いか
356 @SideOnly(Side.CLIENT)
357 public boolean isBelowY(int par1) {
358 if (this.posY <= par1) {