Staves now do what orbs do when shift clicking.
This commit is contained in:
parent
65acdc5b2d
commit
80c8d2fc1c
5 changed files with 504 additions and 46 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
package MysticWorld.Items;
|
package MysticWorld.Items;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import MysticWorld.MysticWorld;
|
import MysticWorld.MysticWorld;
|
||||||
import MysticWorld.Entity.EntityChargeAir;
|
import MysticWorld.Entity.EntityChargeAir;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
|
@ -27,15 +29,30 @@ public class ItemStaffAir extends Item {
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
|
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
|
||||||
{
|
{
|
||||||
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
|
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
|
{
|
||||||
|
if (entityPlayer.onGround)
|
||||||
|
{
|
||||||
|
world.playSoundEffect(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||||
|
itemStack.damageItem(1, entityPlayer);
|
||||||
|
entityPlayer.addVelocity(0, 2.5, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!world.isRemote)
|
return itemStack;
|
||||||
{
|
}
|
||||||
world.spawnEntityInWorld(new EntityChargeAir(world, entityPlayer));
|
else
|
||||||
|
{
|
||||||
|
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
|
||||||
|
|
||||||
itemStack.damageItem(1, entityPlayer);
|
if (!world.isRemote)
|
||||||
}
|
{
|
||||||
|
world.spawnEntityInWorld(new EntityChargeAir(world, entityPlayer));
|
||||||
|
|
||||||
|
itemStack.damageItem(1, entityPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return itemStack;
|
return itemStack;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
package MysticWorld.Items;
|
package MysticWorld.Items;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import MysticWorld.MysticWorld;
|
import MysticWorld.MysticWorld;
|
||||||
import MysticWorld.Entity.EntityChargeEarth;
|
import MysticWorld.Entity.EntityChargeEarth;
|
||||||
import MysticWorld.Entity.EntityChargeFire;
|
import MysticWorld.Entity.EntityChargeFire;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockCocoa;
|
||||||
|
import net.minecraft.block.BlockCrops;
|
||||||
|
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.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityCreature;
|
import net.minecraft.entity.EntityCreature;
|
||||||
|
|
@ -12,8 +20,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.Event.Result;
|
import net.minecraftforge.event.Event.Result;
|
||||||
|
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||||
|
|
||||||
public class ItemStaffEarth extends Item {
|
public class ItemStaffEarth extends Item {
|
||||||
|
|
@ -31,16 +41,209 @@ public class ItemStaffEarth extends Item {
|
||||||
itemIcon = iconRegister.registerIcon("MysticTextures:StaffEarth");
|
itemIcon = iconRegister.registerIcon("MysticTextures:StaffEarth");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer){
|
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10){
|
||||||
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
|
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
|
{
|
||||||
|
if (!entityPlayer.canPlayerEdit(par4, par5, par6, par7, itemStack))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (applyBonemeal(itemStack, world, par4, par5, par6, entityPlayer))
|
||||||
|
{
|
||||||
|
if (!world.isRemote)
|
||||||
|
{
|
||||||
|
world.playAuxSFX(2005, par4, par5, par6, 0);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
|
||||||
|
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
world.spawnEntityInWorld(new EntityChargeEarth(world, entityPlayer));
|
world.spawnEntityInWorld(new EntityChargeEarth(world, entityPlayer));
|
||||||
|
|
||||||
itemStack.damageItem(1, entityPlayer);
|
itemStack.damageItem(1, entityPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package MysticWorld.Items;
|
package MysticWorld.Items;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import MysticWorld.MysticWorld;
|
import MysticWorld.MysticWorld;
|
||||||
|
import MysticWorld.Blocks.BlockHandler;
|
||||||
import MysticWorld.Entity.EntityChargeEnergy;
|
import MysticWorld.Entity.EntityChargeEnergy;
|
||||||
import MysticWorld.Entity.EntityChargeFire;
|
import MysticWorld.Entity.EntityChargeFire;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
|
@ -25,17 +28,70 @@ public class ItemStaffEnegy extends Item{
|
||||||
itemIcon = iconRegister.registerIcon("MysticTextures:StaffEnergy");
|
itemIcon = iconRegister.registerIcon("MysticTextures:StaffEnergy");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer){
|
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10){
|
||||||
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
|
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
|
{
|
||||||
|
if (par7 == 0)
|
||||||
|
{
|
||||||
|
--par5;
|
||||||
|
}
|
||||||
|
|
||||||
if (!world.isRemote)
|
if (par7 == 1)
|
||||||
{
|
{
|
||||||
world.spawnEntityInWorld(new EntityChargeEnergy(world, entityPlayer));
|
++par5;
|
||||||
|
}
|
||||||
|
|
||||||
itemStack.damageItem(1, entityPlayer);
|
if (par7 == 2)
|
||||||
}
|
{
|
||||||
|
--par6;
|
||||||
|
}
|
||||||
|
|
||||||
return itemStack;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,22 @@
|
||||||
package MysticWorld.Items;
|
package MysticWorld.Items;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import MysticWorld.MysticWorld;
|
import MysticWorld.MysticWorld;
|
||||||
|
import MysticWorld.Blocks.BlockHandler;
|
||||||
import MysticWorld.Entity.EntityChargeFire;
|
import MysticWorld.Entity.EntityChargeFire;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ItemStaffFire extends Item{
|
public class ItemStaffFire extends Item {
|
||||||
|
|
||||||
public ItemStaffFire(int id) {
|
public ItemStaffFire(int id) {
|
||||||
super(id);
|
super(id);
|
||||||
|
|
@ -24,17 +31,94 @@ public class ItemStaffFire extends Item{
|
||||||
itemIcon = iconRegister.registerIcon("MysticTextures:StaffFire");
|
itemIcon = iconRegister.registerIcon("MysticTextures:StaffFire");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer){
|
public boolean itemInteractionForEntity(ItemStack itemStack, EntityLiving entityLiving)
|
||||||
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
|
{
|
||||||
|
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
|
{
|
||||||
|
entityLiving.setFire(5);
|
||||||
|
entityLiving.attackEntityFrom(DamageSource.magic, 7);
|
||||||
|
|
||||||
if (!world.isRemote)
|
itemStack.damageItem(1, entityLiving);
|
||||||
{
|
|
||||||
world.spawnEntityInWorld(new EntityChargeFire(world, entityPlayer));
|
|
||||||
|
|
||||||
itemStack.damageItem(1, entityPlayer);
|
return true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return itemStack;
|
public boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer entityPlayer, Entity entity)
|
||||||
|
{
|
||||||
|
entity.setFire(5);
|
||||||
|
entity.attackEntityFrom(DamageSource.magic, 7);
|
||||||
|
|
||||||
|
itemStack.damageItem(1, entityPlayer);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10){
|
||||||
|
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
|
{
|
||||||
|
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, Block.fire.blockID);
|
||||||
|
}
|
||||||
|
|
||||||
|
itemStack.damageItem(1, entityPlayer);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
package MysticWorld.Items;
|
package MysticWorld.Items;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import MysticWorld.MysticWorld;
|
import MysticWorld.MysticWorld;
|
||||||
import MysticWorld.Entity.EntityChargeEarth;
|
import MysticWorld.Entity.EntityChargeEarth;
|
||||||
import MysticWorld.Entity.EntityChargeFire;
|
import MysticWorld.Entity.EntityChargeFire;
|
||||||
import MysticWorld.Entity.EntityChargeWater;
|
import MysticWorld.Entity.EntityChargeWater;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityCreature;
|
import net.minecraft.entity.EntityCreature;
|
||||||
|
|
@ -12,6 +15,8 @@ import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumMovingObjectType;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.Event.Result;
|
import net.minecraftforge.event.Event.Result;
|
||||||
|
|
@ -33,15 +38,108 @@ public class ItemStaffWater extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer){
|
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer){
|
||||||
world.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)entityPlayer.posX, (int)entityPlayer.posY, (int)entityPlayer.posZ, 0);
|
if (Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
|
{
|
||||||
|
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityPlayer, true);
|
||||||
|
|
||||||
if (!world.isRemote)
|
if (movingobjectposition == null)
|
||||||
{
|
{
|
||||||
world.spawnEntityInWorld(new EntityChargeWater(world, entityPlayer));
|
return itemStack;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE)
|
||||||
|
{
|
||||||
|
int i = movingobjectposition.blockX;
|
||||||
|
int j = movingobjectposition.blockY;
|
||||||
|
int k = movingobjectposition.blockZ;
|
||||||
|
|
||||||
itemStack.damageItem(1, entityPlayer);
|
if (!world.canMineBlock(entityPlayer, i, j, k))
|
||||||
}
|
{
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue