OSDN Git Service

修正・変更
[chemicraft/ChemiCraftNext.git] / common / pcc / chemicraft / util / AtomInfo.java
1 package pcc.chemicraft.util;
2
3 import net.minecraft.block.Block;
4 import net.minecraft.entity.player.EntityPlayer;
5 import net.minecraft.world.World;
6 import cpw.mods.fml.common.registry.LanguageRegistry;
7 import cpw.mods.fml.relauncher.Side;
8 import cpw.mods.fml.relauncher.SideOnly;
9
10 /**
11  * いろいろなデータを格納しメソッドによってチェックするクラス
12  * 使用する場合はItemAtomInfoContainerを継承することを推奨
13  * @author ponkotate
14  *
15  */
16 public final class AtomInfo {
17
18         /**
19          * 気体
20          */
21         public static final Integer[] gases = new Integer[]{
22                 1, 2, 7, 8, 9, 10, 17, 18, 36, 54, 86
23         };
24
25
26         /**
27          * 液体
28          */
29         public static final Integer[] liquids = new Integer[]{
30                 35, 80
31         };
32
33
34         /**
35          * 不明
36          */
37         public static final Integer[] unknown = new Integer[]{
38                 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118
39         };
40
41
42         public static final Integer[] lanthanoid = new Integer[]{
43                 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71
44         };
45
46
47         public static final Integer[] actinoid = new Integer[]{
48                 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103
49         };
50
51
52         public static final Integer[] unofficial = new Integer[]{
53                 113, 114, 115, 116, 117, 118
54         };
55
56
57         /**
58          * X, Y, Z座標
59          */
60         private  int posX;
61         private  int posY;
62         private  int posZ;
63
64
65         /**
66          * biomeの名前
67          */
68         private  String biomeName;
69
70
71         /**
72          * 天候
73          */
74         private  String weather;
75
76
77         /**
78          * EntityPlayerのインスタンス
79          */
80         private EntityPlayer entityPlayer;
81
82
83         /**
84          * Worldのインスタンス
85          */
86         private World world;
87
88
89
90         /**
91          * AtomInfoのデータをupdateします
92          * @param par1World Worldのインスタンス
93          * @param par2EntityPlayer EntityPlayerのインスタンス
94          */
95         public void update(World par1World, EntityPlayer par2EntityPlayer){
96                 //this.world = par1World;
97                 //this.entityPlayer = par2EntityPlayer;
98
99                 this.posX = (int) par2EntityPlayer.posX;
100                 this.posY = (int) par2EntityPlayer.posY;
101                 this.posZ = (int) par2EntityPlayer.posZ;
102
103                 this.biomeName = par1World.getBiomeGenForCoords(posX, posZ).biomeName;
104
105                 if (par1World.isThundering()){
106                         this.weather = "Thunder";
107                 }else if(par1World.isRaining()){
108                         this.weather = "Rain";
109                 }else{
110                         this.weather = "Sun";
111                 }
112         }
113
114
115
116         public static boolean isGas(int par1){
117                 for (int var2:gases){
118                         if (par1 == var2){
119                                 return true;
120                         }
121                 }
122                 return false;
123         }
124
125
126
127         public static boolean isLiquid(int par1){
128                 for (int var2:liquids){
129                         if (par1 == var2){
130                                 return true;
131                         }
132                 }
133                 return false;
134         }
135
136
137
138         public static boolean isSolid(int par1){
139                 if (!isGas(par1) && !isLiquid(par1) && !isUnknown(par1)){
140                         return true;
141                 }
142                 return false;
143         }
144
145
146
147         public static boolean isUnknown(int par1){
148                 for (int var2:unknown){
149                         if (par1 == var2){
150                                 return true;
151                         }
152                 }
153                 return false;
154         }
155
156
157
158         public static boolean isLanthanoid(int par1){
159                 for (int var2:lanthanoid){
160                         if (par1 == var2){
161                                 return true;
162                         }
163                 }
164                 return false;
165         }
166
167
168
169         public static boolean isActinoid(int par1){
170                 for (int var2:actinoid){
171                         if (par1 == var2){
172                                 return true;
173                         }
174                 }
175                 return false;
176         }
177
178
179
180         public static boolean isUnofficial(int par1){
181                 for (int var2:unofficial){
182                         if (par1 == var2){
183                                 return true;
184                         }
185                 }
186                 return false;
187         }
188
189
190
191         public static boolean isExisting(String par1){
192                 return false;
193         }
194
195
196
197         /**
198          * 引数に指定されたBiomeと同等か比較します
199          * @param biomeName 比較するBiomeの名前
200          * @return Biomeが一致しているか
201          */
202         public boolean isEquivalentBiome(String biomeName){
203                 if(this.biomeName != null){
204                         if(this.biomeName.equals(biomeName)){
205                                 return true;
206                         }else{
207                                 return false;
208                         }
209                 }else{
210                         System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください");
211                         return false;
212                 }
213         }
214
215
216
217         /**
218          * 引数に指定された天候と同等か比較します
219          * 晴れ:Sun, 雨:Rain, 雷雨:Thunder
220          * @param weather 比較する天候
221          * @return 天候が一致しているか
222          */
223         public boolean isEquivalentWeather(String weather){
224                 if(this.weather != null){
225                         if(this.weather.equals(weather)){
226                                 return true;
227                         }else{
228                                 return false;
229                         }
230                 }else{
231                         System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください");
232                         return false;
233                 }
234         }
235
236
237
238         /**
239          * 引数に指定されたY軸より高いか判定します
240          * @param par1
241          * @return 指定されたY軸より高いか
242          */
243         @SideOnly(Side.CLIENT)
244         public boolean isOverY(int par1){
245                 if(this.posY >= par1){
246                         return true;
247                 }else{
248                         return false;
249                 }
250         }
251
252
253
254         /**
255          * 引数に指定されたY軸と同等か判定します
256          * @param par1
257          * @return 指定されたY軸と同等かどうか
258          */
259         @SideOnly(Side.CLIENT)
260         public boolean isEquivalentY(int par1){
261                 if(this.posY == par1){
262                         return true;
263                 }else{
264                         return false;
265                 }
266         }
267
268
269
270         /**
271          * 引数に指定されたY軸より低いか判定します
272          * @param par1
273          * @return 指定されたY軸より低いか
274          */
275         @SideOnly(Side.CLIENT)
276         public boolean isBelowY(int par1){
277                 if(this.posY <= par1){
278                         return true;
279                 }else{
280                         return false;
281                 }
282         }
283
284 }