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


Java World.getDifficulty方法代码示例

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


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

示例1: EntityLightningBolt

import net.minecraft.world.World; //导入方法依赖的package包/类
public EntityLightningBolt(World worldIn, double posX, double posY, double posZ)
{
    super(worldIn);
    this.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F);
    this.lightningState = 2;
    this.boltVertex = this.rand.nextLong();
    this.boltLivingTime = this.rand.nextInt(3) + 1;
    BlockPos blockpos = new BlockPos(this);

    if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doFireTick") && (worldIn.getDifficulty() == EnumDifficulty.NORMAL || worldIn.getDifficulty() == EnumDifficulty.HARD) && worldIn.isAreaLoaded(blockpos, 10))
    {
        if (worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air && Blocks.fire.canPlaceBlockAt(worldIn, blockpos))
        {
            worldIn.setBlockState(blockpos, Blocks.fire.getDefaultState());
        }

        for (int i = 0; i < 4; ++i)
        {
            BlockPos blockpos1 = blockpos.add(this.rand.nextInt(3) - 1, this.rand.nextInt(3) - 1, this.rand.nextInt(3) - 1);

            if (worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air && Blocks.fire.canPlaceBlockAt(worldIn, blockpos1))
            {
                worldIn.setBlockState(blockpos1, Blocks.fire.getDefaultState());
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:EntityLightningBolt.java

示例2: EntityLightningBolt

import net.minecraft.world.World; //导入方法依赖的package包/类
public EntityLightningBolt(World worldIn, double x, double y, double z, boolean effectOnlyIn)
{
    super(worldIn);
    this.setLocationAndAngles(x, y, z, 0.0F, 0.0F);
    this.lightningState = 2;
    this.boltVertex = this.rand.nextLong();
    this.boltLivingTime = this.rand.nextInt(3) + 1;
    this.effectOnly = effectOnlyIn;
    BlockPos blockpos = new BlockPos(this);

    if (!effectOnlyIn && !worldIn.isRemote && worldIn.getGameRules().getBoolean("doFireTick") && (worldIn.getDifficulty() == EnumDifficulty.NORMAL || worldIn.getDifficulty() == EnumDifficulty.HARD) && worldIn.isAreaLoaded(blockpos, 10))
    {
        if (worldIn.getBlockState(blockpos).getMaterial() == Material.AIR && Blocks.FIRE.canPlaceBlockAt(worldIn, blockpos))
        {
            worldIn.setBlockState(blockpos, Blocks.FIRE.getDefaultState());
        }

        for (int i = 0; i < 4; ++i)
        {
            BlockPos blockpos1 = blockpos.add(this.rand.nextInt(3) - 1, this.rand.nextInt(3) - 1, this.rand.nextInt(3) - 1);

            if (worldIn.getBlockState(blockpos1).getMaterial() == Material.AIR && Blocks.FIRE.canPlaceBlockAt(worldIn, blockpos1))
            {
                worldIn.setBlockState(blockpos1, Blocks.FIRE.getDefaultState());
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:EntityLightningBolt.java

示例3: attractMobs

import net.minecraft.world.World; //导入方法依赖的package包/类
public static void attractMobs(EntityLivingBase living, World world) {
	if (!world.isRemote && TF2ConfigVars.shootAttract && world.getDifficulty().getDifficultyId()>1) {
		
		int range=world.getDifficulty()==EnumDifficulty.HARD?60:38;
		for (EntityCreature mob : world.getEntitiesWithinAABB(EntityCreature.class,
				living.getEntityBoundingBox().grow(range, range, range), new Predicate<EntityCreature>() {

					@Override
					public boolean apply(EntityCreature input) {
						// TODO Auto-generated method stub
						return input.getAttackTarget() == null && (input instanceof IMob) && input.isNonBoss();
					}

				})) {
			mob.getLookHelper().setLookPositionWithEntity(mob, 60, 30);
			if (!TF2Util.isOnSameTeam(living, mob)) {
				if (mob.getEntitySenses().canSee(living) || mob.getDistanceSqToEntity(living)<150){
					mob.setAttackTarget(living);
					if(mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getModifier(FOLLOW_MODIFIER)==null)
						mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
					.applyModifier(new AttributeModifier(FOLLOW_MODIFIER, "Follow Check", 65-mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getAttributeValue(), 0));
					//mob.getNavigator().tryMoveToEntityLiving(living, 1.1f);
					
					mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).removeModifier(FOLLOW_MODIFIER);
				}
				
				// CoroUtilPath.tryMoveToEntityLivingLongDist((EntityCreature)mob,
				// living, 1.1D);
				;
			}

		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:35,代码来源:TF2Util.java

示例4: canDispenserPlace

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canDispenserPlace(World worldIn, BlockPos pos, ItemStack stack)
{
    return stack.getMetadata() == 1 && pos.getY() >= 2 && worldIn.getDifficulty() != EnumDifficulty.PEACEFUL && !worldIn.isRemote ? this.getWitherBasePattern().match(worldIn, pos) != null : false;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockSkull.java

示例5: checkWitherSpawn

import net.minecraft.world.World; //导入方法依赖的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

示例6: checkWitherSpawn

import net.minecraft.world.World; //导入方法依赖的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, false);
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:55,代码来源:BlockSkull.java

示例7: checkWitherSpawn

import net.minecraft.world.World; //导入方法依赖的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


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