Improved efficiency with staff and orb effects.
This commit is contained in:
parent
3d263f4d92
commit
d1a51bb691
13 changed files with 298 additions and 99 deletions
20
common/MysticWorld/Items/ItemOrb.java
Normal file
20
common/MysticWorld/Items/ItemOrb.java
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package MysticWorld.Items;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import MysticWorld.MysticWorld;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemOrb extends Item {
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
public ItemOrb(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(200);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,24 +1,44 @@
|
|||
package MysticWorld.Items;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import MysticWorld.MysticWorld;
|
||||
import MysticWorld.Entity.EntityChargeAir;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemOrbAir extends Item {
|
||||
|
||||
public ItemOrbAir(int par1)
|
||||
public class ItemOrbAir extends ItemOrb
|
||||
{
|
||||
public ItemOrbAir(int id)
|
||||
{
|
||||
super(par1);
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(200);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
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)
|
||||
{
|
||||
player.fallDistance = 0.0F;
|
||||
MysticWorld.proxy.airFX(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 (entityPlayer.onGround)
|
||||
|
|
@ -31,10 +51,4 @@ public class ItemOrbAir extends Item {
|
|||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("MysticTextures:OrbAir");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,13 @@ 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;
|
||||
|
|
@ -24,22 +27,32 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
|
||||
public class ItemOrbEarth extends Item {
|
||||
|
||||
public ItemOrbEarth(int par1)
|
||||
public class ItemOrbEarth extends ItemOrb
|
||||
{
|
||||
public ItemOrbEarth(int id)
|
||||
{
|
||||
super(par1);
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(200);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("MysticTextures:OrbEarth");
|
||||
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 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))
|
||||
|
|
|
|||
|
|
@ -5,21 +5,41 @@ import MysticWorld.Blocks.BlockHandler;
|
|||
import MysticWorld.Entity.EntityChargeAir;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
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 Item {
|
||||
public class ItemOrbEnergy extends ItemOrb {
|
||||
|
||||
public ItemOrbEnergy(int par1)
|
||||
public ItemOrbEnergy(int id)
|
||||
{
|
||||
super(par1);
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(200);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
|
@ -70,11 +90,5 @@ public class ItemOrbEnergy extends Item {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("MysticTextures:OrbEnergy");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package MysticWorld.Items;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import MysticWorld.MysticWorld;
|
||||
import MysticWorld.Entity.EntityChargeAir;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
|
@ -16,15 +19,80 @@ import net.minecraft.potion.PotionEffect;
|
|||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemOrbFire extends ItemFlintAndSteel {
|
||||
|
||||
public ItemOrbFire(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(200);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
public class ItemOrbFire extends ItemOrb {
|
||||
|
||||
public ItemOrbFire(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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
@ -36,6 +104,7 @@ public class ItemOrbFire extends ItemFlintAndSteel {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer entityPlayer, Entity entity)
|
||||
{
|
||||
entity.setFire(5);
|
||||
|
|
|
|||
|
|
@ -8,10 +8,13 @@ import MysticWorld.Entity.EntityChargeAir;
|
|||
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;
|
||||
|
|
@ -19,24 +22,32 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
import net.minecraftforge.event.Event;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
|
||||
public class ItemOrbWater extends Item {
|
||||
|
||||
Random rand = new Random();
|
||||
public class ItemOrbWater extends ItemOrb {
|
||||
|
||||
public ItemOrbWater(int par1)
|
||||
public ItemOrbWater(int id)
|
||||
{
|
||||
super(par1);
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(200);
|
||||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("MysticTextures:OrbWater");
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
ItemStack currentItem = player.inventory.getCurrentItem();
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package MysticWorld.Items;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import MysticWorld.MysticWorld;
|
||||
|
|
@ -7,7 +9,8 @@ import net.minecraft.item.Item;
|
|||
|
||||
public class ItemStaff extends Item
|
||||
{
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
public ItemStaff(int id)
|
||||
{
|
||||
super(id);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package MysticWorld.Items;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
|
@ -9,6 +11,7 @@ import MysticWorld.MysticWorld;
|
|||
import MysticWorld.Entity.EntityChargeAir;
|
||||
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.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
@ -16,16 +19,29 @@ import net.minecraft.item.ItemTool;
|
|||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemStaffAir extends ItemStaff {
|
||||
|
||||
|
||||
public ItemStaffAir(int id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("MysticTextures:StaffAir");
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
ItemStack currentItem = player.inventory.getCurrentItem();
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (currentItem != null)
|
||||
{
|
||||
if (currentItem.itemID == itemStack.itemID)
|
||||
{
|
||||
player.fallDistance = 0.0F;
|
||||
MysticWorld.proxy.airFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
|
||||
|
|
@ -56,5 +72,5 @@ public class ItemStaffAir extends ItemStaff {
|
|||
return itemStack;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ 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;
|
||||
|
|
@ -29,18 +30,32 @@ 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) {
|
||||
public class ItemStaffEarth extends ItemStaff
|
||||
{
|
||||
public ItemStaffEarth(int id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("MysticTextures:StaffEarth");
|
||||
}
|
||||
@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))
|
||||
|
|
|
|||
|
|
@ -9,9 +9,12 @@ import MysticWorld.Entity.EntityChargeFire;
|
|||
import net.minecraft.block.Block;
|
||||
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.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;
|
||||
|
|
@ -23,11 +26,25 @@ public class ItemStaffEnegy extends ItemStaff {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("MysticTextures:StaffEnergy");
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
ItemStack currentItem = player.inventory.getCurrentItem();
|
||||
|
||||
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))
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ 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;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
|
@ -30,6 +32,25 @@ public class ItemStaffFire extends ItemStaff {
|
|||
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)
|
||||
{
|
||||
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))
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ 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;
|
||||
|
|
@ -31,12 +32,25 @@ public class ItemStaffWater extends ItemStaff {
|
|||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("MysticTextures:StaffWater");
|
||||
}
|
||||
@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.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))
|
||||
{
|
||||
|
|
@ -142,4 +156,5 @@ public class ItemStaffWater extends ItemStaff {
|
|||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -43,8 +43,6 @@ public class TickHandler implements IScheduledTickHandler
|
|||
InventoryPlayer inventory = player.inventory;
|
||||
ItemStack itemstack = inventory.getCurrentItem();
|
||||
|
||||
staffAndOrbTick(player, world, itemstack, rand);
|
||||
|
||||
pillarTick(player, world, inventory, rand);
|
||||
}
|
||||
|
||||
|
|
@ -128,31 +126,4 @@ public class TickHandler implements IScheduledTickHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void staffAndOrbTick(EntityPlayer player, World world, ItemStack itemstack, Random rand)
|
||||
{
|
||||
if (itemstack != null && (itemstack.itemID == ItemHandler$1.fireOrb.itemID || itemstack.itemID == ItemHandler$1.fireStaff.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);
|
||||
}
|
||||
|
||||
if (itemstack != null && (itemstack.itemID == ItemHandler$1.airOrb.itemID || itemstack.itemID == ItemHandler$1.airStaff.itemID)){
|
||||
player.fallDistance = 0.0F;
|
||||
MysticWorld.proxy.airFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
||||
}
|
||||
|
||||
if (itemstack != null && (itemstack.itemID == ItemHandler$1.energyOrb.itemID || itemstack.itemID == ItemHandler$1.energyStaff.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);
|
||||
player.stepHeight = 1.001F;
|
||||
}
|
||||
|
||||
if (itemstack != null && (itemstack.itemID == ItemHandler$1.earthOrb.itemID || itemstack.itemID == ItemHandler$1.earthStaff.itemID)){
|
||||
MysticWorld.proxy.earthFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
||||
}
|
||||
|
||||
if (itemstack != null && (itemstack.itemID == ItemHandler$1.waterOrb.itemID || itemstack.itemID == ItemHandler$1.waterStaff.itemID)){
|
||||
MysticWorld.proxy.waterFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue