Java 类net.minecraft.block.BlockShulkerBox 实例源码

项目:Toms-Mod    文件:ItemIgnoreList.java   
public static boolean accepts(ICraftable c) {
    if (c == null)
        return false;
    if (c instanceof StoredItemStack) {
        StoredItemStack stack = (StoredItemStack) c;
        if (stack.getStack() == null)
            return false;
        ItemStack stackS = stack.getStack();
        Item item = stackS.getItem();
        if (Block.getBlockFromItem(item) != Blocks.AIR) {
            Block b = Block.getBlockFromItem(item);
            if (b == StorageInit.drive) {
                return !stackS.hasTagCompound() || !stackS.getTagCompound().getBoolean("stored");
            } else if (b instanceof BlockShulkerBox) { return !stackS.hasTagCompound() ? true : stackS.getTagCompound().getCompoundTag("BlockEntityTag").hasNoTags(); }
        }
        if (item == StorageInit.itemStorageCell) { return !stackS.hasTagCompound() || stackS.getTagCompound().getTagList("data", 10).hasNoTags() || stackS.getTagCompound().getTagList("inventory", 10).hasNoTags(); }
        for (int i = 0;i < ignoredItemStacks.size();i++) {
            ItemStack s = ignoredItemStacks.get(i);
            if (areItemsEqual(s, stackS))
                return false;
        }
    }
    return true;
}
项目:EndermanEvolution    文件:ChestUtils.java   
public static List<BlockShulkerBox> getShulkerBoxes() {
    if (SHULKER_BOXES.isEmpty()) {
        for (EnumDyeColor color : EnumDyeColor.values()) {
            SHULKER_BOXES.add((BlockShulkerBox) BlockShulkerBox.getBlockByColor(color));
        }
    }
    return SHULKER_BOXES;
}
项目:Backmemed    文件:Bootstrap.java   
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    Block block = Block.getBlockFromItem(stack.getItem());
    World world = source.getWorld();
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    BlockPos blockpos = source.getBlockPos().offset(enumfacing);
    this.field_190911_b = world.func_190527_a(block, blockpos, false, EnumFacing.DOWN, (Entity)null);

    if (this.field_190911_b)
    {
        EnumFacing enumfacing1 = world.isAirBlock(blockpos.down()) ? enumfacing : EnumFacing.UP;
        IBlockState iblockstate = block.getDefaultState().withProperty(BlockShulkerBox.field_190957_a, enumfacing1);
        world.setBlockState(blockpos, iblockstate);
        TileEntity tileentity = world.getTileEntity(blockpos);
        ItemStack itemstack = stack.splitStack(1);

        if (itemstack.hasTagCompound())
        {
            ((TileEntityShulkerBox)tileentity).func_190586_e(itemstack.getTagCompound().getCompoundTag("BlockEntityTag"));
        }

        if (itemstack.hasDisplayName())
        {
            ((TileEntityShulkerBox)tileentity).func_190575_a(itemstack.getDisplayName());
        }

        world.updateComparatorOutputLevel(blockpos, iblockstate.getBlock());
    }

    return stack;
}
项目:Backmemed    文件:ShulkerBoxRecipes.java   
public boolean matches(InventoryCrafting inv, World worldIn)
{
    int i = 0;
    int j = 0;

    for (int k = 0; k < inv.getSizeInventory(); ++k)
    {
        ItemStack itemstack = inv.getStackInSlot(k);

        if (!itemstack.func_190926_b())
        {
            if (Block.getBlockFromItem(itemstack.getItem()) instanceof BlockShulkerBox)
            {
                ++i;
            }
            else
            {
                if (itemstack.getItem() != Items.DYE)
                {
                    return false;
                }

                ++j;
            }

            if (j > 1 || i > 1)
            {
                return false;
            }
        }
    }

    return i == 1 && j == 1;
}
项目:Backmemed    文件:ShulkerBoxRecipes.java   
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    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 (Block.getBlockFromItem(itemstack2.getItem()) instanceof BlockShulkerBox)
            {
                itemstack = itemstack2;
            }
            else if (itemstack2.getItem() == Items.DYE)
            {
                itemstack1 = itemstack2;
            }
        }
    }

    ItemStack itemstack3 = BlockShulkerBox.func_190953_b(EnumDyeColor.byDyeDamage(itemstack1.getMetadata()));

    if (itemstack.hasTagCompound())
    {
        itemstack3.setTagCompound(itemstack.getTagCompound().copy());
    }

    return itemstack3;
}
项目:Backmemed    文件:TileEntityShulkerBox.java   
public EnumDyeColor func_190592_s()
{
    if (this.field_190602_l == null)
    {
        this.field_190602_l = BlockShulkerBox.func_190954_c(this.getBlockType());
    }

    return this.field_190602_l;
}
项目:EndermanEvolution    文件:LayerHeldBlock3.java   
@Override
public void doRenderLayer(EntityFrienderman frienderman, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    IBlockState iblockstate = frienderman.getHeldBlockState();
    ItemStack stack = frienderman.getHeldItemStack();

    if (iblockstate != null) {
        if (iblockstate.getBlock() == Blocks.RED_FLOWER) {
            GlStateManager.enableRescaleNormal();
            GlStateManager.pushMatrix();
            GlStateManager.translate(-0.04F, 0.6875F + -0.085F, -1.0F);
            GlStateManager.rotate(220.0F, 1.0F, 0.0F, 0.0F);
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            Minecraft.getMinecraft().getItemRenderer().renderItem(frienderman, new ItemStack(Blocks.RED_FLOWER), ItemCameraTransforms.TransformType.NONE);
            GlStateManager.popMatrix();
            GlStateManager.disableRescaleNormal();
        }
        else {
            BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
            GlStateManager.enableRescaleNormal();
            GlStateManager.pushMatrix();
            GlStateManager.translate(0.0F, 0.6875F, -0.75F);
            GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F);
            GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
            GlStateManager.translate(0.25F, 0.1875F, 0.25F);
            GlStateManager.scale(-0.5F, -0.5F, 0.5F);
            int i = frienderman.getBrightnessForRender();
            int j = i % 65536;
            int k = i / 65536;
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j, k);
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            endermanRenderer.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            blockrendererdispatcher.renderBlockBrightness(iblockstate, 1.0F);
            GlStateManager.popMatrix();
            GlStateManager.disableRescaleNormal();
        }
    }
    else if (!stack.isEmpty()) {
        if (frienderman.deathTime > 0) {
            return;
        }
        GlStateManager.pushMatrix();
        GlStateManager.translate(-0.25F, 0.6875F, -0.75F);
        GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.translate(0.6F, 0.1F, -0.25F);
        GlStateManager.scale(-0.7F, -0.7F, 0.7F);
        if (Mods.ENDERSTORAGE.isLoaded() && frienderman.isHoldingEnderStorageChest()) {
            EnderStorage.renderItemChest(stack, -frienderman.getLidAngle());
        }
        else if (frienderman.isHoldingVanillaChest()) {
            ChestType type = null;
            switch (frienderman.getVanillaChestType()) {
            case ENDER:
                type = ChestType.ENDER;
                break;
            case NORMAL:
                type = ChestType.NORMAL;
                break;
            case TRAPPED:
            default:
                type = ChestType.TRAPPED;
                break;
            }
            CustomChestRenderer.renderChest(type, -frienderman.getLidAngle());
        }
        else if (frienderman.isHoldingVanillaShulkerBox()) {
            CustomChestRenderer.renderShulkerBox(BlockShulkerBox.getColorFromItem(stack.getItem()).getMetadata(), frienderman.getLidAngle());
        }
        else if (frienderman.isHoldingIronChest()) {
            IronChests.renderChest(stack, -frienderman.getLidAngle());
        }
        else if (frienderman.isHoldingIronShulkerBox()) {
            IronChests.renderShulkerBox(stack, frienderman.getLidAngle());
        }
        else {
            RenderUtils.getRenderItem().renderItem(stack, RenderUtils.getMesher().getItemModel(stack));
        }
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.popMatrix();
    }
}
项目:EndermanEvolution    文件:ChestUtils.java   
public static boolean isVanillaShulkerBox(Block block) {
    return block instanceof BlockShulkerBox && getShulkerBoxes().contains(block);
}
项目:Backmemed    文件:ShulkerBoxRecipes.java   
void func_190935_a(CraftingManager p_190935_1_)
{
    p_190935_1_.addRecipe(BlockShulkerBox.func_190953_b(EntityShulker.field_190771_bx), new Object[] {"-", "#", "-", '-', Items.field_190930_cZ, '#', Blocks.CHEST});
    p_190935_1_.addRecipe(new ShulkerBoxRecipes.ShulkerBoxColoring());
}
项目:Backmemed    文件:SlotShulkerBox.java   
/**
 * Check if the stack is allowed to be placed in this slot, used for armor slots as well as furnace fuel.
 */
public boolean isItemValid(ItemStack stack)
{
    return !(Block.getBlockFromItem(stack.getItem()) instanceof BlockShulkerBox);
}
项目:Backmemed    文件:TileEntityItemStackRenderer.java   
public void renderByItem(ItemStack itemStackIn)
{
    Item item = itemStackIn.getItem();

    if (item == Items.BANNER)
    {
        this.banner.setItemValues(itemStackIn, false);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
    }
    else if (item == Items.SHIELD)
    {
        if (itemStackIn.getSubCompound("BlockEntityTag") != null)
        {
            this.banner.setItemValues(itemStackIn, true);
            Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_DESIGNS.getResourceLocation(this.banner.getPatternResourceLocation(), this.banner.getPatternList(), this.banner.getColorList()));
        }
        else
        {
            Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_BASE_TEXTURE);
        }

        GlStateManager.pushMatrix();
        GlStateManager.scale(1.0F, -1.0F, -1.0F);
        this.modelShield.render();
        GlStateManager.popMatrix();
    }
    else if (item == Items.SKULL)
    {
        GameProfile gameprofile = null;

        if (itemStackIn.hasTagCompound())
        {
            NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();

            if (nbttagcompound.hasKey("SkullOwner", 10))
            {
                gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
            }
            else if (nbttagcompound.hasKey("SkullOwner", 8) && !StringUtils.isBlank(nbttagcompound.getString("SkullOwner")))
            {
                GameProfile gameprofile1 = new GameProfile((UUID)null, nbttagcompound.getString("SkullOwner"));
                gameprofile = TileEntitySkull.updateGameprofile(gameprofile1);
                nbttagcompound.removeTag("SkullOwner");
                nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
            }
        }

        if (TileEntitySkullRenderer.instance != null)
        {
            GlStateManager.pushMatrix();
            GlStateManager.disableCull();
            TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, EnumFacing.UP, 180.0F, itemStackIn.getMetadata(), gameprofile, -1, 0.0F);
            GlStateManager.enableCull();
            GlStateManager.popMatrix();
        }
    }
    else if (item == Item.getItemFromBlock(Blocks.ENDER_CHEST))
    {
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.enderChest, 0.0D, 0.0D, 0.0D, 0.0F);
    }
    else if (item == Item.getItemFromBlock(Blocks.TRAPPED_CHEST))
    {
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chestTrap, 0.0D, 0.0D, 0.0D, 0.0F);
    }
    else if (Block.getBlockFromItem(item) instanceof BlockShulkerBox)
    {
        TileEntityRendererDispatcher.instance.renderTileEntityAt(field_191274_b[BlockShulkerBox.func_190955_b(item).getMetadata()], 0.0D, 0.0D, 0.0D, 0.0F);
    }
    else
    {
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chestBasic, 0.0D, 0.0D, 0.0D, 0.0F);
    }
}
项目:Backmemed    文件:TileEntityShulkerBox.java   
public AxisAlignedBB func_190584_a(IBlockState p_190584_1_)
{
    return this.func_190587_b((EnumFacing)p_190584_1_.getValue(BlockShulkerBox.field_190957_a));
}
项目:Backmemed    文件:TileEntityShulkerBox.java   
private void func_190589_G()
{
    IBlockState iblockstate = this.world.getBlockState(this.getPos());

    if (iblockstate.getBlock() instanceof BlockShulkerBox)
    {
        EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(BlockShulkerBox.field_190957_a);
        AxisAlignedBB axisalignedbb = this.func_190588_c(enumfacing).offset(this.pos);
        List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb);

        if (!list.isEmpty())
        {
            for (int i = 0; i < list.size(); ++i)
            {
                Entity entity = (Entity)list.get(i);

                if (entity.getPushReaction() != EnumPushReaction.IGNORE)
                {
                    double d0 = 0.0D;
                    double d1 = 0.0D;
                    double d2 = 0.0D;
                    AxisAlignedBB axisalignedbb1 = entity.getEntityBoundingBox();

                    switch (enumfacing.getAxis())
                    {
                        case X:
                            if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
                            {
                                d0 = axisalignedbb.maxX - axisalignedbb1.minX;
                            }
                            else
                            {
                                d0 = axisalignedbb1.maxX - axisalignedbb.minX;
                            }

                            d0 = d0 + 0.01D;
                            break;

                        case Y:
                            if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
                            {
                                d1 = axisalignedbb.maxY - axisalignedbb1.minY;
                            }
                            else
                            {
                                d1 = axisalignedbb1.maxY - axisalignedbb.minY;
                            }

                            d1 = d1 + 0.01D;
                            break;

                        case Z:
                            if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
                            {
                                d2 = axisalignedbb.maxZ - axisalignedbb1.minZ;
                            }
                            else
                            {
                                d2 = axisalignedbb1.maxZ - axisalignedbb.minZ;
                            }

                            d2 = d2 + 0.01D;
                    }

                    entity.moveEntity(MoverType.SHULKER_BOX, d0 * (double)enumfacing.getFrontOffsetX(), d1 * (double)enumfacing.getFrontOffsetY(), d2 * (double)enumfacing.getFrontOffsetZ());
                }
            }
        }
    }
}
项目:Backmemed    文件:TileEntityShulkerBox.java   
/**
 * Returns true if automation can insert the given item in the given slot from the given side.
 */
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction)
{
    return !(Block.getBlockFromItem(itemStackIn.getItem()) instanceof BlockShulkerBox);
}