当前位置: 首页>>代码示例>>Java>>正文


Java EntityFireworkRocket类代码示例

本文整理汇总了Java中net.minecraft.entity.item.EntityFireworkRocket的典型用法代码示例。如果您正苦于以下问题:Java EntityFireworkRocket类的具体用法?Java EntityFireworkRocket怎么用?Java EntityFireworkRocket使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EntityFireworkRocket类属于net.minecraft.entity.item包,在下文中一共展示了EntityFireworkRocket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: spawnFirework

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
public static void spawnFirework(World world, double x, double y, double z) {
    ItemStack rocket = new ItemStack(Items.FIREWORKS);

    ItemStack itemstack1 = getFireworkCharge();

    NBTTagCompound nbttagcompound = new NBTTagCompound();
    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
    NBTTagList nbttaglist = new NBTTagList();

    if (itemstack1 != null && itemstack1.getItem() == Items.FIREWORK_CHARGE && itemstack1.hasTagCompound() && itemstack1.getTagCompound().hasKey("Explosion")) {
        nbttaglist.appendTag(itemstack1.getTagCompound().getCompoundTag("Explosion"));
    }

    nbttagcompound1.setTag("Explosions", nbttaglist);
    nbttagcompound1.setByte("Flight", (byte) 2);
    nbttagcompound.setTag("Fireworks", nbttagcompound1);

    rocket.setTagCompound(nbttagcompound);

    EntityFireworkRocket entity = new EntityFireworkRocket(world, x, y, z, rocket);
    world.spawnEntity(entity);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:23,代码来源:DateEventHandler.java

示例2: onItemUse

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (!worldIn.isRemote)
    {
        EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(worldIn, (double)((float)pos.getX() + hitX), (double)((float)pos.getY() + hitY), (double)((float)pos.getZ() + hitZ), stack);
        worldIn.spawnEntityInWorld(entityfireworkrocket);

        if (!playerIn.capabilities.isCreativeMode)
        {
            --stack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:ItemFirework.java

示例3: onItemUse

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    if (!playerIn.isRemote)
    {
        ItemStack itemstack = stack.getHeldItem(pos);
        EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(playerIn, (double)((float)worldIn.getX() + facing), (double)((float)worldIn.getY() + hitX), (double)((float)worldIn.getZ() + hitY), itemstack);
        playerIn.spawnEntityInWorld(entityfireworkrocket);

        if (!stack.capabilities.isCreativeMode)
        {
            itemstack.func_190918_g(1);
        }
    }

    return EnumActionResult.SUCCESS;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:ItemFirework.java

示例4: onItemRightClick

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    if (worldIn.isElytraFlying())
    {
        ItemStack itemstack = worldIn.getHeldItem(playerIn);

        if (!itemStackIn.isRemote)
        {
            EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(itemStackIn, itemstack, worldIn);
            itemStackIn.spawnEntityInWorld(entityfireworkrocket);

            if (!worldIn.capabilities.isCreativeMode)
            {
                itemstack.func_190918_g(1);
            }
        }

        return new ActionResult(EnumActionResult.SUCCESS, worldIn.getHeldItem(playerIn));
    }
    else
    {
        return new ActionResult(EnumActionResult.PASS, worldIn.getHeldItem(playerIn));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:ItemFirework.java

示例5: onItemUse

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    if (!worldIn.isRemote)
    {
        EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(worldIn, (double)((float)pos.getX() + hitX), (double)((float)pos.getY() + hitY), (double)((float)pos.getZ() + hitZ), stack);
        worldIn.spawnEntityInWorld(entityfireworkrocket);

        if (!playerIn.capabilities.isCreativeMode)
        {
            --stack.stackSize;
        }
    }

    return EnumActionResult.SUCCESS;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:ItemFirework.java

示例6: startFireworks

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
public static void startFireworks(Entity entity)
{
	//ItemStack stack = new ItemStack(Items.firework_charge);	// Used to give fireworks something to blow up with, it seems

	//stack.setTagCompound(new NBTTagCompound());

	//NBTTagCompound nbttagcompound = stack.getTagCompound();
	//nbttagcompound.setTag("Fireworks", new NBTTagCompound());

	//nbttagcompound.getCompoundTag("Fireworks").setByte("Flight", (byte) 15);

	// SFX
	EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(entity.worldObj, entity.posX, entity.posY, entity.posZ, null);
	entity.worldObj.spawnEntityInWorld(entityfireworkrocket);

	// Sound
	entity.worldObj.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, entity.posX, entity.posY - 0.3D, entity.posZ, new Random().nextGaussian() * 0.05D, -entity.motionY * 0.5D, new Random().nextGaussian() * 0.05D, new int[0]);
}
 
开发者ID:Domochevsky,项目名称:minecraft-territorialdealings,代码行数:19,代码来源:Main.java

示例7: afterAttack

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
@Override
public void afterAttack(EntityLivingBase attacker, List<EntityLivingBase> entities, float damage, ItemStack stack, AttackData attackData, UpgradeData value) {
	NBTTagCompound batData = BatHelper.getBatData(stack);
	if(batData.hasKey(NBT_FIREWORK)){
		ItemStack fireW = new ItemStack(Items.FIREWORKS);
   		fireW.setTagCompound(batData.getCompoundTag(NBT_FIREWORK));
   		for(Entity entity : entities){
    		EntityFireworkRocket rocket = new EntityFireworkRocket(attacker.getEntityWorld(), (entity.posX), (entity.posY)+entity.height/2, (entity.posZ), fireW);
    		
    		if(!attacker.getEntityWorld().isRemote){
    			attacker.getEntityWorld().spawnEntity(rocket);
    			attacker.getEntityWorld().setEntityState(rocket, (byte)17);
    			rocket.setDead();
    		}
   		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:18,代码来源:FireworkBatUpgrade.java

示例8: CraftFirework

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
public CraftFirework(CraftServer server, EntityFireworkRocket entity) {
    super(server, entity);

    ItemStack item = getHandle().getDataWatcher().getWatchableObjectItemStack(FIREWORK_ITEM_INDEX);

    if (item == null) {
        item = new ItemStack(Items.fireworks);
        getHandle().getDataWatcher().updateObject(FIREWORK_ITEM_INDEX, item);
    }

    this.item = CraftItemStack.asCraftMirror(item);

    // Ensure the item is a firework...
    if (this.item.getType() != Material.FIREWORK) {
        this.item.setType(Material.FIREWORK);
    }
}
 
开发者ID:CyberdyneCC,项目名称:ThermosRebased,代码行数:18,代码来源:CraftFirework.java

示例9: handleStatusUpdate

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
@Patch.Exception
@Hook("net.minecraft.entity.item.EntityFireworkRocket#func_70103_a")
public static Hook.Result handleStatusUpdate(EntityFireworkRocket rocket, byte id) {
	if (id == 17 && rocket.world.isRemote) {
           ItemStack item = rocket.getDataManager().get(EntityFireworkRocket.FIREWORK_ITEM);
           NBTTagCompound nbt = null;

           if (item != null && item.hasTagCompound()) {
           	nbt = item.getTagCompound().getCompoundTag("Fireworks");
           	if (item.getTagCompound().hasKey("display", NBT.TAG_COMPOUND))
           		nbt.setTag("display", item.getTagCompound().getTag("display"));
           }

           rocket.world.makeFireworks(rocket.posX, rocket.posY, rocket.posZ, rocket.motionX, rocket.motionY, rocket.motionZ, nbt);
       }
	return Hook.Result.NULL;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:18,代码来源:ExParticleFirework_Starter.java

示例10: prepare

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
/**
 * Create and initialize an {@link EntityFireworkRocket} from this object
 *
 * @return <tt>this</tt>
 */
public Firework prepare() {
	NBTTagCompound rocketEntityTag = new NBTTagCompound();
	NBTTagCompound rocketStackTag = new NBTTagCompound();
	NBTTagCompound explosionNBT = this.toNBT();
	ItemStack rocketStack = new ItemStack(Items.fireworks);
	rocketStack.writeToNBT(rocketStackTag);
	rocketStackTag.setTag("tag", explosionNBT);
	rocketStack.readFromNBT(rocketStackTag);
	EntityFireworkRocket rocketEntity = new EntityFireworkRocket(world, posX, posY, posZ, rocketStack);
	rocketEntity.writeToNBT(rocketEntityTag);
	rocketEntityTag.setInteger("LifeTime", this.lifetime);
	rocketEntity.readFromNBT(rocketEntityTag);
	rocket = rocketEntity;
	return this;
}
 
开发者ID:PrincessRTFM,项目名称:Coreder,代码行数:21,代码来源:Firework.java

示例11: onItemUse

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
/**
 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
 */
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
    if (!par3World.isClient)
    {
        EntityFireworkRocket var11 = new EntityFireworkRocket(par3World, (double)((float)par4 + par8), (double)((float)par5 + par9), (double)((float)par6 + par10), par1ItemStack);
        par3World.spawnEntityInWorld(var11);

        if (!par2EntityPlayer.capabilities.isCreativeMode)
        {
            --par1ItemStack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:24,代码来源:ItemFirework.java

示例12: launch

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
public Object[] launch(final World world, double x, double y, double z) {
    final ItemStack firework = rocketBuffer.getNextItemStack();
    if (firework != null) {
        final EntityFireworkRocket rocket = new EntityFireworkRocket(world, x + xOffset, y + yOffset, z + zOffset, firework);

        TickHandler.addTickCallback(world, new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                world.spawnEntityInWorld(rocket);
                coolDownActive = true;
                return null;
            }
        });
        return new Object[]{true};
    }
    return new Object[]{false, "no firework to launch"};
}
 
开发者ID:theoriginalbit,项目名称:MoarPeripherals,代码行数:18,代码来源:LauncherTube.java

示例13: onItemUse

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
    if (!p_77648_3_.isRemote)
    {
        EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(p_77648_3_, (double)((float)p_77648_4_ + p_77648_8_), (double)((float)p_77648_5_ + p_77648_9_), (double)((float)p_77648_6_ + p_77648_10_), p_77648_1_);
        p_77648_3_.spawnEntityInWorld(entityfireworkrocket);

        if (!p_77648_2_.capabilities.isCreativeMode)
        {
            --p_77648_1_.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:20,代码来源:ItemFirework.java

示例14: onItemUse

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
/**
 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
 */
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
    if (!par3World.isRemote)
    {
        EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(par3World, (double)((float)par4 + par8), (double)((float)par5 + par9), (double)((float)par6 + par10), par1ItemStack);
        par3World.spawnEntityInWorld(entityfireworkrocket);

        if (!par2EntityPlayer.capabilities.isCreativeMode)
        {
            --par1ItemStack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:24,代码来源:ItemFirework.java

示例15: spawnFirework

import net.minecraft.entity.item.EntityFireworkRocket; //导入依赖的package包/类
public static void spawnFirework(World world, double x, double y, double z){
    ItemStack rocket = new ItemStack(Items.fireworks);

    ItemStack itemstack1 = getFireworkCharge();

    NBTTagCompound nbttagcompound = new NBTTagCompound();
    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
    NBTTagList nbttaglist = new NBTTagList();

    if(itemstack1 != null && itemstack1.getItem() == Items.firework_charge && itemstack1.hasTagCompound() && itemstack1.getTagCompound().hasKey("Explosion")) {
        nbttaglist.appendTag(itemstack1.getTagCompound().getCompoundTag("Explosion"));
    }

    nbttagcompound1.setTag("Explosions", nbttaglist);
    nbttagcompound1.setByte("Flight", (byte)2);
    nbttagcompound.setTag("Fireworks", nbttagcompound1);

    rocket.setTagCompound(nbttagcompound);

    EntityFireworkRocket entity = new EntityFireworkRocket(world, x, y, z, rocket);
    world.spawnEntityInWorld(entity);
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:23,代码来源:DateEventHandler.java


注:本文中的net.minecraft.entity.item.EntityFireworkRocket类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。