Created
September 5, 2017 08:45
-
-
Save triphion/9cfa3a8011eb74d90df02255f8643825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.triphion.ancient.items; | |
import com.triphion.ancient.Reference; | |
import com.triphion.ancient.init.ModItems; | |
import net.minecraft.block.Block; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.entity.projectile.EntityDragonFireball; | |
import net.minecraft.entity.projectile.EntityLargeFireball; | |
import net.minecraft.entity.projectile.EntitySmallFireball; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemStack; | |
import net.minecraft.item.ItemTool; | |
import net.minecraft.util.ActionResult; | |
import net.minecraft.util.EnumActionResult; | |
import net.minecraft.util.EnumHand; | |
import net.minecraft.util.ResourceLocation; | |
import net.minecraft.util.math.RayTraceResult; | |
import net.minecraft.util.math.Vec3d; | |
import net.minecraft.world.World; | |
public class ItemDragonsWrath extends Item { | |
public ItemDragonsWrath(String unlocalizedName) { | |
this.setUnlocalizedName(unlocalizedName); | |
this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName)); | |
this.setMaxStackSize(1); | |
this.setMaxDamage(1059); | |
} | |
@Override | |
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { | |
if(!worldIn.isRemote){ | |
Vec3d look = playerIn.getLookVec(); | |
EntityDragonFireball fireBall = new EntityDragonFireball(worldIn, playerIn, 0, 0, 0); | |
fireBall.setSprinting(true); | |
fireBall.setPosition(playerIn.posX + look.xCoord * 1.3, playerIn.posY + look.yCoord + (playerIn.getEyeHeight() / 1), playerIn.posZ + look.zCoord * 1.3); | |
fireBall.accelerationX = look.xCoord * 0.1; | |
fireBall.accelerationY = look.yCoord * 0.1; | |
fireBall.accelerationZ = look.zCoord * 0.1; | |
this.setDamage(playerIn.getHeldItem(handIn), + 1); | |
worldIn.spawnEntity(fireBall); } | |
else{ | |
return new ActionResult(EnumActionResult.FAIL,playerIn.getHeldItem(handIn)); | |
} | |
return new ActionResult(EnumActionResult.SUCCESS,playerIn.getHeldItem(handIn)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.triphion.ancient.items; | |
import java.util.Set; | |
import com.triphion.ancient.Reference; | |
import com.triphion.ancient.init.ModItems; | |
import net.minecraft.block.Block; | |
import net.minecraft.entity.effect.EntityLightningBolt; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.entity.projectile.EntityLargeFireball; | |
import net.minecraft.entity.projectile.EntitySmallFireball; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemStack; | |
import net.minecraft.item.ItemTool; | |
import net.minecraft.util.ActionResult; | |
import net.minecraft.util.EnumActionResult; | |
import net.minecraft.util.EnumHand; | |
import net.minecraft.util.ResourceLocation; | |
import net.minecraft.util.math.RayTraceResult; | |
import net.minecraft.util.math.Vec3d; | |
import net.minecraft.world.World; | |
public class ItemMoltenStaff extends Item { | |
public ItemMoltenStaff(String unlocalizedName) { | |
this.setUnlocalizedName(unlocalizedName); | |
this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName)); | |
this.setMaxStackSize(1); | |
this.setMaxDamage(359); | |
} | |
@Override | |
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { | |
if(!worldIn.isRemote){ | |
Vec3d look = playerIn.getLookVec(); | |
EntitySmallFireball fireBall = new EntitySmallFireball(worldIn, playerIn, 0, 0, 0); | |
fireBall.setSprinting(true); | |
fireBall.setPosition(playerIn.posX + look.xCoord * 1.3, playerIn.posY + look.yCoord + (playerIn.getEyeHeight() / 1), playerIn.posZ + look.zCoord * 1.3); | |
fireBall.accelerationX = look.xCoord * 0.1; | |
fireBall.accelerationY = look.yCoord * 0.1; | |
fireBall.accelerationZ = look.zCoord * 0.1; | |
this.setDamage(playerIn.getHeldItem(handIn), + 1); | |
worldIn.spawnEntity(fireBall); } | |
else{ | |
return new ActionResult(EnumActionResult.FAIL,playerIn.getHeldItem(handIn)); | |
} | |
return new ActionResult(EnumActionResult.SUCCESS,playerIn.getHeldItem(handIn)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment