當前位置: 首頁>>代碼示例>>Java>>正文


Java World.scheduleBlockUpdate方法代碼示例

本文整理匯總了Java中net.minecraft.world.World.scheduleBlockUpdate方法的典型用法代碼示例。如果您正苦於以下問題:Java World.scheduleBlockUpdate方法的具體用法?Java World.scheduleBlockUpdate怎麽用?Java World.scheduleBlockUpdate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.world.World的用法示例。


在下文中一共展示了World.scheduleBlockUpdate方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateTick

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
	if (world.isRemote)
		return;

	int surroundingBlockCount = 0;
	for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
		Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
		if (block == this || block == Blocks.ice || block == Blocks.packed_ice)
			if (++surroundingBlockCount >= 4)
				break;
	}

	if (surroundingBlockCount < 4 || rand.nextInt(100) <= 33) {
		int meta = world.getBlockMetadata(x, y, z);
		if (meta < 3)
			world.setBlockMetadataWithNotify(x, y, z, meta + 1, 2);
		else
			world.setBlock(x, y, z, Blocks.water);
	}

	world.scheduleBlockUpdate(x, y, z, this, 40 + rand.nextInt(40));
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:24,代碼來源:FrostedIce.java

示例2: onEntityWalk

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) {
	if (worldIn.getBlockState(pos) == this.getStateFromMeta(0)) {
		notifyChange(worldIn, pos, worldIn.getBlockState(pos), 1, true);
		worldIn.scheduleBlockUpdate(pos, this, 20, 2);
	}
	super.onEntityWalk(worldIn, pos, entityIn);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:9,代碼來源:HarshenDimensionalPlate.java

示例3: updateTick

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	if (state == this.getStateFromMeta(1))
		if (worldIn.getEntitiesWithinAABB(EntityLivingBase.class,
				new AxisAlignedBB(pos.add(0, 1, 0), pos.add(1, 2, 1))).isEmpty())
			notifyChange(worldIn, pos, state, 0, false);
		else
			worldIn.scheduleBlockUpdate(pos, this, 20, 2);
	super.updateTick(worldIn, pos, state, rand);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:11,代碼來源:HarshenDimensionalPlate.java

示例4: updateTick

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	isTicking = true;
	List<Entity> playersWithin = worldIn.getEntitiesWithinAABB(EntityPlayer.class, new  AxisAlignedBB(pos, pos.add(1, 1, 1)));
	if(!playersWithin.isEmpty())
		for(Object player: playersWithin.toArray())
			((EntityPlayer)player).addPotionEffect(new PotionEffect(Potion.getPotionById(9), 200));
	this.world = worldIn;
	this.pos = pos;
	worldIn.scheduleBlockUpdate(pos, this, 10, 3);
	if(world != null && pos != null)
		if (world instanceof WorldServer)
			((WorldServer)world).spawnParticle(EnumParticleTypes.CLOUD, false, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 7,  0.3, 0.2, 0.3, 0, new int[EnumParticleTypes.CLOUD.getArgumentCount()]);
	super.updateTick(worldIn, pos, state, rand);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:16,代碼來源:SoulReminder.java

示例5: onBlockAdded

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void onBlockAdded(World world, int x, int y, int z) {
	if (world.isRemote)
		return;

	world.scheduleBlockUpdate(x, y, z, this, 40 + world.rand.nextInt(40));
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:8,代碼來源:FrostedIce.java

示例6: onBlockAdded

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
	worldIn.scheduleBlockUpdate(pos, this, 10, 3);
	super.onBlockAdded(worldIn, pos, state);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:6,代碼來源:SoulReminder.java

示例7: loadEntities

import net.minecraft.world.World; //導入方法依賴的package包/類
public void loadEntities(World worldIn, NBTTagCompound compound, Chunk chunk)
{
    NBTTagList nbttaglist1 = compound.getTagList("Entities", 10);

    if (nbttaglist1 != null)
    {
        for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(j1);
            readChunkEntity(nbttagcompound1, worldIn, chunk);
            chunk.setHasEntities(true);
        }
    }

    NBTTagList nbttaglist2 = compound.getTagList("TileEntities", 10);

    if (nbttaglist2 != null)
    {
        for (int k1 = 0; k1 < nbttaglist2.tagCount(); ++k1)
        {
            NBTTagCompound nbttagcompound2 = nbttaglist2.getCompoundTagAt(k1);
            TileEntity tileentity = TileEntity.create(worldIn, nbttagcompound2);

            if (tileentity != null)
            {
                chunk.addTileEntity(tileentity);
            }
        }
    }

    if (compound.hasKey("TileTicks", 9))
    {
        NBTTagList nbttaglist3 = compound.getTagList("TileTicks", 10);

        if (nbttaglist3 != null)
        {
            for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1)
            {
                NBTTagCompound nbttagcompound3 = nbttaglist3.getCompoundTagAt(l1);
                Block block;

                if (nbttagcompound3.hasKey("i", 8))
                {
                    block = Block.getBlockFromName(nbttagcompound3.getString("i"));
                }
                else
                {
                    block = Block.getBlockById(nbttagcompound3.getInteger("i"));
                }

                worldIn.scheduleBlockUpdate(new BlockPos(nbttagcompound3.getInteger("x"), nbttagcompound3.getInteger("y"), nbttagcompound3.getInteger("z")), block, nbttagcompound3.getInteger("t"), nbttagcompound3.getInteger("p"));
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:56,代碼來源:AnvilChunkLoader.java


注:本文中的net.minecraft.world.World.scheduleBlockUpdate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。