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

Java ItemBanner类代码示例

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

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



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

示例1: setItemValues

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
public void setItemValues(ItemStack stack, boolean p_175112_2_)
{
    this.patterns = null;
    NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag");

    if (nbttagcompound != null && nbttagcompound.hasKey("Patterns", 9))
    {
        this.patterns = nbttagcompound.getTagList("Patterns", 10).copy();
    }

    this.baseColor = p_175112_2_ ? func_190616_d(stack) : ItemBanner.getBaseColor(stack);
    this.patternList = null;
    this.colorList = null;
    this.patternResourceLocation = "";
    this.patternDataSet = true;
    this.field_190617_a = stack.hasDisplayName() ? stack.getDisplayName() : null;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:TileEntityBanner.java


示例2: craftItem

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void craftItem(net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemCraftedEvent event) {
	ItemStack withPattern=ItemStack.EMPTY;
	ItemStack noPattern=ItemStack.EMPTY;
	for(int i=0; i<event.craftMatrix.getSizeInventory();i++){
		ItemStack stack=event.craftMatrix.getStackInSlot(i);
		if(!stack.isEmpty() && stack.getItem() instanceof ItemBanner){
			if(TileEntityBanner.getPatterns(stack)>0){
				withPattern=stack;
			}
			else{
				noPattern=stack;
			}
			if(!withPattern.isEmpty()&&!noPattern.isEmpty()){
				withPattern.shrink(1);
			}
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:20,代码来源:TF2EventsCommon.java


示例3: addRecipes

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
/**
 * Adds the banner recipes to the CraftingManager.
 */
void addRecipes(CraftingManager manager)
{
    for (EnumDyeColor enumdyecolor : EnumDyeColor.values())
    {
        manager.addRecipe(ItemBanner.func_190910_a(enumdyecolor, (NBTTagList)null), new Object[] {"###", "###", " | ", '#', new ItemStack(Blocks.WOOL, 1, enumdyecolor.getMetadata()), '|', Items.STICK});
    }

    manager.addRecipe(new RecipesBanners.RecipeDuplicatePattern());
    manager.addRecipe(new RecipesBanners.RecipeAddPattern());
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:RecipesBanners.java


示例4: func_190615_l

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
public ItemStack func_190615_l()
{
    ItemStack itemstack = ItemBanner.func_190910_a(this.baseColor, this.patterns);

    if (this.hasCustomName())
    {
        itemstack.setStackDisplayName(this.getName());
    }

    return itemstack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:TileEntityBanner.java


示例5: getReplacement

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
public static ItemStack getReplacement(EntityPlayer player, ItemStack stack) {
	if (!stack.isEmpty() && stack.getItem() instanceof ItemBuildingBox
			&& player.getTeam() == player.world.getScoreboard().getTeam("BLU"))
		stack.setItemDamage(stack.getItemDamage() + 1);
	if (!stack.isEmpty() && stack.getItem() instanceof ItemBanner){
		NBTTagCompound pattern=new NBTTagCompound();
		if(player.getTeam() == player.world.getScoreboard().getTeam("BLU")){
			stack.setItemDamage(EnumDyeColor.BLUE.getDyeDamage());
			pattern.setString("Pattern", "bb");
			pattern.setInteger("Color", 15);
		}
		else{
			pattern.setString("Pattern", "rb");
			pattern.setInteger("Color", 15);
		}
		
		stack.getSubCompound("BlockEntityTag").getTagList("Patterns", 10).appendTag(pattern);
	}
	if (!stack.isEmpty() && stack.getItem() instanceof ItemBuildingBox && stack.getItemDamage()/2 == 11) {
		ItemStack wrench=TF2Util.getFirstItem(player.inventory, stackL ->{
			return TF2Attribute.getModifier("Teleporter Cost", stackL, 1, player) != 1;
		});
		if(!wrench.isEmpty()) {
			stack.setCount((int) TF2Attribute.getModifier("Teleporter Cost", wrench, 1, player));
		}
	}
	return stack;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:29,代码来源:ContainerTF2Workbench.java


示例6: isSameBanner

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
public static boolean isSameBanner(ItemStack banner, Entity bannerHolder)
{
    if(bannerHolder instanceof EntityLivingBase) {
        ItemStack helmet = ((EntityLivingBase) bannerHolder).getItemStackFromSlot(EntityEquipmentSlot.HEAD);
        if(!helmet.isEmpty() && helmet.getItem() instanceof ItemBanner)
        {
            return isSameBanner(banner,helmet);
        }
    }

    return false;
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:13,代码来源:BannerUtil.java


示例7: checkSupposedPoweredState

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
private boolean checkSupposedPoweredState()
{
    final ItemStack filter = bannerInventory.getStackInSlot(0);

    IBlockState blockState = world.getBlockState(pos);
    EnumFacing facing = blockState.getValue(BlockBannerDetector.FACING);

    boolean detected = false;
    BlockPos lastPos = null;

    if(!filter.isEmpty() && filter.getItem() instanceof ItemBanner) {
        for (int i = 1; i <= maxdist; i++) {
            BlockPos nextPos = new BlockPos(pos.offset(facing, i));
            lastPos = nextPos;

            if (world.isBlockLoaded(nextPos)) {
                IBlockState nextState = world.getBlockState(nextPos);
                if (nextState.isOpaqueCube()) break;
                detected = checkBanner(nextPos,filter,BlockBanner.class);
                if(!detected) detected = checkBanner(nextPos.up(), filter, BlockBanner.BlockBannerHanging.class);
                if(!detected) detected = checkBanner(nextPos.down(), filter, BlockBanner.BlockBannerStanding.class);

                if(detected) break;
            }
        }

        if (!detected && maxdist > 0) {
            List<Entity> entityList = world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.pos, lastPos.add(1,1,1)), new Predicate<Entity>() {
                @Override
                public boolean apply(Entity input) {
                    return BannerUtil.isSameBanner(filter, input);
                }
            });
            detected = entityList != null && entityList.size() > 0;
        }
    }

    return detected;
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:40,代码来源:TileEntityBannerDetector.java


示例8: removeDye

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
private boolean removeDye(World world, BlockPos pos, EntityPlayer player, EnumHand hand, @Nonnull ItemStack stack, TileFluidTank tank) {
    IFluidHandler handler = FluidUtil.getFluidHandler(world, pos, null);
    if (handler == null) return false;
    if (tank.getFluid() != null && tank.getFluid().getFluid() == FluidRegistry.WATER && tank.getFluidAmount() >= 250) {
        if (stack.getItem() instanceof ItemArmor && ((ItemArmor) stack.getItem()).hasColor(stack)) {
            if (!world.isRemote) {
                ((ItemArmor) stack.getItem()).removeColor(stack);
                player.addStat(StatList.ARMOR_CLEANED);
                handler.drain(250, true);
            }
            player.playSound(SoundEvents.ENTITY_BOBBER_SPLASH, 0.16F, 0.66F);
            return true;
        }
        if (stack.getItem() instanceof ItemBanner) {
            if (TileEntityBanner.getPatterns(stack) > 0) {
                if (!world.isRemote) {
                    ItemStack banner = stack.copy();
                    banner.setCount(1);
                    TileEntityBanner.removeBannerData(banner);
                    player.addStat(StatList.BANNER_CLEANED);

                    if (!player.capabilities.isCreativeMode) {
                        stack.shrink(1);
                        handler.drain(250, true);
                    }
                    InventoryHandlerHelper.giveItem(player, hand, banner);
                }
                player.playSound(SoundEvents.ENTITY_BOBBER_SPLASH, 0.16F, 0.66F);
            }
            return true;
        }
    }
    return false;
}
 
开发者ID:GirafiStudios,项目名称:Culinary-Cultivation,代码行数:35,代码来源:BlockModCauldron.java


示例9: matches

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = ItemStack.field_190927_a;
    ItemStack itemstack1 = ItemStack.field_190927_a;

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack2 = inv.getStackInSlot(i);

        if (!itemstack2.func_190926_b())
        {
            if (itemstack2.getItem() != Items.BANNER)
            {
                return false;
            }

            if (!itemstack.func_190926_b() && !itemstack1.func_190926_b())
            {
                return false;
            }

            EnumDyeColor enumdyecolor = ItemBanner.getBaseColor(itemstack2);
            boolean flag = TileEntityBanner.getPatterns(itemstack2) > 0;

            if (!itemstack.func_190926_b())
            {
                if (flag)
                {
                    return false;
                }

                if (enumdyecolor != ItemBanner.getBaseColor(itemstack))
                {
                    return false;
                }

                itemstack1 = itemstack2;
            }
            else if (!itemstack1.func_190926_b())
            {
                if (!flag)
                {
                    return false;
                }

                if (enumdyecolor != ItemBanner.getBaseColor(itemstack1))
                {
                    return false;
                }

                itemstack = itemstack2;
            }
            else if (flag)
            {
                itemstack = itemstack2;
            }
            else
            {
                itemstack1 = itemstack2;
            }
        }
    }

    return !itemstack.func_190926_b() && !itemstack1.func_190926_b();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:66,代码来源:RecipesBanners.java


示例10: renderItem

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
public boolean renderItem(ItemStack displayItem){
	GlStateManager.pushMatrix();
	boolean itemBlock = false;	
	try
	{
		final ItemStack sis = displayItem;

		GlStateManager.disableRescaleNormal();
		IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(sis);
		
		if(sis.getItem() instanceof ItemBanner){
			GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
			GlStateManager.scale(0.5, 0.5, 0.5);
			GlStateManager.translate( 0.0f, (-0.14f*2)+0.1, 0 );
		}
		else if(sis.getItem() instanceof ItemBlock && model.isGui3d()){
			GlStateManager.scale(0.5, 0.5, 0.5);
			
			
			GlStateManager.scale(1, 1, 0.001F);
			GlStateManager.rotate(180, 0, 0, 1);
			GlStateManager.rotate(-210, 1, 0, 0);
			GlStateManager.rotate(45, 0, 1, 0);
			itemBlock = true;
		}else{
			GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
			GlStateManager.scale(0.4, 0.4, 0.4);
		}
		
		if (!Minecraft.getMinecraft().getRenderItem().shouldRenderItemIn3D(sis) || sis.getItem() instanceof ItemSkull)
           {
               GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
           }
		
		GlStateManager.translate( 0.0f, 0.14f, 0 );
		if(sis.getItem() instanceof net.minecraft.item.ItemMap){
			bindTexture(new ResourceLocation("textures/map/map_background.png"));
			MapData mapdata = Items.FILLED_MAP.getMapData(sis, CrystalMod.proxy.getClientWorld());

	        if (mapdata != null)
	        {
	        	GlStateManager.rotate(180, 0, 0, 1);
	        	GlStateManager.rotate(180, 0, 1, 0);
	        	GlStateManager.translate(-1, -0.9, 0);
	        	GlStateManager.scale(0.015625F, 0.015625F, 0.015625F);
	        	Minecraft.getMinecraft().entityRenderer.getMapItemRenderer().renderMap(mapdata, true);
	        }
		}else Minecraft.getMinecraft().getRenderItem().renderItem(sis, TransformType.GUI);
	}
	catch( final Exception e )
	{
		e.printStackTrace();
	}
	finally
	{
		GlStateManager.enableRescaleNormal();
	}
	GlStateManager.popMatrix();
	
	return itemBlock;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:62,代码来源:TileEntityPanelItemRenderer.java


示例11: onBlockActivated

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
@Beta
	@Override
	public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
			EnumFacing side, float hitX, float hitY, float hitZ) {
		TileEntityCauldron cauldron = getTileEntityCauldron(world, pos);
		ItemStack heldItem = player.getHeldItem(hand);
		CauldronActivatedEvent event;
		if (MinecraftForge.EVENT_BUS.post(event = new CauldronActivatedEvent(world, pos, state, player, hand, cauldron,
				heldItem, side, hitX, hitY, hitZ)))
			return event.getResult() == Result.DEFAULT;
		
		LinkedList<ItemStack> list = getTileEntityCauldron(world, pos).getContainer();
		if (heldItem == null) {
			if (Always.isServer()) {
				if (list.size() > 0) {
					player.setHeldItem(hand, list.removeLast());
					player.inventory.markDirty();
					cauldron.onContainerChange();
					cauldron.updateTracker();
				}
			}
		} else {
			int i = getWaterLevel(world, pos, state);
			Item item = heldItem.getItem();
			if (item == ModItems.botania$waterRod) {
//				if (i > -1 && i < 3 && ManaItemHandler.requestManaExact(heldItem, player, ItemWaterRod.COST, true))
//					setWaterLevel(world, pos, state, 3);
			} else if (FluidUtil.getFluidHandler(heldItem) != null) {
				FluidUtil.interactWithFluidHandler(player, hand, cauldron.getTank());
			} else if (!list.isEmpty()) {
				if (Always.isServer()) {
					boolean flag = false;
					int limit = heldItem.getMaxStackSize();
					if (heldItem.getCount() >= limit)
						return false;
					for (Iterator<ItemStack> iterator = list.iterator(); iterator.hasNext();) {
						ItemStack citem = iterator.next();
						if (InventoryHelper.canMergeItemStack(heldItem, citem))
							if (heldItem.getCount() < limit) {
								heldItem.setCount(heldItem.getCount() + 1);
								iterator.remove();
								flag = true;
							} else
								break;
					}
					if (flag) {
						player.inventory.markDirty();
						cauldron.onContainerChange();
						cauldron.updateTracker();
					}
				}
			} else {
				if (item instanceof ItemArmor) {
					if (i > 0) {
						ItemArmor armor = (ItemArmor) item;
						if (armor.getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER && armor.hasColor(heldItem)) {
							armor.removeColor(heldItem);
							player.addStat(StatList.ARMOR_CLEANED);
							setWaterLevel(world, pos, state, i - 1);
						}
					}
				} else if (item instanceof ItemBanner) {
					if (i > 0 && TileEntityBanner.getPatterns(heldItem) > 0) {
						ItemStack banner = heldItem.copy();
						banner.setCount(1);
						TileEntityBanner.removeBannerData(banner);
						InventoryHelper.addItemStackOrSetToHand(player, hand, heldItem, banner);
						player.addStat(StatList.BANNER_CLEANED);
						setWaterLevel(world, pos, state, i - 1);
					}
				}
			}
		}
		return true;
	}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:76,代码来源:PBlockCauldron.java


示例12: createBanner

import net.minecraft.item.ItemBanner; //导入依赖的package包/类
/**
 * Creates a new Banner ItemStack that has all of the patterns in the NBTTagList written to
 * it.
 *
 * @param baseColor The base color for the banner.
 * @param patterns The patterns to apply. This can be null if you want no patterns. See
 *        {@link #createPatternList(BannerLayer...)} for an easy way to make this.
 * @return The ItemStack that was created. All of the data is on the NBT.
 */
public static ItemStack createBanner (EnumDyeColor baseColor, NBTTagList patterns) {

    return ItemBanner.makeBanner(baseColor, patterns);
}
 
开发者ID:Darkhax-Minecraft,项目名称:AdditionalBanners,代码行数:14,代码来源:PatternHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java SwitchManagerCounters类代码示例发布时间:2022-05-22
下一篇:
Java DrainDispatcher类代码示例发布时间: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