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


Java BlockPattern.PatternHelper方法代码示例

本文整理汇总了Java中net.minecraft.block.state.pattern.BlockPattern.PatternHelper方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPattern.PatternHelper方法的具体用法?Java BlockPattern.PatternHelper怎么用?Java BlockPattern.PatternHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.state.pattern.BlockPattern的用法示例。


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

示例1: func_181015_d

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
public void func_181015_d(BlockPos p_181015_1_)
{
    if (this.timeUntilPortal > 0)
    {
        this.timeUntilPortal = this.getPortalCooldown();
    }
    else
    {
        if (!this.worldObj.isRemote && !p_181015_1_.equals(this.field_181016_an))
        {
            this.field_181016_an = p_181015_1_;
            BlockPattern.PatternHelper blockpattern$patternhelper = Blocks.portal.func_181089_f(this.worldObj, p_181015_1_);
            double d0 = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? (double)blockpattern$patternhelper.func_181117_a().getZ() : (double)blockpattern$patternhelper.func_181117_a().getX();
            double d1 = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? this.posZ : this.posX;
            d1 = Math.abs(MathHelper.func_181160_c(d1 - (double)(blockpattern$patternhelper.getFinger().rotateY().getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE ? 1 : 0), d0, d0 - (double)blockpattern$patternhelper.func_181118_d()));
            double d2 = MathHelper.func_181160_c(this.posY - 1.0D, (double)blockpattern$patternhelper.func_181117_a().getY(), (double)(blockpattern$patternhelper.func_181117_a().getY() - blockpattern$patternhelper.func_181119_e()));
            this.field_181017_ao = new Vec3(d1, d2, 0.0D);
            this.field_181018_ap = blockpattern$patternhelper.getFinger();
        }

        this.inPortal = true;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:Entity.java

示例2: setPortal

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
/**
 * Marks the entity as being inside a portal, activating teleportation logic in onEntityUpdate() in the following
 * tick(s).
 */
public void setPortal(BlockPos pos)
{
    if (this.timeUntilPortal > 0)
    {
        this.timeUntilPortal = this.getPortalCooldown();
    }
    else
    {
        if (!this.world.isRemote && !pos.equals(this.lastPortalPos))
        {
            this.lastPortalPos = new BlockPos(pos);
            BlockPattern.PatternHelper blockpattern$patternhelper = Blocks.PORTAL.createPatternHelper(this.world, this.lastPortalPos);
            double d0 = blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? (double)blockpattern$patternhelper.getFrontTopLeft().getZ() : (double)blockpattern$patternhelper.getFrontTopLeft().getX();
            double d1 = blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? this.posZ : this.posX;
            d1 = Math.abs(MathHelper.pct(d1 - (double)(blockpattern$patternhelper.getForwards().rotateY().getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE ? 1 : 0), d0, d0 - (double)blockpattern$patternhelper.getWidth()));
            double d2 = MathHelper.pct(this.posY - 1.0D, (double)blockpattern$patternhelper.getFrontTopLeft().getY(), (double)(blockpattern$patternhelper.getFrontTopLeft().getY() - blockpattern$patternhelper.getHeight()));
            this.lastPortalVec = new Vec3d(d1, d2, 0.0D);
            this.teleportDirection = blockpattern$patternhelper.getForwards();
        }

        this.inPortal = true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:28,代码来源:Entity.java

示例3: setPortal

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
/**
 * Marks the entity as being inside a portal, activating teleportation logic in onEntityUpdate() in the following
 * tick(s).
 */
public void setPortal(BlockPos pos)
{
    if (this.timeUntilPortal > 0)
    {
        this.timeUntilPortal = this.getPortalCooldown();
    }
    else
    {
        if (!this.worldObj.isRemote && !pos.equals(this.lastPortalPos))
        {
            this.lastPortalPos = new BlockPos(pos);
            BlockPattern.PatternHelper blockpattern$patternhelper = Blocks.PORTAL.createPatternHelper(this.worldObj, this.lastPortalPos);
            double d0 = blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? (double)blockpattern$patternhelper.getFrontTopLeft().getZ() : (double)blockpattern$patternhelper.getFrontTopLeft().getX();
            double d1 = blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? this.posZ : this.posX;
            d1 = Math.abs(MathHelper.pct(d1 - (double)(blockpattern$patternhelper.getForwards().rotateY().getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE ? 1 : 0), d0, d0 - (double)blockpattern$patternhelper.getWidth()));
            double d2 = MathHelper.pct(this.posY - 1.0D, (double)blockpattern$patternhelper.getFrontTopLeft().getY(), (double)(blockpattern$patternhelper.getFrontTopLeft().getY() - blockpattern$patternhelper.getHeight()));
            this.lastPortalVec = new Vec3d(d1, d2, 0.0D);
            this.teleportDirection = blockpattern$patternhelper.getForwards();
        }

        this.inPortal = true;
    }
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:28,代码来源:Entity.java

示例4: respawnDragon

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
private void respawnDragon(List<EntityEnderCrystal> crystalsIn)
{
    if (this.dragonKilled && this.respawnState == null)
    {
        for (BlockPattern.PatternHelper blockpattern$patternhelper = this.findExitPortal(); blockpattern$patternhelper != null; blockpattern$patternhelper = this.findExitPortal())
        {
            for (int i = 0; i < this.portalPattern.getPalmLength(); ++i)
            {
                for (int j = 0; j < this.portalPattern.getThumbLength(); ++j)
                {
                    for (int k = 0; k < this.portalPattern.getFingerLength(); ++k)
                    {
                        BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, k);

                        if (blockworldstate.getBlockState().getBlock() == Blocks.BEDROCK || blockworldstate.getBlockState().getBlock() == Blocks.END_PORTAL)
                        {
                            this.world.setBlockState(blockworldstate.getPos(), Blocks.END_STONE.getDefaultState());
                        }
                    }
                }
            }
        }

        this.respawnState = DragonSpawnManager.START;
        this.respawnStateTicks = 0;
        this.generatePortal(false);
        this.crystals = crystalsIn;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:DragonFightManager.java

示例5: func_181089_f

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
public BlockPattern.PatternHelper func_181089_f(World p_181089_1_, BlockPos p_181089_2_)
{
    EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
    BlockPortal.Size blockportal$size = new BlockPortal.Size(p_181089_1_, p_181089_2_, EnumFacing.Axis.X);
    LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.func_181627_a(p_181089_1_, true);

    if (!blockportal$size.func_150860_b())
    {
        enumfacing$axis = EnumFacing.Axis.X;
        blockportal$size = new BlockPortal.Size(p_181089_1_, p_181089_2_, EnumFacing.Axis.Z);
    }

    if (!blockportal$size.func_150860_b())
    {
        return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
    }
    else
    {
        int[] aint = new int[EnumFacing.AxisDirection.values().length];
        EnumFacing enumfacing = blockportal$size.field_150866_c.rotateYCCW();
        BlockPos blockpos = blockportal$size.field_150861_f.up(blockportal$size.func_181100_a() - 1);

        for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
        {
            BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1);

            for (int i = 0; i < blockportal$size.func_181101_b(); ++i)
            {
                for (int j = 0; j < blockportal$size.func_181100_a(); ++j)
                {
                    BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);

                    if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getBlock().getMaterial() != Material.air)
                    {
                        ++aint[enumfacing$axisdirection.ordinal()];
                    }
                }
            }
        }

        EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;

        for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
        {
            if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
            {
                enumfacing$axisdirection1 = enumfacing$axisdirection2;
            }
        }

        return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:54,代码来源:BlockPortal.java

示例6: createPatternHelper

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
public BlockPattern.PatternHelper createPatternHelper(World worldIn, BlockPos p_181089_2_)
{
    EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
    BlockPortal.Size blockportal$size = new BlockPortal.Size(worldIn, p_181089_2_, EnumFacing.Axis.X);
    LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.createLoadingCache(worldIn, true);

    if (!blockportal$size.isValid())
    {
        enumfacing$axis = EnumFacing.Axis.X;
        blockportal$size = new BlockPortal.Size(worldIn, p_181089_2_, EnumFacing.Axis.Z);
    }

    if (!blockportal$size.isValid())
    {
        return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
    }
    else
    {
        int[] aint = new int[EnumFacing.AxisDirection.values().length];
        EnumFacing enumfacing = blockportal$size.rightDir.rotateYCCW();
        BlockPos blockpos = blockportal$size.bottomLeft.up(blockportal$size.getHeight() - 1);

        for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
        {
            BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);

            for (int i = 0; i < blockportal$size.getWidth(); ++i)
            {
                for (int j = 0; j < blockportal$size.getHeight(); ++j)
                {
                    BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);

                    if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getMaterial() != Material.AIR)
                    {
                        ++aint[enumfacing$axisdirection.ordinal()];
                    }
                }
            }
        }

        EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;

        for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
        {
            if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
            {
                enumfacing$axisdirection1 = enumfacing$axisdirection2;
            }
        }

        return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:54,代码来源:BlockPortal.java

示例7: trySpawnGolem

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
private void trySpawnGolem(World worldIn, BlockPos pos)
{
    BlockPattern.PatternHelper blockpattern$patternhelper;

    if ((blockpattern$patternhelper = this.getSnowmanPattern().match(worldIn, pos)) != null)
    {
        for (int i = 0; i < this.getSnowmanPattern().getThumbLength(); ++i)
        {
            BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(0, i, 0);
            worldIn.setBlockState(blockworldstate.getPos(), Blocks.air.getDefaultState(), 2);
        }

        EntitySnowman entitysnowman = new EntitySnowman(worldIn);
        BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(0, 2, 0).getPos();
        entitysnowman.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.05D, (double)blockpos1.getZ() + 0.5D, 0.0F, 0.0F);
        worldIn.spawnEntityInWorld(entitysnowman);

        for (int j = 0; j < 120; ++j)
        {
            worldIn.spawnParticle(EnumParticleTypes.SNOW_SHOVEL, (double)blockpos1.getX() + worldIn.rand.nextDouble(), (double)blockpos1.getY() + worldIn.rand.nextDouble() * 2.5D, (double)blockpos1.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
        }

        for (int i1 = 0; i1 < this.getSnowmanPattern().getThumbLength(); ++i1)
        {
            BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(0, i1, 0);
            worldIn.notifyNeighborsRespectDebug(blockworldstate1.getPos(), Blocks.air);
        }
    }
    else if ((blockpattern$patternhelper = this.getGolemPattern().match(worldIn, pos)) != null)
    {
        for (int k = 0; k < this.getGolemPattern().getPalmLength(); ++k)
        {
            for (int l = 0; l < this.getGolemPattern().getThumbLength(); ++l)
            {
                worldIn.setBlockState(blockpattern$patternhelper.translateOffset(k, l, 0).getPos(), Blocks.air.getDefaultState(), 2);
            }
        }

        BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
        EntityIronGolem entityirongolem = new EntityIronGolem(worldIn);
        entityirongolem.setPlayerCreated(true);
        entityirongolem.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.05D, (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
        worldIn.spawnEntityInWorld(entityirongolem);

        for (int j1 = 0; j1 < 120; ++j1)
        {
            worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)blockpos.getY() + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
        }

        for (int k1 = 0; k1 < this.getGolemPattern().getPalmLength(); ++k1)
        {
            for (int l1 = 0; l1 < this.getGolemPattern().getThumbLength(); ++l1)
            {
                BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(k1, l1, 0);
                worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.air);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:60,代码来源:BlockPumpkin.java

示例8: checkWitherSpawn

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
public void checkWitherSpawn(World worldIn, BlockPos pos, TileEntitySkull te)
{
    if (te.getSkullType() == 1 && pos.getY() >= 2 && worldIn.getDifficulty() != EnumDifficulty.PEACEFUL && !worldIn.isRemote)
    {
        BlockPattern blockpattern = this.getWitherPattern();
        BlockPattern.PatternHelper blockpattern$patternhelper = blockpattern.match(worldIn, pos);

        if (blockpattern$patternhelper != null)
        {
            for (int i = 0; i < 3; ++i)
            {
                BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, 0, 0);
                worldIn.setBlockState(blockworldstate.getPos(), blockworldstate.getBlockState().withProperty(NODROP, Boolean.valueOf(true)), 2);
            }

            for (int j = 0; j < blockpattern.getPalmLength(); ++j)
            {
                for (int k = 0; k < blockpattern.getThumbLength(); ++k)
                {
                    BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(j, k, 0);
                    worldIn.setBlockState(blockworldstate1.getPos(), Blocks.air.getDefaultState(), 2);
                }
            }

            BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 0, 0).getPos();
            EntityWither entitywither = new EntityWither(worldIn);
            BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
            entitywither.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.55D, (double)blockpos1.getZ() + 0.5D, blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F, 0.0F);
            entitywither.renderYawOffset = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F;
            entitywither.func_82206_m();

            for (EntityPlayer entityplayer : worldIn.getEntitiesWithinAABB(EntityPlayer.class, entitywither.getEntityBoundingBox().expand(50.0D, 50.0D, 50.0D)))
            {
                entityplayer.triggerAchievement(AchievementList.spawnWither);
            }

            worldIn.spawnEntityInWorld(entitywither);

            for (int l = 0; l < 120; ++l)
            {
                worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)(blockpos.getY() - 2) + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
            }

            for (int i1 = 0; i1 < blockpattern.getPalmLength(); ++i1)
            {
                for (int j1 = 0; j1 < blockpattern.getThumbLength(); ++j1)
                {
                    BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(i1, j1, 0);
                    worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.air);
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:55,代码来源:BlockSkull.java

示例9: findExitPortal

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
@Nullable
private BlockPattern.PatternHelper findExitPortal()
{
    for (int i = -8; i <= 8; ++i)
    {
        for (int j = -8; j <= 8; ++j)
        {
            Chunk chunk = this.world.getChunkFromChunkCoords(i, j);

            for (TileEntity tileentity : chunk.getTileEntityMap().values())
            {
                if (tileentity instanceof TileEntityEndPortal)
                {
                    BlockPattern.PatternHelper blockpattern$patternhelper = this.portalPattern.match(this.world, tileentity.getPos());

                    if (blockpattern$patternhelper != null)
                    {
                        BlockPos blockpos = blockpattern$patternhelper.translateOffset(3, 3, 3).getPos();

                        if (this.exitPortalLocation == null && blockpos.getX() == 0 && blockpos.getZ() == 0)
                        {
                            this.exitPortalLocation = blockpos;
                        }

                        return blockpattern$patternhelper;
                    }
                }
            }
        }
    }

    int k = this.world.getHeight(WorldGenEndPodium.END_PODIUM_LOCATION).getY();

    for (int l = k; l >= 0; --l)
    {
        BlockPattern.PatternHelper blockpattern$patternhelper1 = this.portalPattern.match(this.world, new BlockPos(WorldGenEndPodium.END_PODIUM_LOCATION.getX(), l, WorldGenEndPodium.END_PODIUM_LOCATION.getZ()));

        if (blockpattern$patternhelper1 != null)
        {
            if (this.exitPortalLocation == null)
            {
                this.exitPortalLocation = blockpattern$patternhelper1.translateOffset(3, 3, 3).getPos();
            }

            return blockpattern$patternhelper1;
        }
    }

    return null;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:51,代码来源:DragonFightManager.java

示例10: onItemUse

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的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)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (playerIn.canPlayerEdit(pos.offset(facing), facing, stack) && iblockstate.getBlock() == Blocks.END_PORTAL_FRAME && !((Boolean)iblockstate.getValue(BlockEndPortalFrame.EYE)).booleanValue())
    {
        if (worldIn.isRemote)
        {
            return EnumActionResult.SUCCESS;
        }
        else
        {
            worldIn.setBlockState(pos, iblockstate.withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(true)), 2);
            worldIn.updateComparatorOutputLevel(pos, Blocks.END_PORTAL_FRAME);
            --stack.stackSize;

            for (int i = 0; i < 16; ++i)
            {
                double d0 = (double)((float)pos.getX() + (5.0F + itemRand.nextFloat() * 6.0F) / 16.0F);
                double d1 = (double)((float)pos.getY() + 0.8125F);
                double d2 = (double)((float)pos.getZ() + (5.0F + itemRand.nextFloat() * 6.0F) / 16.0F);
                double d3 = 0.0D;
                double d4 = 0.0D;
                double d5 = 0.0D;
                worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
            }

            BlockPattern.PatternHelper blockpattern$patternhelper = BlockEndPortalFrame.getOrCreatePortalShape().match(worldIn, pos);

            if (blockpattern$patternhelper != null)
            {
                BlockPos blockpos = blockpattern$patternhelper.getFrontTopLeft().add(-3, 0, -3);

                for (int j = 0; j < 3; ++j)
                {
                    for (int k = 0; k < 3; ++k)
                    {
                        worldIn.setBlockState(blockpos.add(j, 0, k), Blocks.END_PORTAL.getDefaultState(), 2);
                    }
                }
            }

            return EnumActionResult.SUCCESS;
        }
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:54,代码来源:ItemEnderEye.java

示例11: checkWitherSpawn

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
public void checkWitherSpawn(World worldIn, BlockPos pos, TileEntitySkull te)
{
    if (te.getSkullType() == 1 && pos.getY() >= 2 && worldIn.getDifficulty() != EnumDifficulty.PEACEFUL && !worldIn.isRemote)
    {
        BlockPattern blockpattern = this.getWitherPattern();
        BlockPattern.PatternHelper blockpattern$patternhelper = blockpattern.match(worldIn, pos);

        if (blockpattern$patternhelper != null)
        {
            for (int i = 0; i < 3; ++i)
            {
                BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, 0, 0);
                worldIn.setBlockState(blockworldstate.getPos(), blockworldstate.getBlockState().withProperty(NODROP, Boolean.valueOf(true)), 2);
            }

            for (int j = 0; j < blockpattern.getPalmLength(); ++j)
            {
                for (int k = 0; k < blockpattern.getThumbLength(); ++k)
                {
                    BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(j, k, 0);
                    worldIn.setBlockState(blockworldstate1.getPos(), Blocks.AIR.getDefaultState(), 2);
                }
            }

            BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 0, 0).getPos();
            EntityWither entitywither = new EntityWither(worldIn);
            BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
            entitywither.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.55D, (double)blockpos1.getZ() + 0.5D, blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F, 0.0F);
            entitywither.renderYawOffset = blockpattern$patternhelper.getForwards().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F;
            entitywither.ignite();

            for (EntityPlayer entityplayer : worldIn.getEntitiesWithinAABB(EntityPlayer.class, entitywither.getEntityBoundingBox().expandXyz(50.0D)))
            {
                entityplayer.addStat(AchievementList.SPAWN_WITHER);
            }

            worldIn.spawnEntityInWorld(entitywither);

            for (int l = 0; l < 120; ++l)
            {
                worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)(blockpos.getY() - 2) + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
            }

            for (int i1 = 0; i1 < blockpattern.getPalmLength(); ++i1)
            {
                for (int j1 = 0; j1 < blockpattern.getThumbLength(); ++j1)
                {
                    BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(i1, j1, 0);
                    worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.AIR);
                }
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:55,代码来源:BlockSkull.java

示例12: trySpawnGolem

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
private void trySpawnGolem(World worldIn, BlockPos pos)
{
    BlockPattern.PatternHelper blockpattern$patternhelper = this.getSnowmanPattern().match(worldIn, pos);

    if (blockpattern$patternhelper != null)
    {
        for (int i = 0; i < this.getSnowmanPattern().getThumbLength(); ++i)
        {
            BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(0, i, 0);
            worldIn.setBlockState(blockworldstate.getPos(), Blocks.AIR.getDefaultState(), 2);
        }

        EntitySnowman entitysnowman = new EntitySnowman(worldIn);
        BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(0, 2, 0).getPos();
        entitysnowman.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.05D, (double)blockpos1.getZ() + 0.5D, 0.0F, 0.0F);
        worldIn.spawnEntityInWorld(entitysnowman);

        for (int j = 0; j < 120; ++j)
        {
            worldIn.spawnParticle(EnumParticleTypes.SNOW_SHOVEL, (double)blockpos1.getX() + worldIn.rand.nextDouble(), (double)blockpos1.getY() + worldIn.rand.nextDouble() * 2.5D, (double)blockpos1.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
        }

        for (int i1 = 0; i1 < this.getSnowmanPattern().getThumbLength(); ++i1)
        {
            BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(0, i1, 0);
            worldIn.notifyNeighborsRespectDebug(blockworldstate1.getPos(), Blocks.AIR, false);
        }
    }
    else
    {
        blockpattern$patternhelper = this.getGolemPattern().match(worldIn, pos);

        if (blockpattern$patternhelper != null)
        {
            for (int k = 0; k < this.getGolemPattern().getPalmLength(); ++k)
            {
                for (int l = 0; l < this.getGolemPattern().getThumbLength(); ++l)
                {
                    worldIn.setBlockState(blockpattern$patternhelper.translateOffset(k, l, 0).getPos(), Blocks.AIR.getDefaultState(), 2);
                }
            }

            BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos();
            EntityIronGolem entityirongolem = new EntityIronGolem(worldIn);
            entityirongolem.setPlayerCreated(true);
            entityirongolem.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.05D, (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F);
            worldIn.spawnEntityInWorld(entityirongolem);

            for (int j1 = 0; j1 < 120; ++j1)
            {
                worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)blockpos.getY() + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
            }

            for (int k1 = 0; k1 < this.getGolemPattern().getPalmLength(); ++k1)
            {
                for (int l1 = 0; l1 < this.getGolemPattern().getThumbLength(); ++l1)
                {
                    BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(k1, l1, 0);
                    worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.AIR, false);
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:65,代码来源:BlockPumpkin.java

示例13: createPatternHelper

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
@Override
public BlockPattern.PatternHelper createPatternHelper(World worldIn, BlockPos p_181089_2_)
{
    EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
    AetherPortalSize blockportal$size = new AetherPortalSize(worldIn, p_181089_2_, EnumFacing.Axis.X);
    LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.createLoadingCache(worldIn, true);

    if (!blockportal$size.isValid())
    {
        enumfacing$axis = EnumFacing.Axis.X;
        blockportal$size = new AetherPortalSize(worldIn, p_181089_2_, EnumFacing.Axis.Z);
    }

    if (!blockportal$size.isValid())
    {
        return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
    }
    else
    {
        int[] aint = new int[EnumFacing.AxisDirection.values().length];
        EnumFacing enumfacing = blockportal$size.rightDir.rotateYCCW();
        BlockPos blockpos = blockportal$size.bottomLeft.up(blockportal$size.getHeight() - 1);

        for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
        {
            BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);

            for (int i = 0; i < blockportal$size.getWidth(); ++i)
            {
                for (int j = 0; j < blockportal$size.getHeight(); ++j)
                {
                    BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);

                    if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getMaterial() != Material.AIR)
                    {
                        ++aint[enumfacing$axisdirection.ordinal()];
                    }
                }
            }
        }

        EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;

        for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
        {
            if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
            {
                enumfacing$axisdirection1 = enumfacing$axisdirection2;
            }
        }

        return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1), EnumFacing.getFacingFromAxis(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
    }
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:55,代码来源:BlockAetherPortal.java

示例14: createPatternHelper

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
public BlockPattern.PatternHelper createPatternHelper(World worldIn, BlockPos p_181089_2_) {
	EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
	BlockAbstractPortal.Size blockportal$size = getSizer(worldIn, p_181089_2_, EnumFacing.Axis.X);
	LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.createLoadingCache(worldIn, true);

	if (!blockportal$size.isValid()) {
		enumfacing$axis = EnumFacing.Axis.X;
		blockportal$size = getSizer(worldIn, p_181089_2_, EnumFacing.Axis.Z);
	}

	if (!blockportal$size.isValid()) {
		return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
	} else {
		int[] aint = new int[EnumFacing.AxisDirection.values().length];
		EnumFacing enumfacing = blockportal$size.rightDir.rotateYCCW();
		BlockPos blockpos = blockportal$size.bottomLeft.up(blockportal$size.getHeight() - 1);

		for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values()) {
			BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(
					enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos
							: blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1),
					EnumFacing.getFacingFromAxis(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache,
					blockportal$size.getWidth(), blockportal$size.getHeight(), 1);

			for (int i = 0; i < blockportal$size.getWidth(); ++i) {
				for (int j = 0; j < blockportal$size.getHeight(); ++j) {
					BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);

					if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getMaterial() != Material.AIR) {
						++aint[enumfacing$axisdirection.ordinal()];
					}
				}
			}
		}

		EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;

		for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values()) {
			if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()]) {
				enumfacing$axisdirection1 = enumfacing$axisdirection2;
			}
		}

		return new BlockPattern.PatternHelper(
				enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos
						: blockpos.offset(blockportal$size.rightDir, blockportal$size.getWidth() - 1),
				EnumFacing.getFacingFromAxis(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache,
				blockportal$size.getWidth(), blockportal$size.getHeight(), 1);
	}
}
 
开发者ID:ToroCraft,项目名称:TeleToro,代码行数:51,代码来源:BlockAbstractPortal.java

示例15: trySpawnGolem

import net.minecraft.block.state.pattern.BlockPattern; //导入方法依赖的package包/类
private void trySpawnGolem(World worldIn, BlockPos pos)
{
	BlockPattern.PatternHelper patternhelper;
	int i;
	int j;

	if ((patternhelper = this.getSnowmanPattern().match(worldIn, pos)) != null)
	{
		for (i = 0; i < this.getSnowmanPattern().getThumbLength(); ++i)
		{
			BlockWorldState blockworldstate = patternhelper.translateOffset(0, i, 0);
			worldIn.setBlockState(blockworldstate.getPos(), Blocks.air.getDefaultState(), 2);
		}

		EntitySnowman entitysnowman = new EntitySnowman(worldIn);
		BlockPos blockpos2 = patternhelper.translateOffset(0, 2, 0).getPos();
		entitysnowman.setLocationAndAngles((double) blockpos2.getX() + 0.5D, (double) blockpos2.getY() + 0.05D,
		                                   (double) blockpos2.getZ() + 0.5D, 0.0F, 0.0F);
		worldIn.spawnEntityInWorld(entitysnowman);

		for (j = 0; j < 120; ++j)
		{
			worldIn
				.spawnParticle(EnumParticleTypes.SNOW_SHOVEL, (double) blockpos2.getX() + worldIn.rand.nextDouble(),
				               (double) blockpos2.getY() + worldIn.rand.nextDouble() * 2.5D,
				               (double) blockpos2.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
		}

		for (j = 0; j < this.getSnowmanPattern().getThumbLength(); ++j)
		{
			BlockWorldState blockworldstate1 = patternhelper.translateOffset(0, j, 0);
			worldIn.notifyNeighborsRespectDebug(blockworldstate1.getPos(), Blocks.air);
		}
	}
	else if ((patternhelper = this.getGolemPattern().match(worldIn, pos)) != null)
	{
		for (i = 0; i < this.getGolemPattern().getPalmLength(); ++i)
		{
			for (int k = 0; k < this.getGolemPattern().getThumbLength(); ++k)
			{
				worldIn.setBlockState(patternhelper.translateOffset(i, k, 0).getPos(), Blocks.air.getDefaultState(),
				                      2);
			}
		}

		BlockPos blockpos1 = patternhelper.translateOffset(1, 2, 0).getPos();
		EntityIronGolem entityirongolem = new EntityIronGolem(worldIn);
		entityirongolem.setPlayerCreated(true);
		entityirongolem.setLocationAndAngles((double) blockpos1.getX() + 0.5D, (double) blockpos1.getY() + 0.05D,
		                                     (double) blockpos1.getZ() + 0.5D, 0.0F, 0.0F);
		worldIn.spawnEntityInWorld(entityirongolem);

		for (j = 0; j < 120; ++j)
		{
			worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double) blockpos1.getX() + worldIn.rand.nextDouble(),
			                      (double) blockpos1.getY() + worldIn.rand.nextDouble() * 3.9D,
			                      (double) blockpos1.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
		}

		for (j = 0; j < this.getGolemPattern().getPalmLength(); ++j)
		{
			for (int l = 0; l < this.getGolemPattern().getThumbLength(); ++l)
			{
				BlockWorldState blockworldstate2 = patternhelper.translateOffset(j, l, 0);
				worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.air);
			}
		}
	}
}
 
开发者ID:MinestrapTeam,项目名称:Minestrappolation-4,代码行数:70,代码来源:BlockCarvedPumpkin.java


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