Java 类net.minecraft.tileentity.TileEntityBanner 实例源码

项目:DecompiledMinecraft    文件:RecipesBanners.java   
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.stackSize = 1;
            return itemstack1;
        }
    }

    return null;
}
项目:DecompiledMinecraft    文件:RecipesBanners.java   
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
    ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];

    for (int i = 0; i < aitemstack.length; ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null)
        {
            if (itemstack.getItem().hasContainerItem())
            {
                aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
            }
            else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
            {
                aitemstack[i] = itemstack.copy();
                aitemstack[i].stackSize = 1;
            }
        }
    }

    return aitemstack;
}
项目:DecompiledMinecraft    文件:BlockBanner.java   
/**
 * Spawns this Block's drops into the World as EntityItems.
 */
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBanner)
    {
        ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        tileentity.writeToNBT(nbttagcompound);
        nbttagcompound.removeTag("x");
        nbttagcompound.removeTag("y");
        nbttagcompound.removeTag("z");
        nbttagcompound.removeTag("id");
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
    }
}
项目:DecompiledMinecraft    文件:BlockBanner.java   
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
    if (te instanceof TileEntityBanner)
    {
        TileEntityBanner tileentitybanner = (TileEntityBanner)te;
        ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        TileEntityBanner.func_181020_a(nbttagcompound, tileentitybanner.getBaseColor(), tileentitybanner.func_181021_d());
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.harvestBlock(worldIn, player, pos, state, (TileEntity)null);
    }
}
项目:DecompiledMinecraft    文件:ItemBanner.java   
/**
 * allows items to add custom lines of information to the mouseover description
 */
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);

    if (nbttagcompound != null && nbttagcompound.hasKey("Patterns"))
    {
        NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);

        for (int i = 0; i < nbttaglist.tagCount() && i < 6; ++i)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
            EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(nbttagcompound1.getInteger("Color"));
            TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern"));

            if (tileentitybanner$enumbannerpattern != null)
            {
                tooltip.add(StatCollector.translateToLocal("item.banner." + tileentitybanner$enumbannerpattern.getPatternName() + "." + enumdyecolor.getUnlocalizedName()));
            }
        }
    }
}
项目:DecompiledMinecraft    文件:RecipesBanners.java   
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.stackSize = 1;
            return itemstack1;
        }
    }

    return null;
}
项目:DecompiledMinecraft    文件:RecipesBanners.java   
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
    ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];

    for (int i = 0; i < aitemstack.length; ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null)
        {
            if (itemstack.getItem().hasContainerItem())
            {
                aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
            }
            else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
            {
                aitemstack[i] = itemstack.copy();
                aitemstack[i].stackSize = 1;
            }
        }
    }

    return aitemstack;
}
项目:DecompiledMinecraft    文件:BlockBanner.java   
/**
 * Spawns this Block's drops into the World as EntityItems.
 */
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBanner)
    {
        ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        tileentity.writeToNBT(nbttagcompound);
        nbttagcompound.removeTag("x");
        nbttagcompound.removeTag("y");
        nbttagcompound.removeTag("z");
        nbttagcompound.removeTag("id");
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
    }
}
项目:DecompiledMinecraft    文件:BlockBanner.java   
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
    if (te instanceof TileEntityBanner)
    {
        TileEntityBanner tileentitybanner = (TileEntityBanner)te;
        ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        TileEntityBanner.func_181020_a(nbttagcompound, tileentitybanner.getBaseColor(), tileentitybanner.func_181021_d());
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.harvestBlock(worldIn, player, pos, state, (TileEntity)null);
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
    }
}
项目:DecompiledMinecraft    文件:TileEntityRendererDispatcher.java   
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
项目:BaseClient    文件:ItemBanner.java   
/**
 * allows items to add custom lines of information to the mouseover description
 */
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);

    if (nbttagcompound != null && nbttagcompound.hasKey("Patterns"))
    {
        NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);

        for (int i = 0; i < nbttaglist.tagCount() && i < 6; ++i)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
            EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(nbttagcompound1.getInteger("Color"));
            TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern"));

            if (tileentitybanner$enumbannerpattern != null)
            {
                tooltip.add(StatCollector.translateToLocal("item.banner." + tileentitybanner$enumbannerpattern.getPatternName() + "." + enumdyecolor.getUnlocalizedName()));
            }
        }
    }
}
项目:BaseClient    文件:RecipesBanners.java   
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.stackSize = 1;
            return itemstack1;
        }
    }

    return null;
}
项目:BaseClient    文件:RecipesBanners.java   
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
    ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];

    for (int i = 0; i < aitemstack.length; ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null)
        {
            if (itemstack.getItem().hasContainerItem())
            {
                aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
            }
            else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
            {
                aitemstack[i] = itemstack.copy();
                aitemstack[i].stackSize = 1;
            }
        }
    }

    return aitemstack;
}
项目:BaseClient    文件:BlockBanner.java   
/**
 * Spawns this Block's drops into the World as EntityItems.
 */
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBanner)
    {
        ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        tileentity.writeToNBT(nbttagcompound);
        nbttagcompound.removeTag("x");
        nbttagcompound.removeTag("y");
        nbttagcompound.removeTag("z");
        nbttagcompound.removeTag("id");
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
    }
}
项目:BaseClient    文件:BlockBanner.java   
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
    if (te instanceof TileEntityBanner)
    {
        TileEntityBanner tileentitybanner = (TileEntityBanner)te;
        ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        TileEntityBanner.func_181020_a(nbttagcompound, tileentitybanner.getBaseColor(), tileentitybanner.func_181021_d());
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.harvestBlock(worldIn, player, pos, state, (TileEntity)null);
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
    }
}
项目:BaseClient    文件:TileEntityRendererDispatcher.java   
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
项目:BaseClient    文件:ItemBanner.java   
/**
 * allows items to add custom lines of information to the mouseover description
 */
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);

    if (nbttagcompound != null && nbttagcompound.hasKey("Patterns"))
    {
        NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);

        for (int i = 0; i < nbttaglist.tagCount() && i < 6; ++i)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
            EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(nbttagcompound1.getInteger("Color"));
            TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern"));

            if (tileentitybanner$enumbannerpattern != null)
            {
                tooltip.add(StatCollector.translateToLocal("item.banner." + tileentitybanner$enumbannerpattern.getPatternName() + "." + enumdyecolor.getUnlocalizedName()));
            }
        }
    }
}
项目:BaseClient    文件:RecipesBanners.java   
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.stackSize = 1;
            return itemstack1;
        }
    }

    return null;
}
项目:BaseClient    文件:RecipesBanners.java   
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
    ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];

    for (int i = 0; i < aitemstack.length; ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null)
        {
            if (itemstack.getItem().hasContainerItem())
            {
                aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
            }
            else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
            {
                aitemstack[i] = itemstack.copy();
                aitemstack[i].stackSize = 1;
            }
        }
    }

    return aitemstack;
}
项目:BaseClient    文件:BlockBanner.java   
/**
 * Spawns this Block's drops into the World as EntityItems.
 */
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBanner)
    {
        ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        tileentity.writeToNBT(nbttagcompound);
        nbttagcompound.removeTag("x");
        nbttagcompound.removeTag("y");
        nbttagcompound.removeTag("z");
        nbttagcompound.removeTag("id");
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
    }
}
项目:BaseClient    文件:BlockBanner.java   
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
    if (te instanceof TileEntityBanner)
    {
        TileEntityBanner tileentitybanner = (TileEntityBanner)te;
        ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        TileEntityBanner.func_181020_a(nbttagcompound, tileentitybanner.getBaseColor(), tileentitybanner.func_181021_d());
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.harvestBlock(worldIn, player, pos, state, (TileEntity)null);
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following
 * entitytypes: Mob spawners, command blocks, beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) {
        TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();

        if (i == 1 && tileentity instanceof TileEntityMobSpawner
                || i == 2 && tileentity instanceof TileEntityCommandBlock
                || i == 3 && tileentity instanceof TileEntityBeacon
                || i == 4 && tileentity instanceof TileEntitySkull
                || i == 5 && tileentity instanceof TileEntityFlowerPot
                || i == 6 && tileentity instanceof TileEntityBanner) {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
    }
}
项目:BaseClient    文件:TileEntityRendererDispatcher.java   
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:Backmemed    文件:RecipesBanners.java   
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (!itemstack.func_190926_b() && TileEntityBanner.getPatterns(itemstack) > 0)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.func_190920_e(1);
            return itemstack1;
        }
    }

    return ItemStack.field_190927_a;
}
项目:Backmemed    文件:RecipesBanners.java   
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
    NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);

    for (int i = 0; i < nonnulllist.size(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (!itemstack.func_190926_b())
        {
            if (itemstack.getItem().hasContainerItem())
            {
                nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
            }
            else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
            {
                ItemStack itemstack1 = itemstack.copy();
                itemstack1.func_190920_e(1);
                nonnulllist.set(i, itemstack1);
            }
        }
    }

    return nonnulllist;
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
 * beacons, skulls, flowerpot
 */
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
    {
        TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
        int i = packetIn.getTileEntityType();
        boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;

        if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
        {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }

        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
        {
            ((GuiCommandBlock)this.gameController.currentScreen).updateGui();
        }
    }
}
项目:Backmemed    文件:TileEntityRendererDispatcher.java   
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());
    this.mapSpecialRenderers.put(TileEntityShulkerBox.class, new TileEntityShulkerBoxRenderer(new ModelShulker()));

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}
项目:Mods    文件:TF2EventsCommon.java   
@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);
            }
        }
    }
}
项目:Mods    文件:TF2EventsCommon.java   
public static List<BannerPattern> getPatterns(TileEntityBanner banner){
    List<BannerPattern> patterns = new ArrayList<>();
       patterns.add(BannerPattern.BASE);
       NBTTagList patternsnbt = banner.writeToNBT(new NBTTagCompound()).getTagList("Patterns", 10);
       for (int i = 0; i < patternsnbt.tagCount(); ++i)
       {
           NBTTagCompound nbttagcompound = patternsnbt.getCompoundTagAt(i);
           for(BannerPattern pattern:BannerPattern.values()) {
            if (pattern.getHashname().equals(nbttagcompound.getString("Pattern")))
            {
                patterns.add(pattern);
                break;
            }
           }
       }
       return patterns;
}
项目:Mods    文件:EntityTF2Character.java   
public boolean detectBanner(){
    Iterator<BlockPos> iterator=this.world.getCapability(TF2weapons.WORLD_CAP, null).banners.iterator();
    while(iterator.hasNext()){
        BlockPos pos=iterator.next();
        if(pos.distanceSq(this.getPosition())<1200){
            TileEntity banner=this.world.getTileEntity(pos);
            if(banner != null && banner instanceof TileEntityBanner){
                boolean fast=false;
                for(BannerPattern pattern: TF2EventsCommon.getPatterns((TileEntityBanner)banner)){
                    if(pattern==TF2weapons.redPattern)
                        this.bannerTeam=0;
                    else if(pattern==TF2weapons.bluPattern)
                        this.bannerTeam=1;
                    else if(pattern==TF2weapons.fastSpawn)
                        fast=true;
                }
                return fast && pos.distanceSq(this.getPosition())<512;
            }
            else{
                iterator.remove();
                return false;
            }
        }
    }
    return false;
}
项目:CustomWorldGen    文件:ItemBanner.java   
@SideOnly(Side.CLIENT)
public static void appendHoverTextFromTileEntityTag(ItemStack stack, List<String> p_185054_1_)
{
    NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);

    if (nbttagcompound != null && nbttagcompound.hasKey("Patterns"))
    {
        NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10);

        for (int i = 0; i < nbttaglist.tagCount() && i < 6; ++i)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
            EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(nbttagcompound1.getInteger("Color"));
            TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern"));

            if (tileentitybanner$enumbannerpattern != null)
            {
                p_185054_1_.add(I18n.translateToLocal("item.banner." + tileentitybanner$enumbannerpattern.getPatternName() + "." + enumdyecolor.getUnlocalizedName()));
            }
        }
    }
}
项目:CustomWorldGen    文件:RecipesBanners.java   
/**
 * Returns an Item that is the result of this recipe
 */
@Nullable
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0)
        {
            ItemStack itemstack1 = itemstack.copy();
            itemstack1.stackSize = 1;
            return itemstack1;
        }
    }

    return null;
}
项目:CustomWorldGen    文件:RecipesBanners.java   
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
    ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];

    for (int i = 0; i < aitemstack.length; ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null)
        {
            if (itemstack.getItem().hasContainerItem(itemstack))
            {
                aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
            }
            else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
            {
                aitemstack[i] = itemstack.copy();
                aitemstack[i].stackSize = 1;
            }
        }
    }

    return aitemstack;
}
项目:CustomWorldGen    文件:BlockBanner.java   
@Nullable
private ItemStack getTileDataItemStack(World worldIn, BlockPos pos, IBlockState state)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBanner)
    {
        ItemStack itemstack = new ItemStack(Items.BANNER, 1, ((TileEntityBanner)tileentity).getBaseColor());
        NBTTagCompound nbttagcompound = tileentity.writeToNBT(new NBTTagCompound());
        nbttagcompound.removeTag("x");
        nbttagcompound.removeTag("y");
        nbttagcompound.removeTag("z");
        nbttagcompound.removeTag("id");
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        return itemstack;
    }
    else
    {
        return null;
    }
}
项目:CustomWorldGen    文件:BlockBanner.java   
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack)
{
    if (te instanceof TileEntityBanner)
    {
        TileEntityBanner tileentitybanner = (TileEntityBanner)te;
        ItemStack itemstack = new ItemStack(Items.BANNER, 1, ((TileEntityBanner)te).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, tileentitybanner.getBaseColor(), tileentitybanner.getPatterns());
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.harvestBlock(worldIn, player, pos, state, (TileEntity)null, stack);
    }
}
项目:CustomWorldGen    文件:BlockBanner.java   
@Override
public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
    TileEntity te = world.getTileEntity(pos);

    java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
    if (te instanceof TileEntityBanner)
    {
        TileEntityBanner banner = (TileEntityBanner)te;
        ItemStack item = new ItemStack(Items.BANNER, 1, banner.getBaseColor());
        NBTTagCompound nbt = new NBTTagCompound();
        TileEntityBanner.setBaseColorAndPatterns(nbt, banner.getBaseColor(), banner.getPatterns());
        item.setTagInfo("BlockEntityTag", nbt);
        ret.add(item);
    }
    else
    {
        ret.add(new ItemStack(Items.BANNER, 1, 0));
    }
    return ret;
}
项目:CustomWorldGen    文件:TileEntityRendererDispatcher.java   
private TileEntityRendererDispatcher()
{
    this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
    this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
    this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
    this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer());
    this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer());
    this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer());
    this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer());
    this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
    this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer());
    this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
    this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer());

    for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
    {
        tileentityspecialrenderer.setRendererDispatcher(this);
    }
}