• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ItemFireworkCharge类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onUpdate

import net.minecraft.item.ItemFireworkCharge; //导入依赖的package包/类
@Inject(method = "update", at = @At("RETURN"))
private void onUpdate(CallbackInfo callbackInfo) {
    if (!this.world.isRemote) {
        if (this.isBurning()) {
            ItemStack itemStack = this.furnaceItemStacks[0];
            if (itemStack != null) {
                if (itemStack.getItem() instanceof ItemBlock) {
                    Block block = ((ItemBlock) itemStack.getItem()).block;
                    if (block.getMaterial(block.getStateFromMeta(itemStack.getMetadata())) == Material.TNT) {
                        this.doExplosion();
                    }
                } else if (itemStack.getItem() == Items.GUNPOWDER) {
                    this.doExplosion();
                } else if (itemStack.getItem() instanceof ItemFirework || itemStack.getItem()
                        instanceof ItemFireworkCharge) {
                    this.doExplosion();
                }
            }
        }
    }
}
 
开发者ID:GoodTimeStudio,项目名称:Production-Line,代码行数:22,代码来源:MixinTileEntityFurnace.java


示例2: addInformation

import net.minecraft.item.ItemFireworkCharge; //导入依赖的package包/类
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn,List<String> tooltip, boolean advanced) {
	if (stack.hasTagCompound())
       {
           NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("Fireworks");

           if (nbttagcompound != null)
           {
               if (nbttagcompound.hasKey("Flight", 99))
               {
                   tooltip.add(I18n.translateToLocal("item.fireworks.flight") + " " + nbttagcompound.getByte("Flight"));
               }

               NBTTagList nbttaglist = nbttagcompound.getTagList("Explosions", 10);

               if (nbttaglist != null && !nbttaglist.hasNoTags())
               {
                       NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(1);
                       List<String> list = Lists.<String>newArrayList();
                       ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list);

                       if (!list.isEmpty())
                       {
                           for (int j = 1; j < ((List)list).size(); ++j)
                           {
                               list.set(j, "  " + list.get(j));
                           }

                           tooltip.addAll(list);
                       }
                   tooltip.add("Popcorn");
               }
           }
       }
   }
 
开发者ID:cleverpanda,项目名称:SimpleCorn,代码行数:36,代码来源:MyFireworkItem.java


示例3: func_77624_a

import net.minecraft.item.ItemFireworkCharge; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void func_77624_a(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
   if(p_77624_1_.func_77942_o()) {
      NBTTagCompound var5 = p_77624_1_.func_77978_p().func_74775_l("Fireworks");
      if(var5 != null) {
         if(var5.func_74764_b("Flight")) {
            p_77624_3_.add(StatCollector.func_74838_a("item.fireworks.flight") + " " + var5.func_74771_c("Flight"));
         }

         NBTTagList var6 = var5.func_74761_m("Explosions");
         if(var6 != null && var6.func_74745_c() > 0) {
            for(int var7 = 0; var7 < var6.func_74745_c(); ++var7) {
               NBTTagCompound var8 = (NBTTagCompound)var6.func_74743_b(var7);
               ArrayList var9 = new ArrayList();
               ItemFireworkCharge.func_92107_a(var8, var9);
               if(var9.size() > 0) {
                  for(int var10 = 1; var10 < var9.size(); ++var10) {
                     var9.set(var10, "  " + (String)var9.get(var10));
                  }

                  p_77624_3_.addAll(var9);
               }
            }
         }

      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:29,代码来源:ItemFirework.java


示例4: execute

import net.minecraft.item.ItemFireworkCharge; //导入依赖的package包/类
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
	Entity entity = params.length > 2 ? null : 
		isSenderOfEntityType(sender.getMinecraftISender(), Entity.class) ? 
		getSenderAsEntity(sender.getMinecraftISender(), Entity.class) : null;
	BlockPos spawn = null;
	
	if (params.length > 2)
		spawn = getCoordFromParams(sender.getMinecraftISender(), params, 0);
	else
		spawn = entity == null ? sender.getPosition() : EntityUtils.traceBlock(entity, 128.0D);
	
	if (spawn == null) 
		throw new CommandException("command.firework.notFound", sender);
	
	Random rand = new Random();
	RecipeFireworks recipe = (RecipeFireworks) CraftingManager.REGISTRY.getObject(new ResourceLocation("fireworks"));
	
	if (recipe != null) {
		InventoryCrafting inv = new InventoryCrafting(new Container()
	    {
	        public boolean canInteractWith(EntityPlayer playerIn) {return false;}
	    }, 3, 3);
		
		ItemStack dye;
		ItemStack output;
		
		do {
	        for (int i = 0; i < inv.getSizeInventory(); ++i) inv.setInventorySlotContents(i, null);
			
			dye = new ItemStack(Items.DYE, 1, rand.nextInt(MAX_DYE_TYPES));
			
			inv.setInventorySlotContents(0, dye);
			inv.setInventorySlotContents(1, new ItemStack(Items.GUNPOWDER));
			
			if (rand.nextBoolean())
				inv.setInventorySlotContents(2, new ItemStack(shapeModifiers.get(rand.nextInt(shapeModifiers.size()))));
			
			if (rand.nextBoolean())
				inv.setInventorySlotContents(3, new ItemStack(effectModifiers.get(rand.nextInt(effectModifiers.size()))));
		}
		while (!recipe.matches(inv, sender.getMinecraftISender().getEntityWorld()));
		
		output = recipe.getRecipeOutput();
			
		if (output.getItem() instanceof ItemFireworkCharge) {
			do {
				for (int i = 0; i < inv.getSizeInventory(); ++i) inv.setInventorySlotContents(i, null);
				
				inv.setInventorySlotContents(0, output);
				inv.setInventorySlotContents(1, new ItemStack(Items.PAPER));
				
				int gunpowder = rand.nextInt(MAX_GUNPOWDER);
				for (int i = 0; i < gunpowder; i++) inv.setInventorySlotContents(2 + i, new ItemStack(Items.GUNPOWDER));
			}
			while (!recipe.matches(inv, sender.getMinecraftISender().getEntityWorld()));
			
			output = recipe.getRecipeOutput();
			
			if (output.getItem() instanceof ItemFirework) {
				ItemFirework firework = (ItemFirework) output.getItem();
				
				EntityFireworkRocket rocket = new EntityFireworkRocket(sender.getWorld(), spawn.getX(), spawn.getY(), spawn.getZ(), output);;
				sender.getWorld().spawnEntity(rocket);
			}
		}
	}
	
	return null;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:71,代码来源:CommandFirework.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DebugLevel类代码示例发布时间:2022-05-22
下一篇:
Java ActionManagerImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap