Property atomsIDProp = cfg.getItem("AtomsID", 25000);\r
Property compoundsIDProp = cfg.getItem("CompoundsID", 25001);\r
Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);\r
- Property atomGrenadeIDProp = cfg.getItem("GrenadeID0", 25003);\r
+ Property atomGrenadeIDProp = cfg.getItem("AtomGrenadeID", 25003);\r
\r
Property guiDecompositionTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1000);\r
Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1001);\r
public final static int BORON = 4;\r
public final static int CARBON = 5;\r
public final static int NITROGEN = 6;\r
- public final static int URANIUM = 92;\r
+ public final static int URANIUM = 91;\r
\r
}
\ No newline at end of file
if(ChemiCraftAPI.instance.getMaterialNBTRecipe().get(i) != null){
ItemStack[] useItems = ChemiCraftAPI.instance.getMaterialNBTRecipe().get(i).setNBT(effectMaterial.toArray(new ItemStack[3]), result);
-
+ for(int j = 0;j < useItems.length;j++){
+ System.out.println(useItems[j]);
+ }
((InventoryMaterialCrafting) par1IInventory).subtractStack(0, 3, useItems);
}
@Override
public void onCraftMatrixChanged(IInventory par1IInventory){
- for(int i = 0;i < ChemiCraftAPI.instance.getCraftingManager().getDecompositionResults(this.inv).length;i++){
- this.inv.setInventorySlotContents(i, ChemiCraftAPI.instance.getCraftingManager().getDecompositionResults(this.inv)[i]);
+ if(ChemiCraftAPI.instance.getCraftingManager().getDecompositionResults(this.inv) != null){
+ for(int i = 0;i < ChemiCraftAPI.instance.getCraftingManager().getDecompositionResults(this.inv).length;i++){
+ this.inv.setInventorySlotContents(i, ChemiCraftAPI.instance.getCraftingManager().getDecompositionResults(this.inv)[i]);
+ }
}
this.inv.setFlag(true);
}
package chemicraft;
+import java.util.List;
+
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.PotionEffect;
import net.minecraft.src.World;
public class EntityAtomGrenade extends EntityThrowable
{
- private int expSize;
- private boolean expFire;
-
- public EntityAtomGrenade(World par1World) {
- super(par1World);
- }
+ private float explodeSize;
+ private boolean isExplode;
+ private boolean onFire;
+ private boolean isNuke;
- public EntityAtomGrenade(World par1World, EntityLiving par2EntityLiving) {
+ public EntityAtomGrenade(World par1World, EntityLiving par2EntityLiving, boolean par3, boolean par4, boolean par5) {
super(par1World, par2EntityLiving);
+ this.isExplode = par3;
+ this.onFire = par4;
+ this.isNuke = par5;
}
- public EntityAtomGrenade(World par1World, double par2, double par4, double par6) {
- super(par1World, par2, par4, par6);
+ @Override
+ public void onUpdate(){
+ super.onUpdate();
}
@Override
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
+
+ if(isExplode){
+ this.explodeSize = 3.0F;
+ }
+
+ if(isNuke){
+ this.explodeSize = 20.0F;
+ }
+
if (par1MovingObjectPosition.entityHit != null) {
- par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.thrower), 0);
-
+ par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.thrower), 2);
}
- if (!this.worldObj.isRemote) {
- this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, expSize, expFire);
+ if (!this.worldObj.isRemote && !isNuke) {
+ this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, explodeSize, onFire);
+ this.isDead = true;
+ }else if(!this.worldObj.isRemote && isNuke){
+ this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, explodeSize, onFire);
+ List entity = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, this.boundingBox.expand(20, 20, 20));
+ for(int i = 0;i < entity.size();i++){
+ ((EntityLiving)entity.get(i)).addPotionEffect(new PotionEffect(18, 1, 60 * 20));
+ ((EntityLiving)entity.get(i)).addPotionEffect(new PotionEffect(19, 1, 60 * 20));
+ }
+ this.isDead = true;
}
}
if(flag2){
for(int i = 0;i < par2;i++){
if(par3ItemStack[i] != null){
- if(par3ItemStack[i].stackSize >= 1){
+ if(par3ItemStack[i].stackSize > 1){
this.setInventorySlotContents(i, new ItemStack(par3ItemStack[i].itemID, --par3ItemStack[i].stackSize, par3ItemStack[i].getItemDamage()));
}else{
this.setInventorySlotContents(i, null);
import java.util.List;
+import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NBTTagList;
+import net.minecraft.src.World;
public class ItemAtomGrenade extends Item {
super(par1);
}
+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
+ if(par1ItemStack.stackSize <= 0){
+ return null;
+ }
+
+ boolean var1 = false;
+ boolean var2 = false;
+ boolean var3 = false;
+
+ NBTTagList var4 = par1ItemStack.getTagCompound().getTagList("Effect");
+
+ for(int i = 0;i < 3;i++){
+ if(!((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("")){
+ if(((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("Hydrogen")){
+ var1 = true;
+ }
+ if(((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("Carbon")){
+ var2 = true;
+ }
+ if(((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("Uranium")){
+ var3 = true;
+ }
+ }
+ }
+
+ EntityAtomGrenade entity = new EntityAtomGrenade(par2World, par3EntityPlayer, var1, var2, var3);
+ par2World.spawnEntityInWorld(entity);
+ par1ItemStack.stackSize--;
+ return par1ItemStack;
+ }
+
@Override
public void addInformation(ItemStack par1ItemStack, List par2List) {
NBTTagList var1 = par1ItemStack.getTagCompound().getTagList("Effect");