OSDN Git Service

修正・変更
[chemicraft/chemicraft.git] / common / pcc / chemicraft / core / item / ItemAtoms.java
index 48e4714..b3ee9a3 100644 (file)
@@ -6,12 +6,15 @@ import java.util.Random;
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.entity.Entity;
 import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.potion.PotionEffect;
 import net.minecraft.util.DamageSource;
 import net.minecraft.util.EntityDamageSource;
 import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
 import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.core.ChemiCraftCore;
 import pcc.chemicraft.util.AtomInfo;
@@ -40,7 +43,16 @@ public class ItemAtoms extends Item {
                                        EntityLiving entity = (EntityLiving)par3Entity;
                                        entity.attackEntityFrom(ChemiCraftCore.getRadiationDamageSource(entity), 1);
                                }
-                               par1ItemStack.setItemDamage(AtomInfo.collapseUraniumSeries(par1ItemStack.getItemDamage() + 1) - 1);
+                               if (par3Entity instanceof EntityPlayer){
+                                       EntityPlayer player = (EntityPlayer)par3Entity;
+                                       ItemStack itemstack = new ItemStack(
+                                                       par1ItemStack.itemID,
+                                                       1,
+                                                       par1ItemStack.getItemDamage());
+                                       itemstack.setItemDamage(AtomInfo.collapseUraniumSeries(itemstack.getItemDamage() + 1) - 1);
+                                       player.inventory.addItemStackToInventory(itemstack);
+                                       player.inventory.consumeInventoryItem(par1ItemStack.itemID);
+                               }
                        }
                }
        }