OSDN Git Service

変更点をそのままにして修正し、間違っているところを消去&修正
[chemicraft/chemicraft.git] / common / chemicraft / AtomInfo.java
1 package chemicraft;\r
2 \r
3 import net.minecraft.src.EntityPlayer;\r
4 import net.minecraft.src.ItemStack;\r
5 import net.minecraft.src.World;\r
6 \r
7 public class AtomInfo {\r
8 \r
9         protected static int posX;\r
10         protected static int posY;\r
11         protected static int posZ;\r
12         protected static String biomeName;\r
13         protected static String weather;\r
14 \r
15         public AtomInfo(World par1World, EntityPlayer par2EntityPlayer){\r
16 \r
17                 this.biomeName = par1World.getBiomeGenForCoords(posX, posZ).biomeName;\r
18 \r
19                 this.posX = (int) par2EntityPlayer.posX; // X\8dÀ\95W\r
20                 this.posY = (int) par2EntityPlayer.posY; // Y\8dÀ\95W\r
21                 this.posZ = (int) par2EntityPlayer.posZ; // Z\8dÀ\95W\r
22 \r
23                 boolean rainy = par1World.isRaining();\r
24                 boolean thunder = par1World.isThundering();\r
25                 if (rainy && thunder){ // \89J\8a\8e\82Â\97\8b\r
26                         this.weather = "THUNDER";\r
27                 }else if(rainy){ // \89J\82Ü\82½\82Í\90á\r
28                         this.weather = "RAINY";\r
29                 }else{ //\90°\82ê\r
30                         this.weather = "SUNNY";\r
31                 }\r
32         }\r
33 \r
34         /**\r
35          * Y\8dÀ\95W\82Æ\82Ì\94ä\8ar\r
36          * @param EntityPlayer EntityPlayer\r
37          * @param y Y\8dÀ\95W\r
38          * @param biomeName \83o\83C\83I\81[\83\80\82Ì\96¼\91O(null\82Å\82à\89Â)\r
39          * @param weather \93V\8bC(null\82Å\82à\89Â)\r
40          * @param par1 \93ü\8eè\90\94\r
41          * @param par2 \8eí\97Þ(\83_\83\81\81[\83W\92l)\r
42          */\r
43         private boolean equivalentBiome(String biomeName){\r
44                 boolean ver1 = biomeName != null ? ((this.biomeName == biomeName) ? true : false) : true;\r
45                 return ver1;\r
46         }\r
47         private boolean equivalentWeather(String weather){\r
48                 boolean ver1 = weather != null ? ((this.weather == weather) ? true : false) : true;\r
49                 return ver1;\r
50         }\r
51 \r
52         protected void overY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
53                 if(this.posY >= y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
54                         if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
55                         {\r
56                                 EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
57                         }\r
58                 }\r
59         }\r
60         protected void aboveY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
61                 if(this.posY > y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
62                         if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
63                         {\r
64                                 EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
65                         }\r
66                 }\r
67         }\r
68         protected void equivalentY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
69                 if(this.posY == y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
70                         if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
71                         {\r
72                                 EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
73                         }\r
74                 }\r
75         }\r
76         protected void lessY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
77                 if(this.posY < y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
78                         if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
79                         {\r
80                                 EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
81                         }\r
82                 }\r
83         }\r
84         protected void belowY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
85                 if(this.posY <= y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
86                         if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
87                         {\r
88                                 EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
89                         }\r
90                 }\r
91         }\r
92 \r
93 }\r