OSDN Git Service

・ItemGrenadeクラスをItemAtomGrenadeクラスに変更
authorponkotate <ponkotate@users.sourceforge.jp>
Sat, 22 Dec 2012 09:29:35 +0000 (18:29 +0900)
committerponkotate <ponkotate@users.sourceforge.jp>
Sat, 22 Dec 2012 09:29:35 +0000 (18:29 +0900)
・EntityAtomGrenadeクラスの型だけ作った

common/chemicraft/ChemiCraft.java
common/chemicraft/EntityAtomGrenade.java [new file with mode: 0644]
common/chemicraft/ItemAtomGrenade.java [moved from common/chemicraft/ItemGrenade.java with 89% similarity]

index e3e157a..d86014b 100644 (file)
@@ -177,7 +177,7 @@ public class ChemiCraft {
                this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms");\r
                this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds");\r
                this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0);\r
-               this.itemGrenade = new ItemGrenade(this.grenadeID).setItemName("grenade").setIconIndex(1);\r
+               this.itemGrenade = new ItemAtomGrenade(this.grenadeID).setItemName("grenade").setIconIndex(1);\r
 \r
                // BlockをMinecraftに登録します\r
                GameRegistry.registerBlock(this.blockDecompositionTable);\r
@@ -201,8 +201,8 @@ public class ChemiCraft {
                this.NameAuxiliary.addName(this.itemAtoms, "ja_JP", atomsNameJP);\r
                this.NameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle");\r
                this.NameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶");\r
-               this.NameAuxiliary.addName(this.itemGrenade, "Grenade");\r
-               this.NameAuxiliary.addName(this.itemGrenade, "手榴弾");\r
+               this.NameAuxiliary.addName(this.itemGrenade, "AtomGrenade");\r
+               this.NameAuxiliary.addName(this.itemGrenade, "元素手榴弾");\r
 \r
                // TileEntityを追加します\r
                GameRegistry.registerTileEntity(TileEntityDecompositionTable.class, "DecompositionTable");\r
diff --git a/common/chemicraft/EntityAtomGrenade.java b/common/chemicraft/EntityAtomGrenade.java
new file mode 100644 (file)
index 0000000..80c0ea4
--- /dev/null
@@ -0,0 +1,43 @@
+package chemicraft;
+
+import net.minecraft.src.DamageSource;
+import net.minecraft.src.Entity;
+import net.minecraft.src.EntityChicken;
+import net.minecraft.src.EntityLiving;
+import net.minecraft.src.EntityThrowable;
+import net.minecraft.src.MovingObjectPosition;
+import net.minecraft.src.World;
+
+public class EntityAtomGrenade extends EntityThrowable
+{
+
+       private int expSize;
+       private boolean expFire;
+
+       public EntityAtomGrenade(World par1World) {
+               super(par1World);
+       }
+
+       public EntityAtomGrenade(World par1World, EntityLiving par2EntityLiving) {
+               super(par1World, par2EntityLiving);
+       }
+
+       public EntityAtomGrenade(World par1World, double par2, double par4, double par6) {
+               super(par1World, par2, par4, par6);
+       }
+
+       @Override
+       protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
+       {
+               if (par1MovingObjectPosition.entityHit != null) {
+                       par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.thrower), 0);
+                       
+               }
+
+               if (!this.worldObj.isRemote) {
+                       this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, expSize, expFire);
+               }
+
+       }
+
+}
similarity index 89%
rename from common/chemicraft/ItemGrenade.java
rename to common/chemicraft/ItemAtomGrenade.java
index 697660f..ac384d3 100644 (file)
@@ -7,9 +7,9 @@ import net.minecraft.src.ItemStack;
 import net.minecraft.src.NBTTagCompound;
 import net.minecraft.src.NBTTagList;
 
-public class ItemGrenade extends Item {
+public class ItemAtomGrenade extends Item {
 
-       protected ItemGrenade(int par1) {
+       protected ItemAtomGrenade(int par1) {
                super(par1);
        }