本文整理汇总了Java中net.minecraft.entity.projectile.EntitySmallFireball类的典型用法代码示例。如果您正苦于以下问题:Java EntitySmallFireball类的具体用法?Java EntitySmallFireball怎么用?Java EntitySmallFireball使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntitySmallFireball类属于net.minecraft.entity.projectile包,在下文中一共展示了EntitySmallFireball类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispenseStack
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
World world = source.getWorld();
BlockPos pos = source.getBlockPos();
Vec3d pos2 = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
Vec3d dir = this.getNearestTargetDirection(world, pos);
if(dir == null) return null;
IPosition ipos = new PositionImpl(pos2.x + dir.x * .75, pos2.y + dir.y * .75, pos2.z + dir.z * .75);
double d0 = ipos.getX();
double d1 = ipos.getY();
double d2 = ipos.getZ();
Random random = world.rand;
double d3 = random.nextGaussian() * 0.05D + dir.x;
double d4 = random.nextGaussian() * 0.05D + dir.y;
double d5 = random.nextGaussian() * 0.05D + dir.z;
world.spawnEntity(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
stack.splitStack(1);
return stack;
}
示例2: onItemRightClick
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
//itemstack.damageItem(100, entityplayer);
if (!world.isRemote)
{
Vec3 look = entityplayer.getLookVec();
EntitySmallFireball fireball2 = new EntitySmallFireball(world, entityplayer, 1, 1, 1);
fireball2.setPosition(
entityplayer.posX + look.xCoord * 5,
entityplayer.posY + look.yCoord * 5,
entityplayer.posZ + look.zCoord * 5);
fireball2.accelerationX = look.xCoord * 0.1;
fireball2.accelerationY = look.yCoord * 0.1;
fireball2.accelerationZ = look.zCoord * 0.1;
world.spawnEntityInWorld(fireball2);
world.playSoundAtEntity(entityplayer, "epicproportionsmod:jen_staff_thunder", 1.0F, 1.0F);
this.setItemDamage(itemJenStaff.getItemDamage() - 1);
//p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
//return p_77659_1_;
}
return itemstack;
}
示例3: onItemRightClick
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,EntityPlayer par3EntityPlayer) {
if(RpgInventoryMod.playerClass.contains(RpgBaseAddon.CLASSALCHEMIST)){
if (par3EntityPlayer.inventory.hasItem(Items.blaze_powder)) {
Vec3 look = par3EntityPlayer.getLookVec();
EntitySmallFireball ball = new EntitySmallFireball(par2World, par3EntityPlayer, 1, 1, 1);
ball.setPosition(par3EntityPlayer.posX + (look.xCoord * 1),par3EntityPlayer.posY + (look.yCoord * 1) + 1.5,par3EntityPlayer.posZ + (look.zCoord * 1));
ball.accelerationX = look.xCoord * 0.1;
ball.accelerationY = look.yCoord * 0.1;
ball.accelerationZ = look.zCoord * 0.1;
if (!par2World.isRemote) {
par2World.spawnEntityInWorld(ball);
}
par1ItemStack.damageItem(1, par3EntityPlayer);
if(!par3EntityPlayer.capabilities.isCreativeMode)
par3EntityPlayer.inventory.consumeInventoryItem(Items.blaze_powder);
}
}
return par1ItemStack;
}
示例4: onItemRightClick
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) {
double d0 = player.posX - player.posX;
double d1 = player.boundingBox.minY + player.height / 2.0F - (player.posY + player.height / 2.0F);
double d2 = player.posZ - player.posZ;
float f1 = MathHelper.sqrt_float(1F) * 0.5F;
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, player, d0 + world.rand.nextGaussian() * f1, d1, d2 + world.rand.nextGaussian() * f1);
// EntitySmallFireball entitysmallfireball = new
// EntitySmallFireball(world, player, player.cameraYaw,
// player.cameraPitch, player.cameraYaw );
entitysmallfireball.posY = player.posY + player.height / 2.0F + 0.5D;
world.spawnEntityInWorld(entitysmallfireball);
// world.spawnEntityInWorld(new EntityLargeFireball(world, player.posX,
// player.posY, player.posZ, (double)player.cameraYaw,
// (double)player.cameraPitch, (double)player.cameraYaw));
return itemstack;
}
示例5: dispenseStack
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
IPosition iposition = BlockDispenser.getIPositionFromBlockSource(par1IBlockSource);
double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F);
World world = par1IBlockSource.getWorld();
Random random = world.rand;
double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetX();
double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetY();
double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ();
world.spawnEntityInWorld(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例6: dispenseStack
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing enumfacing = BlockTrap.getFacing(par1IBlockSource.getBlockMetadata());
IPosition iposition = BlockTrap.getIPositionFromBlockSource(par1IBlockSource);
double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F);
World world = par1IBlockSource.getWorld();
Random random = world.rand;
double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetX();
double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetY();
double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ();
world.spawnEntityInWorld(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
par2ItemStack.splitStack(1);
return par2ItemStack;
}
示例7: onClickAir
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
@Override
public void onClickAir(PossessivePlayer possessivePlayer, EntityPlayer player) {
if (!player.worldObj.isRemote && this.getData(player).getShort("ProjectileCooldown") <= 0) {
player.worldObj.playEvent(null, 1018, player.getPosition(), 0);
float pitchVelocity = MathHelper.cos(player.rotationPitch * 0.017453292F);
float velocityX = -MathHelper.sin(player.rotationYaw * 0.017453292F) * pitchVelocity;
float velocityY = -MathHelper.sin(player.rotationPitch * 0.017453292F);
float velocityZ = MathHelper.cos(player.rotationYaw * 0.017453292F) * pitchVelocity;
EntitySmallFireball fireball = new EntitySmallFireball(player.worldObj, player, velocityX + player.motionX, velocityY + player.motionY, velocityZ + player.motionZ);
fireball.posY = player.posY + player.height / 2.0F + 0.5D;
player.worldObj.spawnEntityInWorld(fireball);
this.getData(player).setShort("ProjectileCooldown", (short) 10);
}
}
示例8: attackEntity
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
@Override
protected void attackEntity(Entity par1Entity, float par2) {
if (this.attackTime <= 0 && par2 < 2.0F && par1Entity.boundingBox.maxY > this.boundingBox.minY && par1Entity.boundingBox.minY < this.boundingBox.maxY) {
this.attackTime = 20;
this.attackEntityAsMob(par1Entity);
} else if (par2 < 30.0F) {
final double d0 = par1Entity.posX - this.posX;
final double d1 = par1Entity.boundingBox.minY + par1Entity.height / 2.0F - (this.posY + this.height / 2.0F);
final double d2 = par1Entity.posZ - this.posZ;
if (this.attackTime == 0) {
++this.field_70846_g;
if (this.field_70846_g == 1) {
this.attackTime = 60;
this.func_70844_e(true);
} else if (this.field_70846_g <= 4) {
this.attackTime = 6;
} else {
this.attackTime = 100;
this.field_70846_g = 0;
this.func_70844_e(false);
}
if (this.field_70846_g > 1) {
final float f1 = MathHelper.sqrt_float(par2) * 0.5F;
this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
for (int i = 0; i < 1; ++i) {
final EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.worldObj, this, d0 + this.rand.nextGaussian() * f1, d1, d2 + this.rand.nextGaussian() * f1);
entitysmallfireball.posY = this.posY + this.height / 2.0F + 0.5D;
this.worldObj.spawnEntityInWorld(entitysmallfireball);
}
}
}
this.rotationYaw = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
this.hasAttacked = true;
}
}
示例9: execute
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
@Override
public void execute(EntityLivingBase target, @Nullable AbstractMorph morph)
{
World world = target.worldObj;
if (world.isRemote)
{
return;
}
if (target instanceof EntityPlayer && ((EntityPlayer) target).getCooledAttackStrength(0.0F) < 1)
{
return;
}
Vec3d vec3d = target.getLook(1.0F);
double d1 = 4.0D;
double d2 = vec3d.xCoord * d1;
double d3 = vec3d.yCoord * d1;
double d4 = vec3d.zCoord * d1;
world.playEvent((EntityPlayer) null, 1016, new BlockPos(target), 0);
EntitySmallFireball fireball = new EntitySmallFireball(world, target, d2, d3, d4);
fireball.posX = target.posX;
fireball.posY = target.posY + target.height * 0.9;
fireball.posZ = target.posZ;
world.spawnEntityInWorld(fireball);
if (target instanceof EntityPlayer)
{
((EntityPlayer) target).resetCooldown();
}
}
示例10: ApplyEffect
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
@Override
public void ApplyEffect(ItemStack stack, EntityPlayer player)
{
if(!player.worldObj.isRemote)
{
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(player.worldObj, player.posX, player.posY, player.posZ, player.getLookVec().xCoord, player.getLookVec().yCoord, player.getLookVec().zCoord);
entitysmallfireball.posY = player.posY + (double)(player.height / 2.0F) + 0.5D;
entitysmallfireball.shootingEntity = player;
player.worldObj.spawnEntityInWorld(entitysmallfireball);
stack.damageItem(1, player);
if (stack.stackSize < 1) player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
示例11: attackEntity
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
/**
* Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.
*/
protected void attackEntity(Entity p_70785_1_, float p_70785_2_) {
if (this.attackTime <= 0 && p_70785_2_ < 2.0F && p_70785_1_.boundingBox.maxY > this.boundingBox.minY
&& p_70785_1_.boundingBox.minY < this.boundingBox.maxY) {
this.attackTime = 20;
this.attackEntityAsMob(p_70785_1_);
}
else if (p_70785_2_ < 30.0F) {
double d0 = p_70785_1_.posX - this.posX;
double d1 = p_70785_1_.boundingBox.minY + (double)(p_70785_1_.height / 2.0F) - (this.posY + (double)(this.height / 2.0F));
double d2 = p_70785_1_.posZ - this.posZ;
if (this.attackTime == 0) {
++this.field_70846_g;
if (this.field_70846_g == 1) {
this.attackTime = 60;
this.func_70844_e(true);
}
else if (this.field_70846_g <= 4) {
this.attackTime = 6;
}
else {
this.attackTime = 100;
this.field_70846_g = 0;
this.func_70844_e(false);
}
if (this.field_70846_g > 1) {
float f1 = MathHelper.sqrt_float(p_70785_2_) * 0.5F;
this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)this.posX,
(int)this.posY, (int)this.posZ, 0);
for (int i = 0; i < 1; ++i) {
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.worldObj, this, d0 + this.rand.nextGaussian() * (double)f1, d1, d2 + this.rand.nextGaussian() * (double)f1);
entitysmallfireball.posY = this.posY + (double)(this.height / 2.0F) + 0.5D;
this.worldObj.spawnEntityInWorld(entitysmallfireball);
}
}
}
this.rotationYaw = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
this.hasAttacked = true;
}
}
示例12: attackEntity
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
protected void attackEntity(Entity p_70785_1_, float p_70785_2_)
{
double d0 = p_70785_1_.posX - this.posX;
double d1 = p_70785_1_.boundingBox.minY + (double)(p_70785_1_.height / 2.0F) - (this.posY + (double)(this.height / 2.0F));
double d2 = p_70785_1_.posZ - this.posZ;
float f1 = MathHelper.sqrt_float(p_70785_2_) * 0.5F;
if (rand.nextInt(100) <= 10) {
for (int i = 0; i < 1; ++i) {
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.worldObj, this, d0 + this.rand.nextGaussian() * (double) f1, d1, d2 + this.rand.nextGaussian() * (double) f1);
entitysmallfireball.posY = this.posY + (double) (this.height / 2.0F) + 0.5D;
this.worldObj.spawnEntityInWorld(entitysmallfireball);
}
}
}
示例13: onItemRightClick
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
{
if (!world.isRemote)
{
Vec3 v3 = player.getLook(1.0F);
EntitySmallFireball smallfireball = new EntitySmallFireball(world, player.posX, player.posY + player.eyeHeight, player.posZ, v3.xCoord, v3.yCoord, v3.zCoord);
smallfireball.shootingEntity = player;
world.spawnEntityInWorld(smallfireball);
}
return itemStack;
}
示例14: onUse
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
@Override
public void onUse(World world, EntityPlayer player, IPlayerSession session, ItemStack stack, int boost, int cost) {
if (session.hasEnoughMana(cost())) {
Vec3 look = player.getLookVec();
EntitySmallFireball fireBall = new EntitySmallFireball(world, player, 0, 0, 0);
fireBall.setSprinting(true);
fireBall.setPosition(player.posX + look.xCoord * 4.2, player.posY + look.yCoord + (player.getEyeHeight() / 2), player.posZ + look.zCoord * 4.2);
fireBall.accelerationX = look.xCoord * 0.5;
fireBall.accelerationY = look.yCoord * 0.5;
fireBall.accelerationZ = look.zCoord * 0.5;
if (!world.isRemote)
world.spawnEntityInWorld(fireBall);
session.adjustMana(-cost(), false);
}
}
示例15: func_70785_a
import net.minecraft.entity.projectile.EntitySmallFireball; //导入依赖的package包/类
protected void func_70785_a(Entity p_70785_1_, float p_70785_2_) {
if(this.field_70724_aR <= 0 && p_70785_2_ < 2.0F && p_70785_1_.field_70121_D.field_72337_e > this.field_70121_D.field_72338_b && p_70785_1_.field_70121_D.field_72338_b < this.field_70121_D.field_72337_e) {
this.field_70724_aR = 20;
this.func_70652_k(p_70785_1_);
} else if(p_70785_2_ < 30.0F) {
double var3 = p_70785_1_.field_70165_t - this.field_70165_t;
double var5 = p_70785_1_.field_70121_D.field_72338_b + (double)(p_70785_1_.field_70131_O / 2.0F) - (this.field_70163_u + (double)(this.field_70131_O / 2.0F));
double var7 = p_70785_1_.field_70161_v - this.field_70161_v;
if(this.field_70724_aR == 0) {
++this.field_70846_g;
if(this.field_70846_g == 1) {
this.field_70724_aR = 60;
this.func_70844_e(true);
} else if(this.field_70846_g <= 4) {
this.field_70724_aR = 6;
} else {
this.field_70724_aR = 100;
this.field_70846_g = 0;
this.func_70844_e(false);
}
if(this.field_70846_g > 1) {
float var9 = MathHelper.func_76129_c(p_70785_2_) * 0.5F;
this.field_70170_p.func_72889_a((EntityPlayer)null, 1009, (int)this.field_70165_t, (int)this.field_70163_u, (int)this.field_70161_v, 0);
for(int var10 = 0; var10 < 1; ++var10) {
EntitySmallFireball var11 = new EntitySmallFireball(this.field_70170_p, this, var3 + this.field_70146_Z.nextGaussian() * (double)var9, var5, var7 + this.field_70146_Z.nextGaussian() * (double)var9);
var11.field_70163_u = this.field_70163_u + (double)(this.field_70131_O / 2.0F) + 0.5D;
this.field_70170_p.func_72838_d(var11);
}
}
}
this.field_70177_z = (float)(Math.atan2(var7, var3) * 180.0D / 3.1415927410125732D) - 90.0F;
this.field_70787_b = true;
}
}