• R/O
  • HTTP
  • SSH
  • HTTPS

ChemiCraftNext: Commit


Commit MetaInfo

Revisión21ada27625a8333ec2bf4daf231101779680bfe9 (tree)
Tiempo2012-11-23 20:46:51
Autoryykimoto <yykimoto@user...>
Commiteryykimoto

Log Message

Merge branch 'yykimotoSagyo'

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+}
--- /dev/null
+++ b/src/Auxiliary.java
@@ -0,0 +1,100 @@
1+package net.minecraft.src.ChemiCraft;
2+
3+import net.minecraft.src.Block;
4+import net.minecraft.src.Item;
5+import net.minecraft.src.ItemStack;
6+import cpw.mods.fml.common.registry.LanguageRegistry;
7+
8+public class Auxiliary {
9+
10+ public Auxiliary(){
11+ }
12+
13+ class NameAuxiliary{
14+
15+ /**
16+ * 名前を追加する。
17+ * @param object
18+ * @param Name
19+ */
20+ public void addName(Object object,Object name){
21+ LanguageRegistry.addName(object, (String) name);
22+ }
23+
24+ /**
25+ * 名前を追加する(ItemStack版)
26+ * @param object
27+ * @param name
28+ * @param meta
29+ */
30+ public void addName(ItemStack itemstack,Object name){
31+ LanguageRegistry.addName(itemstack, (String) name);
32+ }
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+ }
53+
54+ /**
55+ * メタデータ+配列で名前を追加する(Block版)
56+ * @param object
57+ * @param name
58+ */
59+ public void addName(Block object,Object[] name){
60+ for(int i=0;i<name.length;i++){
61+ LanguageRegistry.addName(new ItemStack(object,0,i), (String) name[i]);
62+ }
63+ }
64+
65+ /**
66+ * メタデータ+配列で名前を追加する(Item版)
67+ * @param object
68+ * @param name
69+ */
70+ public void addName(Item object,Object[] name){
71+ for(int i=0;i<name.length;i++){
72+ LanguageRegistry.addName(new ItemStack(object,0,i), (String) name[i]);
73+ }
74+ }
75+
76+ /**
77+ * メタデータ+配列で指定した言語で名前を追加する(Block版)
78+ * @param object
79+ * @param name
80+ */
81+ public void addName(Block object,String lang,Object[] name){
82+ for(int i=0;i<name.length;i++){
83+ LanguageRegistry.instance().addNameForObject(new ItemStack(object,0,i), lang, (String) name[i]);
84+ }
85+ }
86+
87+ /**
88+ * メタデータ+配列で指定した言語で名前を追加する(Item版)
89+ * @param object
90+ * @param name
91+ */
92+ public void addName(Item object,String lang, Object[] name){
93+ for(int i=0;i<name.length;i++){
94+ LanguageRegistry.instance().addNameForObject(new ItemStack(object,0,i), lang, (String) name[i]);
95+ }
96+ }
97+
98+ }
99+
100+}
--- /dev/null
+++ b/src/ChemiCraft.java
@@ -0,0 +1,106 @@
1+package net.minecraft.src.ChemiCraft;
2+
3+import java.util.ArrayList;
4+import java.util.Properties;
5+
6+import net.minecraft.src.Block;
7+import net.minecraft.src.Item;
8+import net.minecraft.src.ItemStack;
9+import net.minecraftforge.common.Configuration;
10+import net.minecraftforge.common.Property;
11+import cpw.mods.fml.common.Mod;
12+import cpw.mods.fml.common.event.FMLInitializationEvent;
13+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
14+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
15+import cpw.mods.fml.common.network.NetworkMod;
16+import cpw.mods.fml.common.registry.GameRegistry;
17+import cpw.mods.fml.common.registry.LanguageRegistry;
18+
19+@Mod( modid = "chemiCraft", name="ChemiCraft", version="テスト版") //ID,名前,バージョン
20+@NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "[1.3.2]") //クライアント、サーバー共に必要 1.3.2用
21+
22+public class ChemiCraft
23+{
24+
25+ public static final String[] atomsName = {
26+ "Hydrogen", "Helium","Lithium","Beryllium","Boron","Carbon","Nitrogen","Oxygen","Fluorine","Neon",
27+ "Sodium","Magnesium","Aluminium","Silicon","Phosphorus","Sulfur","Chlorine","Argon","Potassium","Calcium",
28+ "Scandium","Titanium","Vanadium","Chromium","Manganese","Iron","Cobalt","Nickel","Copper","Zinc",
29+ "Gallium","Germanium","Arsenic","Selenium","Bromine","Krypton","Rubidium","Strontium","Yttorium","Zirconium",
30+ "Niobium","Molybdenum","Technetium","Ruthenium","Rhodium","Palladium","Silver","Cadmium","Indium","Tin",
31+ "Antimony","Tellurium","Iodine","Xenon","Caesium","Barium","Lanthanum","Cerium","Praseodymium","Neodymium",
32+ "Promethium","Samarium","Europium","Gadolinium","Terbium","Dysprosium","Holmium","Erbium","Thulium","Ytterbium",
33+ "Lutetium","Hafnium","Tantalum","Tungsten","Rhenium","Osmium","Iridium","Platinum","Gold","Mercury",
34+ "Thallium","Lead","Bismuth","Polonium","Astatine","Radon","Francium","Radium","Actinium","Thorium",
35+ "Protactinium","Uranium","Neptunium","Plutonium","Americium","Curium","Berkelium","Californium","Einsteinium","Fermium",
36+ "Mendelevium","Nobelium","Lawrencium","Rutherfordium","Dubnium","Seaborgium","Bohrium","Hassium","Meitnerium","Darmstadtium",
37+ "Roentgenium","Copernicium","Ununtrium","Ununquadium","Ununpentium","Ununhexium","","Ununoctium"
38+ };
39+
40+ public static final String[] atomsNameJP = {
41+ "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン",
42+ "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム",
43+ "スカンジウム", "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛",
44+ "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム",
45+ "ニオブ", "モリブデン", "テクネチウム", "ルテニウム", "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ",
46+ "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム",
47+ "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム", "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム",
48+ "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀",
49+ "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム", "アクチニウム", "トリウム",
50+ "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム",
51+ "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム", "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム",
52+ "レントゲニウム", "コペルニシウム", "ウンウントリウム", "フレロビウム", "ウンウンペンチウム", "リバモリウム", "ウンウンセプチウム", "ウンウンオクチウム"
53+ };
54+
55+ private ChemiCraftAPI chemiCraftAPI = ChemiCraftAPI.instance;
56+
57+ public static int atomsID;
58+ public static int compoundsID;
59+ public static int gasCollectingBottleID;
60+
61+ public static Item itemAtoms;
62+ public static Item itemCompounds;
63+ public static Item itemGasCollectingBottle;
64+
65+ private Auxiliary Auxiliary = new Auxiliary();
66+ private Auxiliary.NameAuxiliary NameAuxiliary = Auxiliary.new NameAuxiliary();
67+
68+ // コンストラクタ
69+ @Mod.Init
70+ public void chemiLoadMethod(FMLInitializationEvent event)
71+ {
72+ //化合物の追加
73+ ChemiCraftAPI.addCompound("Salt(Sodium chloride)");
74+ ChemiCraftAPI.addLangCompound("ja_JP", "塩(塩化ナトリウム)");
75+ }
76+
77+ @Mod.PreInit // 前処理
78+ public void chemiPreLoadMethod(FMLPreInitializationEvent event)
79+ {
80+ Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
81+ cfg.load();
82+ Property atomsIDProp = cfg.getItem("atomsID", 25000);
83+ Property compoundsIDProp = cfg.getItem("compoundsID", 25001);
84+ Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);
85+ atomsID = atomsIDProp.getInt();
86+ compoundsID = compoundsIDProp.getInt();
87+ gasCollectingBottleID = gasCollectingBottleIDProp.getInt();
88+ cfg.save();
89+ }
90+
91+ @Mod.PostInit // ModLoader.loadメソッドと同等
92+ public void chemiPostLoadMethod(FMLPostInitializationEvent event)
93+ {
94+ itemAtoms = new ItemAtoms(atomsID).setItemName("atoms");
95+ itemCompounds = new ItemCompounds(compoundsID).setItemName("compounds");
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", "集気瓶");
104+ }
105+
106+}
\ No newline at end of file
--- /dev/null
+++ b/src/ChemiCraftAPI.java
@@ -0,0 +1,38 @@
1+package net.minecraft.src.ChemiCraft;
2+
3+import java.util.ArrayList;
4+
5+public class ChemiCraftAPI {
6+
7+ public static ChemiCraftAPI instance = new ChemiCraftAPI();
8+
9+ private boolean addLanguage = false;
10+ private static ArrayList<String> compoundsNameList = new ArrayList();
11+ private static ArrayList<String> compoundsLangNameList = new ArrayList();
12+ private static ArrayList<String> compoundsLangList = new ArrayList();
13+
14+ public static void addCompound(String name){
15+ compoundsNameList.add(name);
16+ }
17+
18+ public static void addLangCompound(String lang, String name){
19+ compoundsLangNameList.add(name);
20+ compoundsLangList.add(lang);
21+ }
22+
23+ public static ArrayList<String> getCompoundsName(){
24+ compoundsNameList.trimToSize();
25+ return compoundsNameList;
26+ }
27+
28+ public static ArrayList<String> getCompoundsLangName(){
29+ compoundsLangNameList.trimToSize();
30+ return compoundsLangNameList;
31+ }
32+
33+ public static ArrayList<String> getCompoundsLang(){
34+ compoundsLangList.trimToSize();
35+ return compoundsLangList;
36+ }
37+
38+}
--- /dev/null
+++ b/src/CompoundHandlerTest.java
@@ -0,0 +1,28 @@
1+package net.minecraft.src.ChemiCraft;
2+
3+import net.minecraft.src.Entity;
4+import net.minecraft.src.EntityPlayer;
5+import net.minecraft.src.ItemStack;
6+import net.minecraft.src.World;
7+
8+public class CompoundHandlerTest implements ICompoundHandler {
9+
10+ @Override
11+ public void onRightClickHandler(ItemStack par1ItemStack, World par2World,
12+ EntityPlayer par3EntityPlayer) {
13+
14+ }
15+
16+ @Override
17+ public ItemStack onItemUseHandler(ItemStack par1ItemStack,
18+ EntityPlayer par2EntityPlayer, World par3World, int par4, int par5,
19+ int par6, int par7, float par8, float par9, float par10) {
20+ return null;
21+ }
22+
23+ @Override
24+ public void onUpdateHandler(ItemStack par1ItemStack, World par2World,
25+ Entity par3Entity, int par4, boolean par5) {
26+ }
27+
28+}
--- /dev/null
+++ b/src/ICompoundHandler.java
@@ -0,0 +1,16 @@
1+package net.minecraft.src.ChemiCraft;
2+
3+import net.minecraft.src.Entity;
4+import net.minecraft.src.EntityPlayer;
5+import net.minecraft.src.ItemStack;
6+import net.minecraft.src.World;
7+
8+public interface ICompoundHandler {
9+
10+ void onRightClickHandler(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
11+
12+ ItemStack onItemUseHandler(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10);
13+
14+ void onUpdateHandler(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5);
15+
16+}
--- /dev/null
+++ b/src/ItemAtoms.java
@@ -0,0 +1,54 @@
1+package net.minecraft.src.ChemiCraft;
2+
3+import java.util.List;
4+
5+import net.minecraft.src.CreativeTabs;
6+import net.minecraft.src.EntityPlayer;
7+import net.minecraft.src.Item;
8+import net.minecraft.src.ItemStack;
9+import net.minecraft.src.World;
10+import cpw.mods.fml.common.Side;
11+import cpw.mods.fml.common.asm.SideOnly;
12+
13+public class ItemAtoms extends Item {
14+
15+ public ItemAtoms(int par1) {
16+ super(par1);
17+ this.maxStackSize = 1;
18+ this.setHasSubtypes(true);
19+ this.setMaxDamage(0);
20+ this.setCreativeTab(CreativeTabs.tabMaterials);
21+ }
22+
23+ @SideOnly(Side.CLIENT)
24+ @Override
25+ public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
26+ {
27+ for(int type = 0; type < ChemiCraft.atomsName.length; type++)
28+ {
29+ par3List.add(new ItemStack(par1, 1, type));
30+ this.setIconIndex(type);
31+ }
32+ }
33+
34+ @Override
35+ public String getItemNameIS(ItemStack par1ItemStack)
36+ {
37+ return super.getItemName() + "." + ChemiCraft.atomsName[par1ItemStack.getItemDamage()];
38+ }
39+
40+ @Override
41+ public String getTextureFile()
42+ {
43+ this.isDefaultTexture = false;
44+ return "/ChemiCraft/Atoms.png";
45+ }
46+
47+ @SideOnly(Side.CLIENT)
48+ @Override
49+ public int getIconFromDamage(int par1)
50+ {
51+ return par1;
52+ }
53+
54+}
\ No newline at end of file
--- /dev/null
+++ b/src/ItemCompounds.java
@@ -0,0 +1,52 @@
1+package net.minecraft.src.ChemiCraft;
2+
3+import java.util.List;
4+
5+import cpw.mods.fml.common.Side;
6+import cpw.mods.fml.common.asm.SideOnly;
7+import net.minecraft.src.CreativeTabs;
8+import net.minecraft.src.Item;
9+import net.minecraft.src.ItemStack;
10+
11+public class ItemCompounds extends Item {
12+
13+ public ItemCompounds(int par1) {
14+ super(par1);
15+ this.maxStackSize = 1;
16+ this.setHasSubtypes(true);
17+ this.setMaxDamage(0);
18+ this.setCreativeTab(CreativeTabs.tabMaterials);
19+ }
20+
21+ @SideOnly(Side.CLIENT)
22+ @Override
23+ public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
24+ {
25+ for(int type = 0; type < ChemiCraftAPI.getCompoundsName().toArray().length; type++)
26+ {
27+ par3List.add(new ItemStack(par1, 1, type));
28+ this.setIconIndex(type);
29+ }
30+ }
31+
32+ @Override
33+ public String getItemNameIS(ItemStack par1ItemStack)
34+ {
35+ return super.getItemName() + "." + ChemiCraftAPI.getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
36+ }
37+
38+ @Override
39+ public String getTextureFile()
40+ {
41+ this.isDefaultTexture = false;
42+ return "/ChemiCraft/Compounds.png";
43+ }
44+
45+ @SideOnly(Side.CLIENT)
46+ @Override
47+ public int getIconFromDamage(int par1)
48+ {
49+ return par1;
50+ }
51+
52+}
--- /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+}
--- /dev/null
+++ b/test.txt
@@ -0,0 +1,2 @@
1+test
2+
Show on old repository browser