• R/O
  • HTTP
  • SSH
  • HTTPS

ChemiCraftNext: Commit


Commit MetaInfo

Revisión60c9826343f9871edaa405b187104e6244476846 (tree)
Tiempo2012-11-22 21:23:42
Autorinaka <inaka@tcrs...>
Commiterinaka

Log Message

また代理コミット
classの追加

Cambiar Resumen

Diferencia incremental

--- /dev/null
+++ b/src/AtomInfo.java
@@ -0,0 +1,93 @@
1+package net.minecraft.src.ChemiCraft;
2+
3+import net.minecraft.src.EntityPlayer;
4+import net.minecraft.src.ItemStack;
5+import net.minecraft.src.World;
6+
7+public class AtomInfo {
8+
9+ protected static int posX;
10+ protected static int posY;
11+ protected static int posZ;
12+ protected static String biomeName;
13+ protected static String weather;
14+
15+ public AtomInfo(World par1World, EntityPlayer par2EntityPlayer){
16+
17+ this.biomeName = par1World.getBiomeGenForCoords(posX, posZ).biomeName;
18+
19+ this.posX = (int) par2EntityPlayer.posX; // X座標
20+ this.posY = (int) par2EntityPlayer.posY; // Y座標
21+ this.posZ = (int) par2EntityPlayer.posZ; // Z座標
22+
23+ boolean rainy = par1World.isRaining();
24+ boolean thunder = par1World.isThundering();
25+ if (rainy && thunder){ // 雨且つ雷
26+ this.weather = "THUNDER";
27+ }else if(rainy){ // 雨または雪
28+ this.weather = "RAINY";
29+ }else{ //晴れ
30+ this.weather = "SUNNY";
31+ }
32+ }
33+
34+ /**
35+ * Y座標との比較
36+ * @param EntityPlayer EntityPlayer
37+ * @param y Y座標
38+ * @param biomeName バイオームの名前(nullでも可)
39+ * @param weather 天気(nullでも可)
40+ * @param par1 入手数
41+ * @param par2 種類(ダメージ値)
42+ */
43+ private boolean equivalentBiome(String biomeName){
44+ boolean ver1 = biomeName != null ? ((this.biomeName == biomeName) ? true : false) : true;
45+ return ver1;
46+ }
47+ private boolean equivalentWeather(String weather){
48+ boolean ver1 = weather != null ? ((this.weather == weather) ? true : false) : true;
49+ return ver1;
50+ }
51+
52+ protected void overY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){
53+ if(this.posY >= y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){
54+ if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))
55+ {
56+ EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));
57+ }
58+ }
59+ }
60+ protected void aboveY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){
61+ if(this.posY > y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){
62+ if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))
63+ {
64+ EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));
65+ }
66+ }
67+ }
68+ protected void equivalentY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){
69+ if(this.posY == y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){
70+ if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))
71+ {
72+ EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));
73+ }
74+ }
75+ }
76+ protected void lessY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){
77+ if(this.posY < y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){
78+ if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))
79+ {
80+ EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));
81+ }
82+ }
83+ }
84+ protected void belowY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){
85+ if(this.posY <= y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){
86+ if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))
87+ {
88+ EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));
89+ }
90+ }
91+ }
92+
93+}
--- a/src/Auxiliary.java
+++ b/src/Auxiliary.java
@@ -13,7 +13,7 @@ public class Auxiliary {
1313 class NameAuxiliary{
1414
1515 /**
16- * とりあえず作成。あるのでボツ
16+ * 名前を追加する。
1717 * @param object
1818 * @param Name
1919 */
@@ -22,7 +22,7 @@ public class Auxiliary {
2222 }
2323
2424 /**
25- * こちらもあるのでボツ
25+ * 名前を追加する(ItemStack版)
2626 * @param object
2727 * @param name
2828 * @param meta
@@ -30,13 +30,33 @@ public class Auxiliary {
3030 public void addName(ItemStack itemstack,Object name){
3131 LanguageRegistry.addName(itemstack, (String) name);
3232 }
33+
34+
35+ /**
36+ * 指定した言語で名前を追加する。
37+ * @param object
38+ * @param name
39+ */
40+ public void addName(Object object,String lang,Object name){
41+ LanguageRegistry.instance().addNameForObject(object, lang, (String) name);
42+ }
43+
44+ /**
45+ * 指定した言語で名前を追加する(ItemStack版)
46+ * @param object
47+ * @param name
48+ */
49+
50+ public void addName(ItemStack object,String lang,Object name){
51+ LanguageRegistry.instance().addNameForObject(object, lang, (String) name);
52+ }
3353
3454 /**
3555 * メタデータ+配列で名前を追加する(Block版)
3656 * @param object
3757 * @param name
3858 */
39- public void addForName(Block object,Object[] name){
59+ public void addName(Block object,Object[] name){
4060 for(int i=0;i<name.length;i++){
4161 LanguageRegistry.addName(new ItemStack(object,0,i), (String) name[i]);
4262 }
@@ -47,7 +67,7 @@ public class Auxiliary {
4767 * @param object
4868 * @param name
4969 */
50- public void addForName(Item object,Object[] name){
70+ public void addName(Item object,Object[] name){
5171 for(int i=0;i<name.length;i++){
5272 LanguageRegistry.addName(new ItemStack(object,0,i), (String) name[i]);
5373 }
@@ -58,7 +78,7 @@ public class Auxiliary {
5878 * @param object
5979 * @param name
6080 */
61- public void addForLangName(Block object,String lang,Object[] name){
81+ public void addName(Block object,String lang,Object[] name){
6282 for(int i=0;i<name.length;i++){
6383 LanguageRegistry.instance().addNameForObject(new ItemStack(object,0,i), lang, (String) name[i]);
6484 }
@@ -69,7 +89,7 @@ public class Auxiliary {
6989 * @param object
7090 * @param name
7191 */
72- public void addForLangName(Item object,String lang, Object[] name){
92+ public void addName(Item object,String lang, Object[] name){
7393 for(int i=0;i<name.length;i++){
7494 LanguageRegistry.instance().addNameForObject(new ItemStack(object,0,i), lang, (String) name[i]);
7595 }
--- a/src/ChemiCraft.java
+++ b/src/ChemiCraft.java
@@ -38,16 +38,29 @@ public class ChemiCraft
3838 };
3939
4040 public static final String[] atomsNameJP = {
41- "水素", "ヘリウム"
41+ "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン",
42+ "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム",
43+ "スカンジウム", "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛",
44+ "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム",
45+ "ニオブ", "モリブデン", "テクネチウム", "ルテニウム", "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ",
46+ "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム",
47+ "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム", "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム",
48+ "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀",
49+ "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム", "アクチニウム", "トリウム",
50+ "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム",
51+ "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム", "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム",
52+ "レントゲニウム", "コペルニシウム", "ウンウントリウム", "フレロビウム", "ウンウンペンチウム", "リバモリウム", "ウンウンセプチウム", "ウンウンオクチウム"
4253 };
4354
4455 private ChemiCraftAPI chemiCraftAPI = ChemiCraftAPI.instance;
4556
4657 public static int atomsID;
4758 public static int compoundsID;
59+ public static int gasCollectingBottleID;
4860
4961 public static Item itemAtoms;
5062 public static Item itemCompounds;
63+ public static Item itemGasCollectingBottle;
5164
5265 private Auxiliary Auxiliary = new Auxiliary();
5366 private Auxiliary.NameAuxiliary NameAuxiliary = Auxiliary.new NameAuxiliary();
@@ -57,7 +70,8 @@ public class ChemiCraft
5770 public void chemiLoadMethod(FMLInitializationEvent event)
5871 {
5972 //化合物の追加
60- ChemiCraftAPI.addLangCompound("ja_JP", "Salt", "塩(塩化ナトリウム)");
73+ ChemiCraftAPI.addCompound("Salt(Sodium chloride)");
74+ ChemiCraftAPI.addLangCompound("ja_JP", "塩(塩化ナトリウム)");
6175 }
6276
6377 @Mod.PreInit // 前処理
@@ -67,8 +81,10 @@ public class ChemiCraft
6781 cfg.load();
6882 Property atomsIDProp = cfg.getItem("atomsID", 25000);
6983 Property compoundsIDProp = cfg.getItem("compoundsID", 25001);
84+ Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);
7085 atomsID = atomsIDProp.getInt();
7186 compoundsID = compoundsIDProp.getInt();
87+ gasCollectingBottleID = gasCollectingBottleIDProp.getInt();
7288 cfg.save();
7389 }
7490
@@ -77,14 +93,14 @@ public class ChemiCraft
7793 {
7894 itemAtoms = new ItemAtoms(atomsID).setItemName("atoms");
7995 itemCompounds = new ItemCompounds(compoundsID).setItemName("compounds");
80-
81- NameAuxiliary.addForName(itemAtoms, atomsName);
82- NameAuxiliary.addForLangName(itemAtoms, "ja_JP", atomsNameJP);
83- NameAuxiliary.addForName(itemCompounds, ChemiCraftAPI.getCompoundsName().toArray());
84- NameAuxiliary.addForLangName(itemCompounds, "ja_JP", ChemiCraftAPI.getCompoundsLangName().toArray());
85-
86- ChemiCraftAPI.addCompoundHandler("Salt", new CompoundHandlerTest());
87-
96+ itemGasCollectingBottle = new ItemGasCollectingBottle(gasCollectingBottleID).setItemName("gasCollectingBottle");
97+
98+ NameAuxiliary.addName(itemAtoms, atomsName);
99+ NameAuxiliary.addName(itemAtoms, "ja_JP", atomsNameJP);
100+ NameAuxiliary.addName(itemCompounds, ChemiCraftAPI.getCompoundsName().toArray());
101+ NameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.getCompoundsLangName().toArray());
102+ NameAuxiliary.addName(itemGasCollectingBottle, "GasCollectingBottle");
103+ NameAuxiliary.addName(itemGasCollectingBottle, "ja_JP", "集気瓶");
88104 }
89105
90106 }
\ No newline at end of file
--- a/src/ChemiCraftAPI.java
+++ b/src/ChemiCraftAPI.java
@@ -10,18 +10,13 @@ public class ChemiCraftAPI {
1010 private static ArrayList<String> compoundsNameList = new ArrayList();
1111 private static ArrayList<String> compoundsLangNameList = new ArrayList();
1212 private static ArrayList<String> compoundsLangList = new ArrayList();
13- private static ArrayList<ICompoundHandler> compoundHandlers = new ArrayList<ICompoundHandler>();
14- private static ArrayList<String> compoundHandlerItemNames = new ArrayList<String>();
1513
1614 public static void addCompound(String name){
1715 compoundsNameList.add(name);
18- compoundsLangNameList.add("");
19- compoundsLangList.add("");
2016 }
2117
22- public static void addLangCompound(String lang, String englishName, String langName){
23- compoundsNameList.add(englishName);
24- compoundsLangNameList.add(langName);
18+ public static void addLangCompound(String lang, String name){
19+ compoundsLangNameList.add(name);
2520 compoundsLangList.add(lang);
2621 }
2722
@@ -40,20 +35,4 @@ public class ChemiCraftAPI {
4035 return compoundsLangList;
4136 }
4237
43- public static void addCompoundHandler(String handlerItemName, ICompoundHandler compoundHandler){
44- ChemiCraftAPI.compoundHandlers.add(compoundHandler);
45- compoundHandlerItemNames.add(handlerItemName);
46- }
47-
48- public static ArrayList<ICompoundHandler> getCompoundHandler(){
49- compoundHandlers.trimToSize();
50- return compoundHandlers;
51-
52- }
53-
54- public static ArrayList<String> getCompoundHandlerItemName(){
55- compoundHandlerItemNames.trimToSize();
56- return compoundHandlerItemNames;
57- }
58-
5938 }
--- a/src/ItemCompounds.java
+++ b/src/ItemCompounds.java
@@ -5,10 +5,8 @@ import java.util.List;
55 import cpw.mods.fml.common.Side;
66 import cpw.mods.fml.common.asm.SideOnly;
77 import net.minecraft.src.CreativeTabs;
8-import net.minecraft.src.Entity;
98 import net.minecraft.src.Item;
109 import net.minecraft.src.ItemStack;
11-import net.minecraft.src.World;
1210
1311 public class ItemCompounds extends Item {
1412
@@ -20,17 +18,6 @@ public class ItemCompounds extends Item {
2018 this.setCreativeTab(CreativeTabs.tabMaterials);
2119 }
2220
23- @Override
24- public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
25- for(int i=0;i < ChemiCraftAPI.getCompoundsName().size();i++){
26- for(int j=0;j < ChemiCraftAPI.getCompoundHandlerItemName().size();j++){
27- if(ChemiCraftAPI.getCompoundsName().get(i).equals(ChemiCraftAPI.getCompoundHandlerItemName().get(i))){
28- ChemiCraftAPI.getCompoundHandler().get(j).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
29- }
30- }
31- }
32- }
33-
3421 @SideOnly(Side.CLIENT)
3522 @Override
3623 public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
--- /dev/null
+++ b/src/ItemGasCollectingBottle.java
@@ -0,0 +1,32 @@
1+package net.minecraft.src.ChemiCraft;
2+
3+import java.util.Random;
4+
5+import net.minecraft.src.*;
6+
7+public class ItemGasCollectingBottle extends Item {
8+
9+ protected ItemGasCollectingBottle(int id) {
10+ super(id);
11+ this.setMaxStackSize(1);
12+ this.setMaxDamage(2);
13+ this.setCreativeTab(CreativeTabs.tabMaterials);
14+ }
15+
16+ @Override
17+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
18+
19+ par1ItemStack.damageItem(1, par3EntityPlayer);
20+ AtomInfo AtomInfo = new AtomInfo(par2World, par3EntityPlayer);
21+ AtomInfo.aboveY(par3EntityPlayer, 128, null, null, 0, 7);
22+ return par1ItemStack;
23+ }
24+
25+ @Override
26+ public String getTextureFile()
27+ {
28+ this.isDefaultTexture = false;
29+ return "/ChemiCraft/items.png";
30+ }
31+
32+}
Show on old repository browser