OSDN Git Service

修正・変更
[chemicraft/chemicraft.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         public static final Integer[] RI = new Integer[]{
58                 92
59         };
60
61
62         /**
63          * X, Y, Z座標
64          */
65         private  int posX;
66         private  int posY;
67         private  int posZ;
68
69
70         /**
71          * biomeの名前
72          */
73         private  String biomeName;
74
75
76         /**
77          * 天候
78          */
79         private  String weather;
80
81
82         /**
83          * EntityPlayerのインスタンス
84          */
85         private EntityPlayer entityPlayer;
86
87
88         /**
89          * Worldのインスタンス
90          */
91         private World world;
92
93
94
95         /**
96          * AtomInfoのデータをupdateします
97          * @param par1World Worldのインスタンス
98          * @param par2EntityPlayer EntityPlayerのインスタンス
99          */
100         public void update(World par1World, EntityPlayer par2EntityPlayer){
101                 //this.world = par1World;
102                 //this.entityPlayer = par2EntityPlayer;
103
104                 this.posX = (int) par2EntityPlayer.posX;
105                 this.posY = (int) par2EntityPlayer.posY;
106                 this.posZ = (int) par2EntityPlayer.posZ;
107
108                 this.biomeName = par1World.getBiomeGenForCoords(posX, posZ).biomeName;
109
110                 if (par1World.isThundering()){
111                         this.weather = "Thunder";
112                 }else if(par1World.isRaining()){
113                         this.weather = "Rain";
114                 }else{
115                         this.weather = "Sun";
116                 }
117         }
118
119
120
121         public static boolean isGas(int par1){
122                 for (int var2:GASES){
123                         if (par1 == var2){
124                                 return true;
125                         }
126                 }
127                 return false;
128         }
129
130
131
132         public static boolean isLiquid(int par1){
133                 for (int var2:LIQUIDS){
134                         if (par1 == var2){
135                                 return true;
136                         }
137                 }
138                 return false;
139         }
140
141
142
143         public static boolean isSolid(int par1){
144                 if (!isGas(par1) && !isLiquid(par1) && !isUnknown(par1)){
145                         return true;
146                 }
147                 return false;
148         }
149
150
151
152         public static boolean isUnknown(int par1){
153                 for (int var2:UNKNOWN){
154                         if (par1 == var2){
155                                 return true;
156                         }
157                 }
158                 return false;
159         }
160
161
162
163         public static boolean isLanthanoid(int par1){
164                 for (int var2:LANTHANOID){
165                         if (par1 == var2){
166                                 return true;
167                         }
168                 }
169                 return false;
170         }
171
172
173
174         public static boolean isActinoid(int par1){
175                 for (int var2:ACTINOID){
176                         if (par1 == var2){
177                                 return true;
178                         }
179                 }
180                 return false;
181         }
182
183
184
185         public static boolean isUnofficial(int par1){
186                 for (int var2:UNOFFICIAL){
187                         if (par1 == var2){
188                                 return true;
189                         }
190                 }
191                 return false;
192         }
193
194
195
196         public static boolean isRI(int par1){
197                 for (int var2:RI){
198                         if (par1 == var2){
199                                 return true;
200                         }
201                 }
202                 return false;
203         }
204
205
206
207         public static boolean isExisting(String par1){
208                 return false;
209         }
210
211
212
213         /**
214          * 引数に指定されたBiomeと同等か比較します
215          * @param biomeName 比較するBiomeの名前
216          * @return Biomeが一致しているか
217          */
218         public boolean isEquivalentBiome(String biomeName){
219                 if(this.biomeName != null){
220                         if(this.biomeName.equals(biomeName)){
221                                 return true;
222                         }else{
223                                 return false;
224                         }
225                 }else{
226                         System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください");
227                         return false;
228                 }
229         }
230
231
232
233         /**
234          * 引数に指定された天候と同等か比較します
235          * 晴れ:Sun, 雨:Rain, 雷雨:Thunder
236          * @param weather 比較する天候
237          * @return 天候が一致しているか
238          */
239         public boolean isEquivalentWeather(String weather){
240                 if(this.weather != null){
241                         if(this.weather.equals(weather)){
242                                 return true;
243                         }else{
244                                 return false;
245                         }
246                 }else{
247                         System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください");
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 isOverY(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 isEquivalentY(int par1){
277                 if(this.posY == par1){
278                         return true;
279                 }else{
280                         return false;
281                 }
282         }
283
284
285
286         /**
287          * 引数に指定されたY軸より低いか判定します
288          * @param par1
289          * @return 指定されたY軸より低いか
290          */
291         @SideOnly(Side.CLIENT)
292         public boolean isBelowY(int par1){
293                 if(this.posY <= par1){
294                         return true;
295                 }else{
296                         return false;
297                 }
298         }
299
300 }