Reorganized github - Renamed packages lowercase

This commit is contained in:
GotoLink 2013-10-20 23:40:12 +02:00
commit 579ddee7f0
362 changed files with 5163 additions and 8935 deletions

View file

@ -1,4 +1,4 @@
package MysticWorld.Items;
package mysticworld.items;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraftforge.common.EnumHelper;

View file

@ -1,52 +1,47 @@
package MysticWorld.Items;
package mysticworld.items;
import MysticWorld.MysticWorld;
import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
public class ItemArmorAdamantine extends ItemArmor
{
public class ItemArmorAdamantine extends ItemArmor {
int ArmorType;
String ArmorFile_1;
String ArmorFile_2;
public ItemArmorAdamantine(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
super(par1, par2EnumArmorMaterial,par3,par4);
this.ArmorType=par4;
this.setMaxDamage(3000);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/MysticMods/textures/armor/adamantine_1.png";
this.ArmorFile_2 = "/MysticMods/textures/armor/adamantine_2.png";
}
super(par1, par2EnumArmorMaterial, par3, par4);
this.ArmorType = par4;
this.setMaxDamage(3000);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/MysticMods/textures/armor/adamantine_1.png";
this.ArmorFile_2 = "/MysticMods/textures/armor/adamantine_2.png";
}
@Override
public void registerIcons(IconRegister iconRegister)
{
switch (ArmorType){
case 0:
itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_0");
break;
case 1:
itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_1");
break;
case 2:
itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_2");
break;
case 3:
itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_3");
break;
}
}
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
int suffix = this.armorType == 2 ? 2 : 1;
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
int suffix = this.armorType == 2 ? 2 : 1;
return "MysticMods:textures" + "/models/armor/Adamantine_layer_" + suffix + ".png";
}
return "MysticMods:textures" + "/models/armor/Adamantine_layer_" + suffix + ".png";
}
@Override
public void registerIcons(IconRegister iconRegister) {
switch (ArmorType) {
case 0:
itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_0");
break;
case 1:
itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_1");
break;
case 2:
itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_2");
break;
case 3:
itemIcon = iconRegister.registerIcon("MysticMods:AdamantineArmor_3");
break;
}
}
}

View file

@ -1,8 +1,7 @@
package MysticWorld.Items;
package mysticworld.items;
import MysticWorld.MysticWorld;
import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumArmorMaterial;
@ -12,89 +11,72 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class ItemArmorIridium extends ItemArmor
{
public class ItemArmorIridium extends ItemArmor {
int ArmorType;
String ArmorFile_1;
String ArmorFile_2;
public ItemArmorIridium(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
super(par1, par2EnumArmorMaterial,par3,par4);
this.ArmorType=par4;
this.setMaxDamage(4000);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/assets/MysticMods/textures/armor/iridium_1.png";
this.ArmorFile_2 = "/assets/MysticMods/textures/armor/iridium_2.png";
}
super(par1, par2EnumArmorMaterial, par3, par4);
this.ArmorType = par4;
this.setMaxDamage(4000);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/assets/MysticMods/textures/armor/iridium_1.png";
this.ArmorFile_2 = "/assets/MysticMods/textures/armor/iridium_2.png";
}
@Override
public void registerIcons(IconRegister iconRegister)
{
switch (ArmorType){
case 0:
itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_0");
break;
case 1:
itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_1");
break;
case 2:
itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_2");
break;
case 3:
itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_3");
break;
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
int suffix = this.armorType == 2 ? 2 : 1;
return "MysticMods:textures" + "/models/armor/Iridium_layer_" + suffix + ".png";
}
@Override
public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) {
ItemStack helmet = player.getCurrentItemOrArmor(4);
ItemStack plate = player.getCurrentItemOrArmor(3);
ItemStack legs = player.getCurrentItemOrArmor(2);
ItemStack boots = player.getCurrentItemOrArmor(1);
if (helmet != null) {
if (helmet.itemID == ItemHandler$1.iridiumHelmet.itemID) {
player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 200, 0)));
}
}
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
int suffix = this.armorType == 2 ? 2 : 1;
return "MysticMods:textures" + "/models/armor/Iridium_layer_" + suffix + ".png";
}
@Override
public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack)
{
ItemStack helmet = player.getCurrentItemOrArmor(4);
ItemStack plate = player.getCurrentItemOrArmor(3);
ItemStack legs = player.getCurrentItemOrArmor(2);
ItemStack boots = player.getCurrentItemOrArmor(1);
if (helmet != null)
{
if(helmet.itemID == ItemHandler$1.iridiumHelmet.itemID)
{
player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 200, 0)));
}
}
if (plate != null)
{
if(plate.itemID == ItemHandler$1.iridiumChestplate.itemID)
{
player.addPotionEffect((new PotionEffect(Potion.regeneration.getId(), 200, 0)));
}
}
if (legs != null)
{
if(legs.itemID == ItemHandler$1.iridiumLeggings.itemID)
{
player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 200, 2)));
player.addVelocity(0.0005, 0, 0.0005);
player.stepHeight = 1.001F;
}
}
if (boots != null)
{
if(boots.itemID == ItemHandler$1.iridiumBoots.itemID)
{
player.fallDistance = 0.0F;
player.addPotionEffect((new PotionEffect(Potion.jump.getId(), 200, 2)));
}
if (plate != null) {
if (plate.itemID == ItemHandler$1.iridiumChestplate.itemID) {
player.addPotionEffect((new PotionEffect(Potion.regeneration.getId(), 200, 0)));
}
}
if (legs != null) {
if (legs.itemID == ItemHandler$1.iridiumLeggings.itemID) {
player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 200, 2)));
player.addVelocity(0.0005, 0, 0.0005);
player.stepHeight = 1.001F;
}
}
if (boots != null) {
if (boots.itemID == ItemHandler$1.iridiumBoots.itemID) {
player.fallDistance = 0.0F;
player.addPotionEffect((new PotionEffect(Potion.jump.getId(), 200, 2)));
}
}
}
@Override
public void registerIcons(IconRegister iconRegister) {
switch (ArmorType) {
case 0:
itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_0");
break;
case 1:
itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_1");
break;
case 2:
itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_2");
break;
case 3:
itemIcon = iconRegister.registerIcon("MysticMods:IridiumArmor_3");
break;
}
}
}

View file

@ -1,53 +1,47 @@
package MysticWorld.Items;
package mysticworld.items;
import MysticWorld.MysticWorld;
import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
public class ItemArmorMithril extends ItemArmor
{
public class ItemArmorMithril extends ItemArmor {
int ArmorType;
String ArmorFile_1;
String ArmorFile_2;
public ItemArmorMithril(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
super(par1, par2EnumArmorMaterial,par3,par4);
this.ArmorType=par4;
this.setMaxDamage(500);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/assets/MysticMods/textures/armor/mithril_1.png";
this.ArmorFile_2 = "/assets/MysticMods/textures/armor/mithril_2.png";
}
super(par1, par2EnumArmorMaterial, par3, par4);
this.ArmorType = par4;
this.setMaxDamage(500);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/assets/MysticMods/textures/armor/mithril_1.png";
this.ArmorFile_2 = "/assets/MysticMods/textures/armor/mithril_2.png";
}
@Override
public void registerIcons(IconRegister iconRegister)
{
switch (ArmorType){
case 0:
itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_0");
break;
case 1:
itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_1");
break;
case 2:
itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_2");
break;
case 3:
itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_3");
break;
}
}
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
int suffix = this.armorType == 2 ? 2 : 1;
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
int suffix = this.armorType == 2 ? 2 : 1;
return "MysticMods:textures" + "/models/armor/Mithril_layer_" + suffix + ".png";
}
return "MysticMods:textures" + "/models/armor/Mithril_layer_" + suffix + ".png";
}
@Override
public void registerIcons(IconRegister iconRegister) {
switch (ArmorType) {
case 0:
itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_0");
break;
case 1:
itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_1");
break;
case 2:
itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_2");
break;
case 3:
itemIcon = iconRegister.registerIcon("MysticMods:MithrilArmor_3");
break;
}
}
}

View file

@ -1,53 +1,47 @@
package MysticWorld.Items;
package mysticworld.items;
import MysticWorld.MysticWorld;
import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
public class ItemArmorVerdite extends ItemArmor
{
public class ItemArmorVerdite extends ItemArmor {
int ArmorType;
String ArmorFile_1;
String ArmorFile_2;
public ItemArmorVerdite(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {
super(par1, par2EnumArmorMaterial,par3,par4);
this.ArmorType=par4;
this.setMaxDamage(262);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/assets/MysticMods/textures/armor/verdite_1.png";
this.ArmorFile_2 = "/assets/MysticMods/textures/armor/verdite_2.png";
}
super(par1, par2EnumArmorMaterial, par3, par4);
this.ArmorType = par4;
this.setMaxDamage(262);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.ArmorFile_1 = "/assets/MysticMods/textures/armor/verdite_1.png";
this.ArmorFile_2 = "/assets/MysticMods/textures/armor/verdite_2.png";
}
@Override
public void registerIcons(IconRegister iconRegister)
{
switch (ArmorType){
case 0:
itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_0");
break;
case 1:
itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_1");
break;
case 2:
itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_2");
break;
case 3:
itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_3");
break;
}
}
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
int suffix = this.armorType == 2 ? 2 : 1;
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
int suffix = this.armorType == 2 ? 2 : 1;
return "MysticMods:textures" + "/models/armor/Verdite_layer_" + suffix + ".png";
}
return "MysticMods:textures" + "/models/armor/Verdite_layer_" + suffix + ".png";
}
@Override
public void registerIcons(IconRegister iconRegister) {
switch (ArmorType) {
case 0:
itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_0");
break;
case 1:
itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_1");
break;
case 2:
itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_2");
break;
case 3:
itemIcon = iconRegister.registerIcon("MysticMods:VerditeArmor_3");
break;
}
}
}

View file

@ -1,16 +1,11 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.List;
import MysticWorld.MysticWorld;
import MysticWorld.Lib.Strings;
import MysticWorld.Util.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
@ -18,154 +13,144 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBushFruit extends ItemFood {
private Icon[] icons;
private static final String[] FRUIT_TYPES = new String[] {"Mundane", "Poison", "Weakness", "Slowness", "Harming", "Wither", "Health", "Speed", "FireResistance", "Regen", "NightVision", "Invisibility"};
private static final String[] FRUIT_TYPES = new String[] { "Mundane", "Poison", "Weakness", "Slowness", "Harming", "Wither", "Health", "Speed", "FireResistance", "Regen", "NightVision",
"Invisibility" };
public ItemBushFruit(int id, int health)
{
public ItemBushFruit(int id, int health) {
super(id, health, 0.6F, false);
this.setHasSubtypes(true);
this.setCreativeTab(MysticWorld.MysticWorldTab);
maxStackSize = 64;
setAlwaysEdible();
setUnlocalizedName("bushFruit");
this.setHasSubtypes(true);
this.setCreativeTab(MysticWorld.MysticWorldTab);
maxStackSize = 64;
setAlwaysEdible();
setUnlocalizedName("bushFruit");
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer player)
{
if ((player.canEat(true)) && (player.getFoodStats().getSaturationLevel() < 20.0F))
{
player.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
protected void onFoodEaten(ItemStack itemstack, World world, EntityPlayer player)
{
if (!world.isRemote)
{
int duration = 0;
PotionEffect potion;
switch(itemstack.getItemDamage())
{
case 1:potion = player.getActivePotionEffect(Potion.poison);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 160, 0));
break;
case 2:potion = player.getActivePotionEffect(Potion.weakness);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.weakness.id, duration + 160, 0));
break;
case 3:potion = player.getActivePotionEffect(Potion.moveSlowdown);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration + 160, 0));
break;
case 4:potion = player.getActivePotionEffect(Potion.harm);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.harm.id, duration + 1, 0));
break;
case 5:potion = player.getActivePotionEffect(Potion.wither);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.wither.id, duration + 160, 0));
break;
case 6:potion = player.getActivePotionEffect(Potion.heal);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.heal.id, duration + 1, 0));
break;
case 7:potion = player.getActivePotionEffect(Potion.moveSpeed);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, duration + 160, 0));
break;
case 8:potion = player.getActivePotionEffect(Potion.fireResistance);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, duration + 160, 0));
break;
case 9:potion = player.getActivePotionEffect(Potion.regeneration);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, duration + 160, 0));
break;
case 10:potion = player.getActivePotionEffect(Potion.nightVision);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, duration + 160, 0));
break;
case 11:potion = player.getActivePotionEffect(Potion.invisibility);
if(potion != null)
{
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, duration + 160, 0));
break;
}
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, FRUIT_TYPES.length);
return icons[j];
}
public int getMaxItemUseDuration(ItemStack itemstack)
{
return 24;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
icons = new Icon[FRUIT_TYPES.length];
for (int i = 0; i < FRUIT_TYPES.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:Fruit" + FRUIT_TYPES[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta) {
@Override
public int getMaxItemUseDuration(ItemStack itemstack) {
return 24;
}
int j = MathHelper.clamp_int(meta, 0, FRUIT_TYPES.length);
return icons[j];
}
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int var4 = 0; var4 < FRUIT_TYPES.length; var4++)
{
par3List.add(new ItemStack(par1, 1, var4));
}
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int var4 = 0; var4 < FRUIT_TYPES.length; var4++) {
par3List.add(new ItemStack(par1, 1, var4));
}
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer player) {
if ((player.canEat(true)) && (player.getFoodStats().getSaturationLevel() < 20.0F)) {
player.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
icons = new Icon[FRUIT_TYPES.length];
for (int i = 0; i < FRUIT_TYPES.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:Fruit" + FRUIT_TYPES[i]);
}
}
@Override
protected void onFoodEaten(ItemStack itemstack, World world, EntityPlayer player) {
if (!world.isRemote) {
int duration = 0;
PotionEffect potion;
switch (itemstack.getItemDamage()) {
case 1:
potion = player.getActivePotionEffect(Potion.poison);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 160, 0));
break;
case 2:
potion = player.getActivePotionEffect(Potion.weakness);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.weakness.id, duration + 160, 0));
break;
case 3:
potion = player.getActivePotionEffect(Potion.moveSlowdown);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration + 160, 0));
break;
case 4:
potion = player.getActivePotionEffect(Potion.harm);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.harm.id, duration + 1, 0));
break;
case 5:
potion = player.getActivePotionEffect(Potion.wither);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.wither.id, duration + 160, 0));
break;
case 6:
potion = player.getActivePotionEffect(Potion.heal);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.heal.id, duration + 1, 0));
break;
case 7:
potion = player.getActivePotionEffect(Potion.moveSpeed);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, duration + 160, 0));
break;
case 8:
potion = player.getActivePotionEffect(Potion.fireResistance);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, duration + 160, 0));
break;
case 9:
potion = player.getActivePotionEffect(Potion.regeneration);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, duration + 160, 0));
break;
case 10:
potion = player.getActivePotionEffect(Potion.nightVision);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, duration + 160, 0));
break;
case 11:
potion = player.getActivePotionEffect(Potion.invisibility);
if (potion != null) {
duration = potion.duration;
}
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, duration + 160, 0));
break;
}
}
}
}

View file

@ -1,108 +1,86 @@
package MysticWorld.Items;
package mysticworld.items;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import MysticWorld.MysticWorld;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Lib.ItemIds;
import MysticWorld.Lib.Strings;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumArmorMaterial;
import mysticworld.MysticWorld;
import mysticworld.lib.ItemIds;
import mysticworld.lib.Strings;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
public class ItemHandler$1 {
public static Item staffParts;
public static Item imbuedShard;
public static Item fireStaff;
public static Item waterStaff;
public static Item earthStaff;
public static Item airStaff;
public static Item energyStaff;
public static Item fireStaffPower;
public static Item waterStaffPower;
public static Item earthStaffPower;
public static Item airStaffPower;
public static Item energyStaffPower;
public static Item staffPower;
public static Item fireOrb;
public static Item waterOrb;
public static Item earthOrb;
public static Item airOrb;
public static Item energyOrb;
public static Item bushFruit;
public static Item verditeHelmet;
public static Item verditeChestplate;
public static Item verditeLeggings;
public static Item verditeBoots;
public static Item adamantineHelmet;
public static Item adamantineChestplate;
public static Item adamantineLeggings;
public static Item adamantineBoots;
public static Item mithrilHelmet;
public static Item mithrilChestplate;
public static Item mithrilLeggings;
public static Item mithrilBoots;
public static Item iridiumHelmet;
public static Item iridiumChestplate;
public static Item iridiumLeggings;
public static Item iridiumBoots;
public static Item voidShard;
public static void init(){
public static void init() {
staffParts = new ItemStaffParts(ItemIds.STAFF_PARTS);
imbuedShard = new ItemImbuedShard(ItemIds.IMBUED_SHARD);
bushFruit = new ItemBushFruit(ItemIds.BUSH_FRUIT, 2);
fireStaff = new ItemStaffFire(ItemIds.FIRE_STAFF).setUnlocalizedName(Strings.FIRE_STAFF_NAME);
waterStaff = new ItemStaffWater(ItemIds.WATER_STAFF).setUnlocalizedName(Strings.WATER_STAFF_NAME);
earthStaff = new ItemStaffEarth(ItemIds.EARTH_STAFF).setUnlocalizedName(Strings.EARTH_STAFF_NAME);
airStaff = new ItemStaffAir(ItemIds.AIR_STAFF).setUnlocalizedName(Strings.AIR_STAFF_NAME);
energyStaff = new ItemStaffEnegy(ItemIds.ENERGY_STAFF).setUnlocalizedName(Strings.ENERGY_STAFF_NAME);
staffPower = new ItemStaffPower(ItemIds.STAFF_POWER);
fireOrb = new ItemOrbFire(ItemIds.FIRE_ORB).setUnlocalizedName(Strings.FIRE_ORB_NAME);
waterOrb = new ItemOrbWater(ItemIds.WATER_ORB).setUnlocalizedName(Strings.WATER_ORB_NAME);
earthOrb = new ItemOrbEarth(ItemIds.EARTH_ORB).setUnlocalizedName(Strings.EARTH_ORB_NAME);
airOrb = new ItemOrbAir(ItemIds.AIR_ORB).setUnlocalizedName(Strings.AIR_ORB_NAME);
energyOrb = new ItemOrbEnergy(ItemIds.ENERGY_ORB).setUnlocalizedName(Strings.ENERGY_ORB_NAME);
verditeHelmet = new ItemArmorVerdite(ItemIds.VERDITE_HELMET, EnumArmor.Verdite, MysticWorld.proxy.addArmor(EnumArmor.Verdite.name()), 0).setUnlocalizedName(Strings.VERDITE_HELMET_NAME);
verditeChestplate = new ItemArmorVerdite(ItemIds.VERDITE_CHESTPLATE, EnumArmor.Verdite, MysticWorld.proxy.addArmor(EnumArmor.Verdite.name()), 1).setUnlocalizedName(Strings.VERDITE_CHESTPLATE_NAME);
verditeChestplate = new ItemArmorVerdite(ItemIds.VERDITE_CHESTPLATE, EnumArmor.Verdite, MysticWorld.proxy.addArmor(EnumArmor.Verdite.name()), 1)
.setUnlocalizedName(Strings.VERDITE_CHESTPLATE_NAME);
verditeLeggings = new ItemArmorVerdite(ItemIds.VERDITE_LEGGINGS, EnumArmor.Verdite, MysticWorld.proxy.addArmor(EnumArmor.Verdite.name()), 2).setUnlocalizedName(Strings.VERDITE_LEGGINGS_NAME);
verditeBoots = new ItemArmorVerdite(ItemIds.VERDITE_BOOTS, EnumArmor.Verdite, MysticWorld.proxy.addArmor(EnumArmor.Verdite.name()), 3).setUnlocalizedName(Strings.VERDITE_BOOTS_NAME);
mithrilHelmet = new ItemArmorMithril(ItemIds.MITHRIL_HELMET, EnumArmor.Mithril, MysticWorld.proxy.addArmor(EnumArmor.Mithril.name()), 0).setUnlocalizedName(Strings.MITHRIL_HELMET_NAME);
mithrilChestplate = new ItemArmorMithril(ItemIds.MITHRIL_CHESTPLATE, EnumArmor.Mithril, MysticWorld.proxy.addArmor(EnumArmor.Mithril.name()), 1).setUnlocalizedName(Strings.MITHRIL_CHESTPLATE_NAME);
mithrilChestplate = new ItemArmorMithril(ItemIds.MITHRIL_CHESTPLATE, EnumArmor.Mithril, MysticWorld.proxy.addArmor(EnumArmor.Mithril.name()), 1)
.setUnlocalizedName(Strings.MITHRIL_CHESTPLATE_NAME);
mithrilLeggings = new ItemArmorMithril(ItemIds.MITHRIL_LEGGINGS, EnumArmor.Mithril, MysticWorld.proxy.addArmor(EnumArmor.Mithril.name()), 2).setUnlocalizedName(Strings.MITHRIL_LEGGINGS_NAME);
mithrilBoots = new ItemArmorMithril(ItemIds.MITHRIL_BOOTS, EnumArmor.Mithril, MysticWorld.proxy.addArmor(EnumArmor.Mithril.name()), 3).setUnlocalizedName(Strings.MITHRIL_BOOTS_NAME);
adamantineHelmet = new ItemArmorAdamantine(ItemIds.ADAMANTINE_HELMET, EnumArmor.Adamantine, MysticWorld.proxy.addArmor(EnumArmor.Adamantine.name()), 0).setUnlocalizedName(Strings.ADAMANTINE_HELMET_NAME);
adamantineChestplate = new ItemArmorAdamantine(ItemIds.ADAMANTINE_CHESTPLATE, EnumArmor.Adamantine, MysticWorld.proxy.addArmor(EnumArmor.Adamantine.name()), 1).setUnlocalizedName(Strings.ADAMANTINE_CHESTPLATE_NAME);
adamantineLeggings = new ItemArmorAdamantine(ItemIds.ADAMANTINE_LEGGINGS, EnumArmor.Adamantine, MysticWorld.proxy.addArmor(EnumArmor.Adamantine.name()), 2).setUnlocalizedName(Strings.ADAMANTINE_LEGGINGS_NAME);
adamantineBoots = new ItemArmorAdamantine(ItemIds.ADAMANTINE_BOOTS, EnumArmor.Adamantine, MysticWorld.proxy.addArmor(EnumArmor.Adamantine.name()), 3).setUnlocalizedName(Strings.ADAMANTINE_BOOTS_NAME);
adamantineHelmet = new ItemArmorAdamantine(ItemIds.ADAMANTINE_HELMET, EnumArmor.Adamantine, MysticWorld.proxy.addArmor(EnumArmor.Adamantine.name()), 0)
.setUnlocalizedName(Strings.ADAMANTINE_HELMET_NAME);
adamantineChestplate = new ItemArmorAdamantine(ItemIds.ADAMANTINE_CHESTPLATE, EnumArmor.Adamantine, MysticWorld.proxy.addArmor(EnumArmor.Adamantine.name()), 1)
.setUnlocalizedName(Strings.ADAMANTINE_CHESTPLATE_NAME);
adamantineLeggings = new ItemArmorAdamantine(ItemIds.ADAMANTINE_LEGGINGS, EnumArmor.Adamantine, MysticWorld.proxy.addArmor(EnumArmor.Adamantine.name()), 2)
.setUnlocalizedName(Strings.ADAMANTINE_LEGGINGS_NAME);
adamantineBoots = new ItemArmorAdamantine(ItemIds.ADAMANTINE_BOOTS, EnumArmor.Adamantine, MysticWorld.proxy.addArmor(EnumArmor.Adamantine.name()), 3)
.setUnlocalizedName(Strings.ADAMANTINE_BOOTS_NAME);
iridiumHelmet = new ItemArmorIridium(ItemIds.IRIDIUM_HELMET, EnumArmor.Iridium, MysticWorld.proxy.addArmor(EnumArmor.Iridium.name()), 0).setUnlocalizedName(Strings.IRIDIUM_HELMET_NAME);
iridiumChestplate = new ItemArmorIridium(ItemIds.IRIDIUM_CHESTPLATE, EnumArmor.Iridium, MysticWorld.proxy.addArmor(EnumArmor.Iridium.name()), 1).setUnlocalizedName(Strings.IRIDIUM_CHESTPLATE_NAME);
iridiumChestplate = new ItemArmorIridium(ItemIds.IRIDIUM_CHESTPLATE, EnumArmor.Iridium, MysticWorld.proxy.addArmor(EnumArmor.Iridium.name()), 1)
.setUnlocalizedName(Strings.IRIDIUM_CHESTPLATE_NAME);
iridiumLeggings = new ItemArmorIridium(ItemIds.IRIDIUM_LEGGINGS, EnumArmor.Iridium, MysticWorld.proxy.addArmor(EnumArmor.Iridium.name()), 2).setUnlocalizedName(Strings.IRIDIUM_LEGGINGS_NAME);
iridiumBoots = new ItemArmorIridium(ItemIds.IRIDIUM_BOOTS, EnumArmor.Iridium, MysticWorld.proxy.addArmor(EnumArmor.Iridium.name()), 3).setUnlocalizedName(Strings.IRIDIUM_BOOTS_NAME);
voidShard = new ItemVoidShard(ItemIds.VOID_SHARD).setUnlocalizedName(Strings.VOID_SHARD_NAME);
}
}

View file

@ -1,63 +1,56 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.List;
import mysticworld.MysticWorld;
import mysticworld.lib.Strings;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import MysticWorld.MysticWorld;
import MysticWorld.Lib.Strings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemImbuedShard extends Item {
private Icon[] icons;
private static final String[] SHARD_TYPES = new String[] {"Fire", "Water", "Earth", "Air", "Energy"};
private static final String[] SHARD_TYPES = new String[] { "Fire", "Water", "Earth", "Air", "Energy" };
public ItemImbuedShard(int id) {
super(id);
this.setHasSubtypes(true);
this.setUnlocalizedName(Strings.IMBUED_SHARD_NAME);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.setHasSubtypes(true);
this.setUnlocalizedName(Strings.IMBUED_SHARD_NAME);
this.setCreativeTab(MysticWorld.MysticWorldTab);
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, 5);
return icons[j];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int var4 = 0; var4 < SHARD_TYPES.length; var4++) {
par3List.add(new ItemStack(par1, 1, var4));
}
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return super.getUnlocalizedName() + SHARD_TYPES[meta];
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
icons = new Icon[SHARD_TYPES.length];
for (int i = 0; i < SHARD_TYPES.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:Shard" + SHARD_TYPES[i]);
}
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return super.getUnlocalizedName() + SHARD_TYPES[meta];
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
icons = new Icon[SHARD_TYPES.length];
for (int i = 0; i < SHARD_TYPES.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:Shard" + SHARD_TYPES[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, 5);
return icons[j];
}
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int var4 = 0; var4 < SHARD_TYPES.length; var4++){
par3List.add(new ItemStack(par1, 1, var4));
}
}
}

View file

@ -1,20 +1,17 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.Random;
import MysticWorld.MysticWorld;
import mysticworld.MysticWorld;
import net.minecraft.item.Item;
public class ItemOrb extends Item {
Random rand = new Random();
public ItemOrb(int id)
{
public ItemOrb(int id) {
super(id);
this.setMaxStackSize(1);
this.setMaxDamage(200);
this.setMaxStackSize(1);
this.setMaxDamage(200);
this.setCreativeTab(MysticWorld.MysticWorldTab);
}
}

View file

@ -1,142 +1,99 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.Random;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import MysticWorld.MysticWorld;
import MysticWorld.Entity.EntityChargeAir;
import net.minecraft.client.renderer.texture.IconRegister;
import mysticworld.MysticWorld;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class ItemOrbAir extends ItemOrb
{
public ItemOrbAir(int id)
{
import org.lwjgl.input.Mouse;
public class ItemOrbAir extends ItemOrb {
public ItemOrbAir(int id) {
super(id);
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
itemStack.setTagCompound(new NBTTagCompound());
if (itemStack.stackTagCompound.getBoolean("charging") == false) {
itemStack.stackTagCompound.setBoolean("charging", true);
}
return itemStack;
}
EntityPlayer player = (EntityPlayer)entity;
ItemStack currentItem = player.inventory.getCurrentItem();
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
itemStack.stackTagCompound.setInteger("maxChargeTime", 5 * 20);
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
player.fallDistance = 0.0F;
chargeEffect(itemStack, world, player);
if (!Mouse.isButtonDown(1))
{
if (itemStack.stackTagCompound.getInteger("chargeTime") > 0)
{
if (player.onGround)
{
world.playSoundEffect(player.posX, player.posY, player.posZ, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
player.setVelocity(0.0D, 1.0D + (float)(itemStack.stackTagCompound.getInteger("chargeTime")) * (2.5D * (1.0D / (double)itemStack.stackTagCompound.getInteger("maxChargeTime"))), 0.0D);
itemStack.damageItem(1, player);
if (!Mouse.isButtonDown(1)) {
if (itemStack.stackTagCompound.getInteger("chargeTime") > 0) {
if (player.onGround) {
world.playSoundEffect(player.posX, player.posY, player.posZ, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
player.setVelocity(0.0D, 1.0D + (itemStack.stackTagCompound.getInteger("chargeTime")) * (2.5D * (1.0D / itemStack.stackTagCompound.getInteger("maxChargeTime"))), 0.0D);
itemStack.damageItem(1, player);
}
}
resetData(itemStack);
}
else
{
if (itemStack.stackTagCompound.getBoolean("charging") == true)
{
} else {
if (itemStack.stackTagCompound.getBoolean("charging") == true) {
incrementData(itemStack);
}
spiralEffect(itemStack, world, player);
}
}
}
else
{
}
} else {
resetData(itemStack);
itemStack.stackTagCompound.setFloat("angle", 0);
itemStack.stackTagCompound.setDouble("radius", 0);
}
if (itemStack.stackTagCompound.getInteger("chargeTime") > itemStack.stackTagCompound.getInteger("maxChargeTime"))
{
if (itemStack.stackTagCompound.getInteger("chargeTime") > itemStack.stackTagCompound.getInteger("maxChargeTime")) {
itemStack.stackTagCompound.setInteger("chargeTime", itemStack.stackTagCompound.getInteger("maxChargeTime"));
}
if (itemStack.stackTagCompound.getDouble("radius") > 2.5D)
{
if (itemStack.stackTagCompound.getDouble("radius") > 2.5D) {
itemStack.stackTagCompound.setDouble("radius", 2.5D);
}
if (itemStack.stackTagCompound.getFloat("angle") > 6.0f)
{
if (itemStack.stackTagCompound.getFloat("angle") > 6.0f) {
itemStack.stackTagCompound.setFloat("angle", 0.0f);
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
{
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
if (itemStack.stackTagCompound.getBoolean("charging") == false)
{
itemStack.stackTagCompound.setBoolean("charging", true);
}
return itemStack;
}
private void spiralEffect(ItemStack itemStack, World world, EntityPlayer player)
{
double particleX = player.posX + (double)(MathHelper.cos(itemStack.stackTagCompound.getFloat("angle"))) * itemStack.stackTagCompound.getDouble("radius");
double particleY = player.posY;
double particleZ = player.posZ + (double)(MathHelper.sin(itemStack.stackTagCompound.getFloat("angle"))) * itemStack.stackTagCompound.getDouble("radius");
float particleScale = ((float)(itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float)itemStack.stackTagCompound.getInteger("maxChargeTime"))));
if (!world.isRemote)
MysticWorld.proxy.airFeetFX(world, particleX, particleY, particleZ, 1.0f + particleScale, 15);
}
private void chargeEffect(ItemStack itemStack, World world, EntityPlayer player)
{
private void chargeEffect(ItemStack itemStack, World world, EntityPlayer player) {
double particleX = (player.posX - 0.5D) + rand.nextDouble();
double particleZ = (player.posZ - 0.5D) + rand.nextDouble();
double particleZ = (player.posZ - 0.5D) + rand.nextDouble();
if (!world.isRemote)
MysticWorld.proxy.airFeetFX(world, particleX, player.posY, particleZ, 1.0f, 15);
}
private void resetData(ItemStack itemStack)
{
private void incrementData(ItemStack itemStack) {
itemStack.stackTagCompound.setInteger("chargeTime", itemStack.stackTagCompound.getInteger("chargeTime") + 1);
itemStack.stackTagCompound.setFloat("angle", itemStack.stackTagCompound.getFloat("angle") + 0.2f);
itemStack.stackTagCompound.setDouble("radius", itemStack.stackTagCompound.getInteger("chargeTime") * 0.025D);
}
private void resetData(ItemStack itemStack) {
itemStack.stackTagCompound.setInteger("chargeTime", 0);
itemStack.stackTagCompound.setBoolean("charging", false);
itemStack.stackTagCompound.setFloat("angle", 0);
itemStack.stackTagCompound.setDouble("radius", 0);
}
private void incrementData(ItemStack itemStack)
{
itemStack.stackTagCompound.setInteger("chargeTime", itemStack.stackTagCompound.getInteger("chargeTime") + 1);
itemStack.stackTagCompound.setFloat("angle", itemStack.stackTagCompound.getFloat("angle") + 0.2f);
itemStack.stackTagCompound.setDouble("radius", (double)itemStack.stackTagCompound.getInteger("chargeTime") * 0.025D);
private void spiralEffect(ItemStack itemStack, World world, EntityPlayer player) {
double particleX = player.posX + (MathHelper.cos(itemStack.stackTagCompound.getFloat("angle"))) * itemStack.stackTagCompound.getDouble("radius");
double particleY = player.posY;
double particleZ = player.posZ + (MathHelper.sin(itemStack.stackTagCompound.getFloat("angle"))) * itemStack.stackTagCompound.getDouble("radius");
float particleScale = ((itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float) itemStack.stackTagCompound.getInteger("maxChargeTime"))));
if (!world.isRemote)
MysticWorld.proxy.airFeetFX(world, particleX, particleY, particleZ, 1.0f + particleScale, 15);
}
}

View file

@ -1,257 +1,164 @@
package MysticWorld.Items;
package mysticworld.items;
import MysticWorld.MysticWorld;
import MysticWorld.Entity.EntityChargeAir;
import mysticworld.MysticWorld;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockMushroom;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.BlockStem;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.BonemealEvent;
public class ItemOrbEarth extends ItemOrb
{
public ItemOrbEarth(int id)
{
public class ItemOrbEarth extends ItemOrb {
public ItemOrbEarth(int id) {
super(id);
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)entity;
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) {
return false;
} else {
if (applyBonemeal(par1ItemStack, par3World, par4, par5, par6, par2EntityPlayer)) {
if (!par3World.isRemote) {
par3World.playAuxSFX(2005, par4, par5, par6, 0);
}
return true;
}
return false;
}
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
if (!world.isRemote)
{
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
if (!world.isRemote) {
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
MysticWorld.proxy.earthFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
}
}
}
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
{
return false;
}
else
{
if (applyBonemeal(par1ItemStack, par3World, par4, par5, par6, par2EntityPlayer))
{
if (!par3World.isRemote)
{
par3World.playAuxSFX(2005, par4, par5, par6, 0);
}
return true;
}
return false;
}
public static boolean applyBonemeal(ItemStack itemStack, World par1World, int par2, int par3, int par4, EntityPlayer player) {
int l = par1World.getBlockId(par2, par3, par4);
BonemealEvent event = new BonemealEvent(player, par1World, l, par2, par3, par4);
if (MinecraftForge.EVENT_BUS.post(event)) {
return false;
}
if (event.getResult() == Result.ALLOW) {
itemStack.damageItem(1, player);
return true;
}
if (l == Block.sapling.blockID) {
if (!par1World.isRemote) {
if (par1World.rand.nextFloat() < 0.45D) {
((BlockSapling) Block.sapling).markOrGrowMarked(par1World, par2, par3, par4, par1World.rand);
}
itemStack.damageItem(1, player);
}
return true;
} else if (l == Block.cobblestone.blockID) {
if (!par1World.isRemote) {
par1World.setBlock(par2, par3, par4, Block.cobblestoneMossy.blockID);
}
itemStack.damageItem(1, player);
} else if (l == Block.deadBush.blockID) {
if (!par1World.isRemote) {
par1World.setBlock(par2, par3, par4, 0);
par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3, par4, new ItemStack(Block.sapling, 1)));
}
itemStack.damageItem(1, player);
} else if (l != Block.mushroomBrown.blockID && l != Block.mushroomRed.blockID) {
if (l != Block.melonStem.blockID && l != Block.pumpkinStem.blockID) {
if (l > 0 && Block.blocksList[l] instanceof BlockCrops) {
if (par1World.getBlockMetadata(par2, par3, par4) == 7) {
return false;
} else {
if (!par1World.isRemote) {
((BlockCrops) Block.blocksList[l]).fertilize(par1World, par2, par3, par4);
itemStack.damageItem(1, player);
}
return true;
}
} else {
int i1;
int j1;
int k1;
if (l == Block.cocoaPlant.blockID) {
i1 = par1World.getBlockMetadata(par2, par3, par4);
j1 = BlockDirectional.getDirection(i1);
k1 = BlockCocoa.func_72219_c(i1);
if (k1 >= 2) {
return false;
} else {
if (!par1World.isRemote) {
++k1;
par1World.setBlockMetadataWithNotify(par2, par3, par4, k1 << 2 | j1, 2);
itemStack.damageItem(1, player);
}
return true;
}
} else if (l != Block.grass.blockID) {
return false;
} else {
if (!par1World.isRemote) {
itemStack.damageItem(1, player);
label102: for (i1 = 0; i1 < 128; ++i1) {
j1 = par2;
k1 = par3 + 1;
int l1 = par4;
for (int i2 = 0; i2 < i1 / 16; ++i2) {
j1 += itemRand.nextInt(3) - 1;
k1 += (itemRand.nextInt(3) - 1) * itemRand.nextInt(3) / 2;
l1 += itemRand.nextInt(3) - 1;
if (par1World.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || par1World.isBlockNormalCube(j1, k1, l1)) {
continue label102;
}
}
if (par1World.getBlockId(j1, k1, l1) == 0) {
if (itemRand.nextInt(10) != 0) {
if (Block.tallGrass.canBlockStay(par1World, j1, k1, l1)) {
par1World.setBlock(j1, k1, l1, Block.tallGrass.blockID, 1, 3);
}
} else {
ForgeHooks.plantGrass(par1World, j1, k1, l1);
}
}
}
}
return true;
}
}
} else if (par1World.getBlockMetadata(par2, par3, par4) == 7) {
return false;
} else {
if (!par1World.isRemote) {
((BlockStem) Block.blocksList[l]).fertilizeStem(par1World, par2, par3, par4);
itemStack.damageItem(1, player);
}
return true;
}
} else {
if (!par1World.isRemote) {
if (par1World.rand.nextFloat() < 0.4D) {
((BlockMushroom) Block.blocksList[l]).fertilizeMushroom(par1World, par2, par3, par4, par1World.rand);
}
itemStack.damageItem(1, player);
}
return true;
}
return true;
}
public static boolean applyBonemeal(ItemStack itemStack, World par1World, int par2, int par3, int par4, EntityPlayer player)
{
int l = par1World.getBlockId(par2, par3, par4);
BonemealEvent event = new BonemealEvent(player, par1World, l, par2, par3, par4);
if (MinecraftForge.EVENT_BUS.post(event))
{
return false;
}
if (event.getResult() == Result.ALLOW)
{
itemStack.damageItem(1, player);
return true;
}
if (l == Block.sapling.blockID)
{
if (!par1World.isRemote)
{
if ((double)par1World.rand.nextFloat() < 0.45D)
{
((BlockSapling)Block.sapling).markOrGrowMarked(par1World, par2, par3, par4, par1World.rand);
}
itemStack.damageItem(1, player);
}
return true;
}
else if (l == Block.cobblestone.blockID)
{
if (!par1World.isRemote)
{
par1World.setBlock(par2, par3, par4, Block.cobblestoneMossy.blockID);
}
itemStack.damageItem(1, player);
}
else if (l == Block.deadBush.blockID)
{
if (!par1World.isRemote)
{
par1World.setBlock(par2, par3, par4, 0);
par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3, par4, new ItemStack(Block.sapling, 1)));
}
itemStack.damageItem(1, player);
}
else if (l != Block.mushroomBrown.blockID && l != Block.mushroomRed.blockID)
{
if (l != Block.melonStem.blockID && l != Block.pumpkinStem.blockID)
{
if (l > 0 && Block.blocksList[l] instanceof BlockCrops)
{
if (par1World.getBlockMetadata(par2, par3, par4) == 7)
{
return false;
}
else
{
if (!par1World.isRemote)
{
((BlockCrops)Block.blocksList[l]).fertilize(par1World, par2, par3, par4);
itemStack.damageItem(1, player);
}
return true;
}
}
else
{
int i1;
int j1;
int k1;
if (l == Block.cocoaPlant.blockID)
{
i1 = par1World.getBlockMetadata(par2, par3, par4);
j1 = BlockDirectional.getDirection(i1);
k1 = BlockCocoa.func_72219_c(i1);
if (k1 >= 2)
{
return false;
}
else
{
if (!par1World.isRemote)
{
++k1;
par1World.setBlockMetadataWithNotify(par2, par3, par4, k1 << 2 | j1, 2);
itemStack.damageItem(1, player);
}
return true;
}
}
else if (l != Block.grass.blockID)
{
return false;
}
else
{
if (!par1World.isRemote)
{
itemStack.damageItem(1, player);
label102:
for (i1 = 0; i1 < 128; ++i1)
{
j1 = par2;
k1 = par3 + 1;
int l1 = par4;
for (int i2 = 0; i2 < i1 / 16; ++i2)
{
j1 += itemRand.nextInt(3) - 1;
k1 += (itemRand.nextInt(3) - 1) * itemRand.nextInt(3) / 2;
l1 += itemRand.nextInt(3) - 1;
if (par1World.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || par1World.isBlockNormalCube(j1, k1, l1))
{
continue label102;
}
}
if (par1World.getBlockId(j1, k1, l1) == 0)
{
if (itemRand.nextInt(10) != 0)
{
if (Block.tallGrass.canBlockStay(par1World, j1, k1, l1))
{
par1World.setBlock(j1, k1, l1, Block.tallGrass.blockID, 1, 3);
}
}
else
{
ForgeHooks.plantGrass(par1World, j1, k1, l1);
}
}
}
}
return true;
}
}
}
else if (par1World.getBlockMetadata(par2, par3, par4) == 7)
{
return false;
}
else
{
if (!par1World.isRemote)
{
((BlockStem)Block.blocksList[l]).fertilizeStem(par1World, par2, par3, par4);
itemStack.damageItem(1, player);
}
return true;
}
}
else
{
if (!par1World.isRemote)
{
if ((double)par1World.rand.nextFloat() < 0.4D)
{
((BlockMushroom)Block.blocksList[l]).fertilizeMushroom(par1World, par2, par3, par4, par1World.rand);
}
itemStack.damageItem(1, player);
}
return true;
}
return true;
}
}

View file

@ -1,94 +1,63 @@
package MysticWorld.Items;
package mysticworld.items;
import MysticWorld.MysticWorld;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Entity.EntityChargeAir;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import mysticworld.MysticWorld;
import mysticworld.blocks.BlockHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class ItemOrbEnergy extends ItemOrb {
public ItemOrbEnergy(int id)
{
public ItemOrbEnergy(int id) {
super(id);
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)entity;
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
if (par7 == 0) {
--par5;
}
if (par7 == 1) {
++par5;
}
if (par7 == 2) {
--par6;
}
if (par7 == 3) {
++par6;
}
if (par7 == 4) {
--par4;
}
if (par7 == 5) {
++par4;
}
if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack)) {
return false;
} else {
int i1 = world.getBlockId(par4, par5, par6);
if (i1 == 0) {
world.playSoundEffect(par4 + 0.5D, par5 + 0.5D, par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(par4, par5, par6, BlockHandler.lightCube.blockID);
}
itemStack.damageItem(1, entityPlayer);
return true;
}
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
if (!world.isRemote)
{
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
if (!world.isRemote) {
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 20, 2));
MysticWorld.proxy.energyFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
}
}
}
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 == 0)
{
--par5;
}
if (par7 == 1)
{
++par5;
}
if (par7 == 2)
{
--par6;
}
if (par7 == 3)
{
++par6;
}
if (par7 == 4)
{
--par4;
}
if (par7 == 5)
{
++par4;
}
if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack))
{
return false;
}
else
{
int i1 = world.getBlockId(par4, par5, par6);
if (i1 == 0)
{
world.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(par4, par5, par6, BlockHandler.lightCube.blockID);
}
itemStack.damageItem(1, entityPlayer);
return true;
}
}
}

View file

@ -1,18 +1,10 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.Random;
import MysticWorld.MysticWorld;
import MysticWorld.Entity.EntityChargeAir;
import mysticworld.MysticWorld;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFlintAndSteel;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ -20,99 +12,68 @@ import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class ItemOrbFire extends ItemOrb {
public ItemOrbFire(int id) {
super(id);
}
public boolean itemInteractionForEntity(ItemStack itemStack, EntityLiving entityLiving) {
entityLiving.setFire(5);
entityLiving.attackEntityFrom(DamageSource.magic, 7);
itemStack.damageItem(1, entityLiving);
return true;
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)entity;
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
if (par7 == 0) {
--par5;
}
if (par7 == 1) {
++par5;
}
if (par7 == 2) {
--par6;
}
if (par7 == 3) {
++par6;
}
if (par7 == 4) {
--par4;
}
if (par7 == 5) {
++par4;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) {
return false;
} else {
if (par3World.isAirBlock(par4, par5, par6)) {
par3World.playSoundEffect(par4 + 0.5D, par5 + 0.5D, par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
par3World.setBlock(par4, par5, par6, Block.fire.blockID);
}
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
@Override
public boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer entityPlayer, Entity entity) {
entity.setFire(5);
entity.attackEntityFrom(DamageSource.magic, 7);
itemStack.damageItem(1, entityPlayer);
return true;
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
if (!world.isRemote)
{
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
if (!world.isRemote) {
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 20, 0));
MysticWorld.proxy.fireFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
}
}
}
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 == 0)
{
--par5;
}
if (par7 == 1)
{
++par5;
}
if (par7 == 2)
{
--par6;
}
if (par7 == 3)
{
++par6;
}
if (par7 == 4)
{
--par4;
}
if (par7 == 5)
{
++par4;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
{
return false;
}
else
{
if (par3World.isAirBlock(par4, par5, par6))
{
par3World.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
par3World.setBlock(par4, par5, par6, Block.fire.blockID);
}
par1ItemStack.damageItem(1, par2EntityPlayer);
return true;
}
}
public boolean itemInteractionForEntity(ItemStack itemStack, EntityLiving entityLiving)
{
entityLiving.setFire(5);
entityLiving.attackEntityFrom(DamageSource.magic, 7);
itemStack.damageItem(1, entityLiving);
return true;
}
@Override
public boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer entityPlayer, Entity entity)
{
entity.setFire(5);
entity.attackEntityFrom(DamageSource.magic, 7);
itemStack.damageItem(1, entityPlayer);
return true;
}
}

View file

@ -1,141 +1,87 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.Random;
import MysticWorld.MysticWorld;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Entity.EntityChargeAir;
import mysticworld.MysticWorld;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event;
import net.minecraftforge.event.entity.player.FillBucketEvent;
public class ItemOrbWater extends ItemOrb {
public ItemOrbWater(int id)
{
public ItemOrbWater(int id) {
super(id);
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)entity;
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null) {
return itemStack;
} else {
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k)) {
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
return itemStack;
}
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0) {
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlockToAir(i, j, k);
itemStack.damageItem(1, entityPlayer);
return itemStack;
} else {
if (movingobjectposition.sideHit == 0) {
--j;
}
if (movingobjectposition.sideHit == 1) {
++j;
}
if (movingobjectposition.sideHit == 2) {
--k;
}
if (movingobjectposition.sideHit == 3) {
++k;
}
if (movingobjectposition.sideHit == 4) {
--i;
}
if (movingobjectposition.sideHit == 5) {
++i;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
return itemStack;
} else {
int i1 = world.getBlockId(i, j, k);
if (i1 == 0) {
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(i, j, k, Block.waterMoving.blockID);
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
}
}
return itemStack;
}
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
if (itemStack != null)
{
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
if (itemStack != null) {
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
MysticWorld.proxy.waterFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
}
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
{
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null)
{
return itemStack;
}
else
{
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k))
{
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
{
return itemStack;
}
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
{
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlockToAir(i, j, k);
itemStack.damageItem(1, entityPlayer);
return itemStack;
}
else
{
if (movingobjectposition.sideHit == 0)
{
--j;
}
if (movingobjectposition.sideHit == 1)
{
++j;
}
if (movingobjectposition.sideHit == 2)
{
--k;
}
if (movingobjectposition.sideHit == 3)
{
++k;
}
if (movingobjectposition.sideHit == 4)
{
--i;
}
if (movingobjectposition.sideHit == 5)
{
++i;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
{
return itemStack;
}
else
{
int i1 = world.getBlockId(i, j, k);
if (i1 == 0)
{
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(i, j, k, Block.waterMoving.blockID);
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
}
}
return itemStack;
}
}
}

View file

@ -1,29 +1,25 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.Random;
import mysticworld.MysticWorld;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import MysticWorld.MysticWorld;
import net.minecraft.item.Item;
public class ItemStaff extends Item
{
public class ItemStaff extends Item {
Random rand = new Random();
public ItemStaff(int id)
{
public ItemStaff(int id) {
super(id);
this.setMaxStackSize(1);
this.setMaxDamage(200);
this.setMaxStackSize(1);
this.setMaxDamage(200);
this.setCreativeTab(MysticWorld.MysticWorldTab);
}
@Override
@SideOnly(Side.CLIENT)
public boolean isFull3D()
{
return true;
}
@SideOnly(Side.CLIENT)
public boolean isFull3D() {
return true;
}
}

View file

@ -1,112 +1,80 @@
package MysticWorld.Items;
package mysticworld.items;
import mysticworld.MysticWorld;
import mysticworld.entity.EntityChargeAir;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import MysticWorld.MysticWorld;
import MysticWorld.Entity.EntityChargeAir;
public class ItemStaffAir extends ItemStaff {
public ItemStaffAir(int id)
{
public ItemStaffAir(int id) {
super(id);
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
itemStack.setTagCompound(new NBTTagCompound());
if (itemStack.stackTagCompound.getBoolean("charging") == false) {
itemStack.stackTagCompound.setBoolean("charging", true);
}
return itemStack;
}
EntityPlayer player = (EntityPlayer)entity;
ItemStack currentItem = player.inventory.getCurrentItem();
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
itemStack.stackTagCompound.setInteger("maxChargeTime", 3 * 20);
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
player.fallDistance = 0.0F;
chargeEffect(itemStack, world, player);
if (!Mouse.isButtonDown(1))
{
if (itemStack.stackTagCompound.getInteger("chargeTime") > 0)
{
if (!world.isRemote)
{
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
world.spawnEntityInWorld(new EntityChargeAir(world, player, 1.0f + ((float)(itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float)itemStack.stackTagCompound.getInteger("maxChargeTime")))), (float)(itemStack.stackTagCompound.getInteger("chargeTime")) * (2.5D * (1.0D / (double)itemStack.stackTagCompound.getInteger("maxChargeTime")))));
itemStack.damageItem(1, player);
if (!Mouse.isButtonDown(1)) {
if (itemStack.stackTagCompound.getInteger("chargeTime") > 0) {
if (!world.isRemote) {
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) player.posX, (int) player.posY, (int) player.posZ, 0);
world.spawnEntityInWorld(new EntityChargeAir(world, player, 1.0f + ((itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float) itemStack.stackTagCompound
.getInteger("maxChargeTime")))), (itemStack.stackTagCompound.getInteger("chargeTime")) * (2.5D * (1.0D / itemStack.stackTagCompound.getInteger("maxChargeTime")))));
itemStack.damageItem(1, player);
}
}
resetData(itemStack);
}
else
{
if (itemStack.stackTagCompound.getBoolean("charging") == true)
{
} else {
if (itemStack.stackTagCompound.getBoolean("charging") == true) {
incrementData(itemStack);
}
}
}
}
else
{
}
} else {
resetData(itemStack);
}
if (itemStack.stackTagCompound.getInteger("chargeTime") > itemStack.stackTagCompound.getInteger("maxChargeTime"))
{
if (itemStack.stackTagCompound.getInteger("chargeTime") > itemStack.stackTagCompound.getInteger("maxChargeTime")) {
itemStack.stackTagCompound.setInteger("chargeTime", itemStack.stackTagCompound.getInteger("maxChargeTime"));
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
{
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
if (itemStack.stackTagCompound.getBoolean("charging") == false)
{
itemStack.stackTagCompound.setBoolean("charging", true);
}
return itemStack;
}
private void chargeEffect(ItemStack itemStack, World world, EntityPlayer player)
{
double particleX = (player.posX - 0.5D) + rand.nextDouble();
double particleY = player.posY + (player.height/itemStack.stackTagCompound.getInteger("maxChargeTime") * itemStack.stackTagCompound.getInteger("chargeTime"));
double particleZ = (player.posZ - 0.5D) + rand.nextDouble();
float particleScale = ((float)(itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float)itemStack.stackTagCompound.getInteger("maxChargeTime"))));
private void chargeEffect(ItemStack itemStack, World world, EntityPlayer player) {
double particleX = (player.posX - 0.5D) + rand.nextDouble();
double particleY = player.posY + (player.height / itemStack.stackTagCompound.getInteger("maxChargeTime") * itemStack.stackTagCompound.getInteger("chargeTime"));
double particleZ = (player.posZ - 0.5D) + rand.nextDouble();
float particleScale = ((itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float) itemStack.stackTagCompound.getInteger("maxChargeTime"))));
if (!world.isRemote)
MysticWorld.proxy.airFeetFX(world, particleX, particleY, particleZ, 1.0f + particleScale, 15);
}
private void resetData(ItemStack itemStack)
{
private void incrementData(ItemStack itemStack) {
itemStack.stackTagCompound.setInteger("chargeTime", itemStack.stackTagCompound.getInteger("chargeTime") + 1);
}
private void resetData(ItemStack itemStack) {
itemStack.stackTagCompound.setInteger("chargeTime", 0);
itemStack.stackTagCompound.setBoolean("charging", false);
}
private void incrementData(ItemStack itemStack)
{
itemStack.stackTagCompound.setInteger("chargeTime", itemStack.stackTagCompound.getInteger("chargeTime") + 1);
}
}

View file

@ -1,10 +1,7 @@
package MysticWorld.Items;
package mysticworld.items;
import org.lwjgl.input.Keyboard;
import MysticWorld.MysticWorld;
import MysticWorld.Entity.EntityChargeEarth;
import MysticWorld.Entity.EntityChargeFire;
import mysticworld.MysticWorld;
import mysticworld.entity.EntityChargeEarth;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.BlockCrops;
@ -12,14 +9,9 @@ import net.minecraft.block.BlockDirectional;
import net.minecraft.block.BlockMushroom;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.BlockStem;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
@ -28,269 +20,172 @@ import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.BonemealEvent;
import net.minecraftforge.event.entity.player.UseHoeEvent;
public class ItemStaffEarth extends ItemStaff
{
public ItemStaffEarth(int id)
{
import org.lwjgl.input.Keyboard;
public class ItemStaffEarth extends ItemStaff {
public ItemStaffEarth(int id) {
super(id);
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)entity;
ItemStack currentItem = player.inventory.getCurrentItem();
if (!world.isRemote)
{
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null) {
return itemStack;
} else {
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k)) {
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
return itemStack;
} else {
if (applyBonemeal(itemStack, world, i, j, k, entityPlayer)) {
if (!world.isRemote) {
world.playAuxSFX(2005, i, j, k, 0);
}
return itemStack;
}
}
}
}
} else {
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
if (!world.isRemote) {
world.spawnEntityInWorld(new EntityChargeEarth(world, entityPlayer));
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
return itemStack;
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
if (!world.isRemote) {
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
MysticWorld.proxy.earthFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
}
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
{
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null)
{
return itemStack;
}
else
{
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k))
{
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
{
return itemStack;
}
else
{
if (applyBonemeal(itemStack, world, i, j, k, entityPlayer))
{
if (!world.isRemote)
{
world.playAuxSFX(2005, i, j, k, 0);
}
return itemStack;
}
}
}
}
public static boolean applyBonemeal(ItemStack itemStack, World par1World, int par2, int par3, int par4, EntityPlayer player) {
int l = par1World.getBlockId(par2, par3, par4);
BonemealEvent event = new BonemealEvent(player, par1World, l, par2, par3, par4);
if (MinecraftForge.EVENT_BUS.post(event)) {
return false;
}
else
{
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
if (!world.isRemote)
{
world.spawnEntityInWorld(new EntityChargeEarth(world, entityPlayer));
itemStack.damageItem(1, entityPlayer);
if (event.getResult() == Result.ALLOW) {
itemStack.damageItem(1, player);
return true;
}
if (l == Block.sapling.blockID) {
if (!par1World.isRemote) {
if (par1World.rand.nextFloat() < 0.45D) {
((BlockSapling) Block.sapling).markOrGrowMarked(par1World, par2, par3, par4, par1World.rand);
}
itemStack.damageItem(1, player);
}
return itemStack;
return true;
} else if (l == Block.cobblestone.blockID) {
if (!par1World.isRemote) {
par1World.setBlock(par2, par3, par4, Block.cobblestoneMossy.blockID);
}
itemStack.damageItem(1, player);
} else if (l == Block.deadBush.blockID) {
if (!par1World.isRemote) {
par1World.setBlock(par2, par3, par4, 0);
par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3, par4, new ItemStack(Block.sapling, 1)));
}
itemStack.damageItem(1, player);
} else if (l != Block.mushroomBrown.blockID && l != Block.mushroomRed.blockID) {
if (l != Block.melonStem.blockID && l != Block.pumpkinStem.blockID) {
if (l > 0 && Block.blocksList[l] instanceof BlockCrops) {
if (par1World.getBlockMetadata(par2, par3, par4) == 7) {
return false;
} else {
if (!par1World.isRemote) {
((BlockCrops) Block.blocksList[l]).fertilize(par1World, par2, par3, par4);
itemStack.damageItem(1, player);
}
return true;
}
} else {
int i1;
int j1;
int k1;
if (l == Block.cocoaPlant.blockID) {
i1 = par1World.getBlockMetadata(par2, par3, par4);
j1 = BlockDirectional.getDirection(i1);
k1 = BlockCocoa.func_72219_c(i1);
if (k1 >= 2) {
return false;
} else {
if (!par1World.isRemote) {
++k1;
par1World.setBlockMetadataWithNotify(par2, par3, par4, k1 << 2 | j1, 2);
itemStack.damageItem(1, player);
}
return true;
}
} else if (l != Block.grass.blockID) {
return false;
} else {
if (!par1World.isRemote) {
itemStack.damageItem(1, player);
label102: for (i1 = 0; i1 < 128; ++i1) {
j1 = par2;
k1 = par3 + 1;
int l1 = par4;
for (int i2 = 0; i2 < i1 / 16; ++i2) {
j1 += itemRand.nextInt(3) - 1;
k1 += (itemRand.nextInt(3) - 1) * itemRand.nextInt(3) / 2;
l1 += itemRand.nextInt(3) - 1;
if (par1World.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || par1World.isBlockNormalCube(j1, k1, l1)) {
continue label102;
}
}
if (par1World.getBlockId(j1, k1, l1) == 0) {
if (itemRand.nextInt(10) != 0) {
if (Block.tallGrass.canBlockStay(par1World, j1, k1, l1)) {
par1World.setBlock(j1, k1, l1, Block.tallGrass.blockID, 1, 3);
}
} else {
ForgeHooks.plantGrass(par1World, j1, k1, l1);
}
}
}
}
return true;
}
}
} else if (par1World.getBlockMetadata(par2, par3, par4) == 7) {
return false;
} else {
if (!par1World.isRemote) {
((BlockStem) Block.blocksList[l]).fertilizeStem(par1World, par2, par3, par4);
itemStack.damageItem(1, player);
}
return true;
}
} else {
if (!par1World.isRemote) {
if (par1World.rand.nextFloat() < 0.4D) {
((BlockMushroom) Block.blocksList[l]).fertilizeMushroom(par1World, par2, par3, par4, par1World.rand);
}
itemStack.damageItem(1, player);
}
return true;
}
return itemStack;
return true;
}
public static boolean applyBonemeal(ItemStack itemStack, World par1World, int par2, int par3, int par4, EntityPlayer player)
{
int l = par1World.getBlockId(par2, par3, par4);
BonemealEvent event = new BonemealEvent(player, par1World, l, par2, par3, par4);
if (MinecraftForge.EVENT_BUS.post(event))
{
return false;
}
if (event.getResult() == Result.ALLOW)
{
itemStack.damageItem(1, player);
return true;
}
if (l == Block.sapling.blockID)
{
if (!par1World.isRemote)
{
if ((double)par1World.rand.nextFloat() < 0.45D)
{
((BlockSapling)Block.sapling).markOrGrowMarked(par1World, par2, par3, par4, par1World.rand);
}
itemStack.damageItem(1, player);
}
return true;
}
else if (l == Block.cobblestone.blockID)
{
if (!par1World.isRemote)
{
par1World.setBlock(par2, par3, par4, Block.cobblestoneMossy.blockID);
}
itemStack.damageItem(1, player);
}
else if (l == Block.deadBush.blockID)
{
if (!par1World.isRemote)
{
par1World.setBlock(par2, par3, par4, 0);
par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3, par4, new ItemStack(Block.sapling, 1)));
}
itemStack.damageItem(1, player);
}
else if (l != Block.mushroomBrown.blockID && l != Block.mushroomRed.blockID)
{
if (l != Block.melonStem.blockID && l != Block.pumpkinStem.blockID)
{
if (l > 0 && Block.blocksList[l] instanceof BlockCrops)
{
if (par1World.getBlockMetadata(par2, par3, par4) == 7)
{
return false;
}
else
{
if (!par1World.isRemote)
{
((BlockCrops)Block.blocksList[l]).fertilize(par1World, par2, par3, par4);
itemStack.damageItem(1, player);
}
return true;
}
}
else
{
int i1;
int j1;
int k1;
if (l == Block.cocoaPlant.blockID)
{
i1 = par1World.getBlockMetadata(par2, par3, par4);
j1 = BlockDirectional.getDirection(i1);
k1 = BlockCocoa.func_72219_c(i1);
if (k1 >= 2)
{
return false;
}
else
{
if (!par1World.isRemote)
{
++k1;
par1World.setBlockMetadataWithNotify(par2, par3, par4, k1 << 2 | j1, 2);
itemStack.damageItem(1, player);
}
return true;
}
}
else if (l != Block.grass.blockID)
{
return false;
}
else
{
if (!par1World.isRemote)
{
itemStack.damageItem(1, player);
label102:
for (i1 = 0; i1 < 128; ++i1)
{
j1 = par2;
k1 = par3 + 1;
int l1 = par4;
for (int i2 = 0; i2 < i1 / 16; ++i2)
{
j1 += itemRand.nextInt(3) - 1;
k1 += (itemRand.nextInt(3) - 1) * itemRand.nextInt(3) / 2;
l1 += itemRand.nextInt(3) - 1;
if (par1World.getBlockId(j1, k1 - 1, l1) != Block.grass.blockID || par1World.isBlockNormalCube(j1, k1, l1))
{
continue label102;
}
}
if (par1World.getBlockId(j1, k1, l1) == 0)
{
if (itemRand.nextInt(10) != 0)
{
if (Block.tallGrass.canBlockStay(par1World, j1, k1, l1))
{
par1World.setBlock(j1, k1, l1, Block.tallGrass.blockID, 1, 3);
}
}
else
{
ForgeHooks.plantGrass(par1World, j1, k1, l1);
}
}
}
}
return true;
}
}
}
else if (par1World.getBlockMetadata(par2, par3, par4) == 7)
{
return false;
}
else
{
if (!par1World.isRemote)
{
((BlockStem)Block.blocksList[l]).fertilizeStem(par1World, par2, par3, par4);
itemStack.damageItem(1, player);
}
return true;
}
}
else
{
if (!par1World.isRemote)
{
if ((double)par1World.rand.nextFloat() < 0.4D)
{
((BlockMushroom)Block.blocksList[l]).fertilizeMushroom(par1World, par2, par3, par4, par1World.rand);
}
itemStack.damageItem(1, player);
}
return true;
}
return true;
}
}

View file

@ -1,17 +1,10 @@
package MysticWorld.Items;
package mysticworld.items;
import org.lwjgl.input.Keyboard;
import MysticWorld.MysticWorld;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Entity.EntityChargeEnergy;
import MysticWorld.Entity.EntityChargeFire;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import mysticworld.MysticWorld;
import mysticworld.blocks.BlockHandler;
import mysticworld.entity.EntityChargeEnergy;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ -19,126 +12,83 @@ import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
public class ItemStaffEnegy extends ItemStaff {
public ItemStaffEnegy(int id) {
super(id);
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)entity;
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null) {
return itemStack;
} else {
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k)) {
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
return itemStack;
} else {
if (movingobjectposition.sideHit == 0) {
--j;
}
if (movingobjectposition.sideHit == 1) {
++j;
}
if (movingobjectposition.sideHit == 2) {
--k;
}
if (movingobjectposition.sideHit == 3) {
++k;
}
if (movingobjectposition.sideHit == 4) {
--i;
}
if (movingobjectposition.sideHit == 5) {
++i;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
return itemStack;
} else {
if (world.isAirBlock(i, j, k)) {
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(i, j, k, BlockHandler.lightCube.blockID);
}
itemStack.damageItem(1, entityPlayer);
return itemStack;
}
}
}
}
} else {
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
if (!world.isRemote) {
world.spawnEntityInWorld(new EntityChargeEnergy(world, entityPlayer));
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
return itemStack;
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
if (!world.isRemote)
{
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
if (!world.isRemote) {
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 20, 2));
MysticWorld.proxy.energyFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
}
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
{
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null)
{
return itemStack;
}
else
{
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k))
{
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
{
return itemStack;
}
else
{
if (movingobjectposition.sideHit == 0)
{
--j;
}
if (movingobjectposition.sideHit == 1)
{
++j;
}
if (movingobjectposition.sideHit == 2)
{
--k;
}
if (movingobjectposition.sideHit == 3)
{
++k;
}
if (movingobjectposition.sideHit == 4)
{
--i;
}
if (movingobjectposition.sideHit == 5)
{
++i;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
{
return itemStack;
}
else
{
if (world.isAirBlock(i, j, k))
{
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(i, j, k, BlockHandler.lightCube.blockID);
}
itemStack.damageItem(1, entityPlayer);
return itemStack;
}
}
}
}
}
else
{
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
if (!world.isRemote)
{
world.spawnEntityInWorld(new EntityChargeEnergy(world, entityPlayer));
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
return itemStack;
}
}

View file

@ -1,22 +1,11 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.Arrays;
import java.util.Random;
import org.lwjgl.input.Keyboard;
import MysticWorld.MysticWorld;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Entity.EntityChargeFire;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import mysticworld.MysticWorld;
import mysticworld.entity.EntityChargeFire;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.potion.Potion;
@ -26,114 +15,82 @@ import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
public class ItemStaffFire extends ItemStaff {
public ItemStaffFire(int id) {
super(id);
}
public boolean itemInteractionForEntity(ItemStack itemStack, EntityLiving entityLiving) {
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
entityLiving.setFire(5);
entityLiving.attackEntityFrom(DamageSource.magic, 7);
itemStack.damageItem(1, entityLiving);
return true;
}
return true;
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)entity;
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null) {
return itemStack;
} else {
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k)) {
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
return itemStack;
} else {
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(world.getBlockId(i, j, k), 1, world.getBlockMetadata(i, j, k)));
if (!world.isRemote && !(result == null)) {
int id = result.itemID;
int meta = result.getItemDamage();
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(i, j, k, 0);
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(id, 1, meta)));
itemStack.damageItem(1, entityPlayer);
}
}
}
}
} else {
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
if (!world.isRemote) {
world.spawnEntityInWorld(new EntityChargeFire(world, entityPlayer));
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
return itemStack;
}
@Override
public boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer entityPlayer, Entity entity) {
entity.setFire(5);
entity.attackEntityFrom(DamageSource.magic, 7);
itemStack.damageItem(1, entityPlayer);
return true;
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
if (!world.isRemote)
{
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
if (!world.isRemote) {
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 20, 0));
MysticWorld.proxy.fireFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
}
}
}
}
public boolean itemInteractionForEntity(ItemStack itemStack, EntityLiving entityLiving)
{
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
entityLiving.setFire(5);
entityLiving.attackEntityFrom(DamageSource.magic, 7);
itemStack.damageItem(1, entityLiving);
return true;
}
return true;
}
public boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer entityPlayer, Entity entity)
{
entity.setFire(5);
entity.attackEntityFrom(DamageSource.magic, 7);
itemStack.damageItem(1, entityPlayer);
return true;
}
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
{
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null)
{
return itemStack;
}
else
{
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k))
{
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
{
return itemStack;
}
else
{
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(world.getBlockId(i, j, k), 1, world.getBlockMetadata(i, j, k)));
if (!world.isRemote && !(result == null))
{
int id = result.itemID;
int meta = result.getItemDamage();
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(i, j, k, 0);
world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(id, 1, meta)));
itemStack.damageItem(1, entityPlayer);
}
}
}
}
}
else
{
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
if (!world.isRemote)
{
world.spawnEntityInWorld(new EntityChargeFire(world, entityPlayer));
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
return itemStack;
}
}

View file

@ -1,71 +1,60 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.List;
import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import MysticWorld.MysticWorld;
import MysticWorld.Lib.Strings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemStaffParts extends Item {
private Icon[] icons;
private static final String[] STAFF_PARTS = new String[] {"Staff", "Hilt", "Handle", "Head"};
public ItemStaffParts(int id)
{
private static final String[] STAFF_PARTS = new String[] { "Staff", "Hilt", "Handle", "Head" };
public ItemStaffParts(int id) {
super(id);
this.setHasSubtypes(true);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.setHasSubtypes(true);
this.setCreativeTab(MysticWorld.MysticWorldTab);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return STAFF_PARTS[meta];
}
@Override
@SideOnly(Side.CLIENT)
public boolean isFull3D()
{
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
icons = new Icon[STAFF_PARTS.length];
for (int i = 0; i < STAFF_PARTS.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:StaffPart_" + STAFF_PARTS[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, STAFF_PARTS.length);
return icons[j];
}
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int var4 = 0; var4 < STAFF_PARTS.length; var4++){
par3List.add(new ItemStack(par1, 1, var4));
}
}
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, STAFF_PARTS.length);
return icons[j];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int var4 = 0; var4 < STAFF_PARTS.length; var4++) {
par3List.add(new ItemStack(par1, 1, var4));
}
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return STAFF_PARTS[meta];
}
@Override
@SideOnly(Side.CLIENT)
public boolean isFull3D() {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
icons = new Icon[STAFF_PARTS.length];
for (int i = 0; i < STAFF_PARTS.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:StaffPart_" + STAFF_PARTS[i]);
}
}
}

View file

@ -1,55 +1,43 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.List;
import MysticWorld.Util.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemStaffPower extends Item {
private Icon[] icons;
private static final String[] CHARGE_NAMES = new String[] { "Fire", "Water", "Earth", "Air", "Energy"};
private static final String[] CHARGE_NAMES = new String[] { "Fire", "Water", "Earth", "Air", "Energy" };
public ItemStaffPower(int id)
{
public ItemStaffPower(int id) {
super(id);
this.setHasSubtypes(true);
this.setCreativeTab(null);
maxStackSize = 64;
this.setHasSubtypes(true);
this.setCreativeTab(null);
maxStackSize = 64;
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return super.getUnlocalizedName() + CHARGE_NAMES[meta];
}
@Override
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
icons = new Icon[CHARGE_NAMES.length];
for (int i = 0; i < CHARGE_NAMES.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:Charge" + CHARGE_NAMES[i]);
}
public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, 5);
return icons[j];
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta) {
int j = MathHelper.clamp_int(meta, 0, 5);
return icons[j];
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return super.getUnlocalizedName() + CHARGE_NAMES[meta];
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
icons = new Icon[CHARGE_NAMES.length];
for (int i = 0; i < CHARGE_NAMES.length; ++i) {
icons[i] = iconRegister.registerIcon("MysticMods:Charge" + CHARGE_NAMES[i]);
}
}
}

View file

@ -1,160 +1,102 @@
package MysticWorld.Items;
package mysticworld.items;
import org.lwjgl.input.Keyboard;
import MysticWorld.MysticWorld;
import MysticWorld.Entity.EntityChargeEarth;
import MysticWorld.Entity.EntityChargeFire;
import MysticWorld.Entity.EntityChargeWater;
import mysticworld.MysticWorld;
import mysticworld.entity.EntityChargeWater;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import org.lwjgl.input.Keyboard;
public class ItemStaffWater extends ItemStaff {
public ItemStaffWater(int id) {
super(id);
this.setMaxStackSize(1);
this.setMaxDamage(200);
this.setCreativeTab(MysticWorld.MysticWorldTab);
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
{
EntityPlayer player = (EntityPlayer)entity;
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null) {
return itemStack;
} else {
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k)) {
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
return itemStack;
}
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0) {
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlockToAir(i, j, k);
itemStack.damageItem(1, entityPlayer);
return itemStack;
} else {
if (movingobjectposition.sideHit == 0) {
--j;
}
if (movingobjectposition.sideHit == 1) {
++j;
}
if (movingobjectposition.sideHit == 2) {
--k;
}
if (movingobjectposition.sideHit == 3) {
++k;
}
if (movingobjectposition.sideHit == 4) {
--i;
}
if (movingobjectposition.sideHit == 5) {
++i;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack)) {
return itemStack;
} else {
int i1 = world.getBlockId(i, j, k);
if (i1 == 0) {
world.playSoundEffect(i + 0.5D, j + 0.5D, k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(i, j, k, Block.waterMoving.blockID);
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
}
}
return itemStack;
}
} else {
world.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ, 0);
if (!world.isRemote) {
world.spawnEntityInWorld(new EntityChargeWater(world, entityPlayer));
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
EntityPlayer player = (EntityPlayer) entity;
ItemStack currentItem = player.inventory.getCurrentItem();
if (!world.isRemote)
{
if (currentItem != null)
{
if (currentItem.itemID == itemStack.itemID)
{
if (!world.isRemote) {
if (currentItem != null) {
if (currentItem.itemID == itemStack.itemID) {
MysticWorld.proxy.waterFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
}
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer){
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
if (movingobjectposition == null)
{
return itemStack;
}
else
{
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
{
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (!world.canMineBlock(entityPlayer, i, j, k))
{
return itemStack;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
{
return itemStack;
}
if (world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
{
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlockToAir(i, j, k);
itemStack.damageItem(1, entityPlayer);
return itemStack;
}
else
{
if (movingobjectposition.sideHit == 0)
{
--j;
}
if (movingobjectposition.sideHit == 1)
{
++j;
}
if (movingobjectposition.sideHit == 2)
{
--k;
}
if (movingobjectposition.sideHit == 3)
{
++k;
}
if (movingobjectposition.sideHit == 4)
{
--i;
}
if (movingobjectposition.sideHit == 5)
{
++i;
}
if (!entityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, itemStack))
{
return itemStack;
}
else
{
int i1 = world.getBlockId(i, j, k);
if (i1 == 0)
{
world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
world.setBlock(i, j, k, Block.waterMoving.blockID);
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
}
}
return itemStack;
}
}
else
{
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
if (!world.isRemote)
{
world.spawnEntityInWorld(new EntityChargeWater(world, entityPlayer));
itemStack.damageItem(1, entityPlayer);
}
return itemStack;
}
}
}

View file

@ -1,95 +1,72 @@
package MysticWorld.Items;
package mysticworld.items;
import java.util.List;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import MysticWorld.MysticWorld;
import MysticWorld.Entity.EntityChargeAir;
import mysticworld.MysticWorld;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemVoidShard extends Item {
public ItemVoidShard(int id) {
super(id);
this.setMaxStackSize(1);
this.setCreativeTab(MysticWorld.MysticWorldTab);
this.setMaxDamage(1);
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
{
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean par4) {
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
itemStack.setTagCompound(new NBTTagCompound());
list.add("Experience Stored: " + Integer.toString(itemStack.stackTagCompound.getInteger("xpStored")));
}
@Override
public boolean hasEffect(ItemStack itemStack) {
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
if (itemStack.stackTagCompound.hasKey("filled")) {
return itemStack.stackTagCompound.getBoolean("filled");
} else {
return false;
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
int experience = entityPlayer.experienceLevel;
int experienceSubtract = entityPlayer.experienceLevel - 30;
if (itemStack.stackTagCompound.getBoolean("filled") == false)
{
if (experience > 0 && experience <= 30)
{
if (itemStack.stackTagCompound.getBoolean("filled") == false) {
if (experience > 0 && experience <= 30) {
entityPlayer.experienceLevel = 0;
itemStack.stackTagCompound.setInteger("xpStored", experience);
itemStack.stackTagCompound.setBoolean("filled", true);
}
else if (experience > 30)
{
} else if (experience > 30) {
entityPlayer.experienceLevel = experienceSubtract;
itemStack.stackTagCompound.setInteger("xpStored", 30);
itemStack.stackTagCompound.setBoolean("filled", true);
}
}
else
{
} else {
entityPlayer.experienceLevel += itemStack.stackTagCompound.getInteger("xpStored");
itemStack.stackTagCompound.setInteger("xpStored", 0);
itemStack.stackTagCompound.setBoolean("filled", false);
itemStack.damageItem(2, entityPlayer);
}
return itemStack;
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean par4)
{
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
list.add("Experience Stored: " + Integer.toString(itemStack.stackTagCompound.getInteger("xpStored")));
}
@Override
public boolean hasEffect(ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
itemStack.setTagCompound(new NBTTagCompound());
if (itemStack.stackTagCompound.hasKey("filled"))
{
return itemStack.stackTagCompound.getBoolean("filled");
}
else
{
return false;
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("MysticMods:ShardVoid");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
itemIcon = iconRegister.registerIcon("MysticMods:ShardVoid");
}
}