Java Code Examples for net.minecraft.world.World#scheduleUpdate()
The following examples show how to use
net.minecraft.world.World#scheduleUpdate() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: CommunityMod File: BlockSoulGlass.java License: GNU Lesser General Public License v2.1 | 6 votes |
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { boolean powered = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(pos.up()); if (powered) { if(!state.getValue(POWERED)) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); worldIn.setBlockState(pos, state.withProperty(POWERED, true)); worldIn.playSound(null, pos, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.BLOCKS, 1F, 0.25F + worldIn.rand.nextFloat()); } } else { if(state.getValue(POWERED)) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); worldIn.setBlockState(pos, state.withProperty(POWERED, false)); worldIn.playSound(null, pos, SoundEvents.BLOCK_NOTE_BASEDRUM, SoundCategory.BLOCKS, 1F, 0.25F + worldIn.rand.nextFloat()); } } }
Example 2
Source Project: customstuff4 File: BlockButton.java License: GNU General Public License v3.0 | 6 votes |
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (state.getValue(POWERED)) { return true; } else { worldIn.setBlockState(pos, state.withProperty(POWERED, true), 3); worldIn.markBlockRangeForRenderUpdate(pos, pos); this.playClickSound(playerIn, worldIn, pos); this.notifyNeighbors(worldIn, pos, state.getValue(FACING)); worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); return true; } }
Example 3
Source Project: CommunityMod File: BlockSoulGlass.java License: GNU Lesser General Public License v2.1 | 5 votes |
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if(worldIn.isBlockPowered(pos)) { worldIn.scheduleUpdate(new BlockPos(pos), this, this.tickRate(worldIn)); worldIn.setBlockState(pos, state.withProperty(POWERED, true)); } }
Example 4
Source Project: CommunityMod File: BlockSmoulderingAsh.java License: GNU Lesser General Public License v2.1 | 5 votes |
@Override public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { if(worldIn.rand.nextInt(10) == 0) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); } super.onEntityWalk(worldIn, pos, entityIn); }
Example 5
Source Project: GT-Classic File: GTEventNeighborNotifyEvent.java License: GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public void onNeighborNotified(BlockEvent.NeighborNotifyEvent event) { World world = event.getWorld(); for (EnumFacing side : event.getNotifiedSides()) { BlockPos sidePos = event.getPos().offset(side); IBlockState sideState = world.getBlockState(sidePos); Block block = sideState.getBlock(); if (block.isLeaves(sideState, world, sidePos)) world.scheduleUpdate(sidePos, block, 8 + world.rand.nextInt(16)); } }
Example 6
Source Project: customstuff4 File: BlockButton.java License: GNU General Public License v3.0 | 5 votes |
private void checkPressed(IBlockState state, World worldIn, BlockPos pos) { List<? extends Entity> list = worldIn.<Entity>getEntitiesWithinAABB(EntityArrow.class, state.getBoundingBox(worldIn, pos).offset(pos)); boolean flag = !list.isEmpty(); boolean flag1 = state.getValue(POWERED); if (flag && !flag1) { worldIn.setBlockState(pos, state.withProperty(POWERED, true)); this.notifyNeighbors(worldIn, pos, state.getValue(FACING)); worldIn.markBlockRangeForRenderUpdate(pos, pos); this.playClickSound(null, worldIn, pos); } if (!flag && flag1) { worldIn.setBlockState(pos, state.withProperty(POWERED, false)); this.notifyNeighbors(worldIn, pos, state.getValue(FACING)); worldIn.markBlockRangeForRenderUpdate(pos, pos); this.playReleaseSound(worldIn, pos); } if (flag) { worldIn.scheduleUpdate(new BlockPos(pos), this, this.tickRate(worldIn)); } }
Example 7
Source Project: TFC2 File: BlockCollapsible.java License: GNU General Public License v3.0 | 5 votes |
protected void scheduleNeighbors(World world, BlockPos pos) { for(int x = -1; x <= 1; x++) { for(int z = -1; z <= 1; z++) { for(int y = 0; y <= 2; y++) { world.scheduleUpdate(pos.add(x, y, z), world.getBlockState(pos.add(x, y, z)).getBlock(), tickRate(world)); } } } }
Example 8
Source Project: TFC2 File: BlockStairsTFC.java License: GNU General Public License v3.0 | 5 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { //this.modelState.neighborChanged(worldIn, pos, Blocks.AIR, pos); //this.modelBlock.onBlockAdded(worldIn, pos, this.modelState); worldIn.scheduleUpdate(pos, this, tickRate(worldIn)); }
Example 9
Source Project: enderutilities File: BlockEnderUtilities.java License: GNU Lesser General Public License v3.0 | 5 votes |
public void scheduleBlockUpdate(World world, BlockPos pos, IBlockState state, int delay, boolean force) { if (force || world.isUpdateScheduled(pos, state.getBlock()) == false) { world.scheduleUpdate(pos, state.getBlock(), delay); } }
Example 10
Source Project: enderutilities File: TileEntityEnderUtilities.java License: GNU Lesser General Public License v3.0 | 5 votes |
public void scheduleBlockUpdate(int delay, boolean force) { World world = this.getWorld(); if (world != null && (force || world.isUpdateScheduled(this.getPos(), this.getBlockType()) == false)) { //System.out.printf("scheduleBlockUpdate(), actually scheduling for %s\n", this.getPos()); world.scheduleUpdate(this.getPos(), this.getBlockType(), delay); } }
Example 11
Source Project: GregTech File: BlockPipe.java License: GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { worldIn.scheduleUpdate(pos, this, 1); }
Example 12
Source Project: GregTech File: BlockOre.java License: GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (state.getValue(STONE_TYPE).affectedByGravity) worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); }
Example 13
Source Project: GregTech File: BlockOre.java License: GNU Lesser General Public License v3.0 | 4 votes |
@Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { if (state.getValue(STONE_TYPE).affectedByGravity) worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); }
Example 14
Source Project: Valkyrien-Skies File: BlockValkyriumOre.java License: Apache License 2.0 | 4 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); }
Example 15
Source Project: Valkyrien-Skies File: BlockValkyriumOre.java License: Apache License 2.0 | 4 votes |
@Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); }
Example 16
Source Project: TFC2 File: BlockCollapsible.java License: GNU General Public License v3.0 | 4 votes |
/******************************************************************************* * 1. Content *******************************************************************************/ @Override public void onBlockAdded(World world, BlockPos pos, IBlockState state) { world.scheduleUpdate(pos, this, tickRate(world)); }
Example 17
Source Project: TFC2 File: BlockLeaves.java License: GNU General Public License v3.0 | 4 votes |
@Override public void onBlockAdded(World world, BlockPos pos, IBlockState state) { world.scheduleUpdate(pos, this, tickRate(world)); }
Example 18
Source Project: TFC2 File: BlockLeaves.java License: GNU General Public License v3.0 | 4 votes |
@Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if(world.isRemote || state.getBlock() != this) return; IBlockState scanState; WoodType wood = (WoodType)state.getValue(getMetaProperty()); BlockPos scanPos; if(wood == WoodType.Palm) { scanState = world.getBlockState(pos.down()); if(scanState.getBlock() != TFCBlocks.LogNaturalPalm) world.setBlockToAir(pos); return; } if (world.isAreaLoaded(pos.add(-5, -5, -5), pos.add(5, 5, 5))) { for(int y = -4; y <= 4; y++) { for(int x = -4; x <= 4; x++) { for(int z = -4; z <= 4; z++) { scanPos = pos.add(x, y, z); scanState = world.getBlockState(pos.add(x, y, z)); if((state.getBlock() == TFCBlocks.Leaves && scanState.getBlock() == TFCBlocks.LogNatural && scanState.getValue(BlockLogNatural.WOOD) == wood) || (state.getBlock() == TFCBlocks.Leaves2 && scanState.getBlock() == TFCBlocks.LogNatural2 && scanState.getValue(BlockLogNatural2.WOOD) == wood)) return; } } } for(int y = -1; y <= 1; y++) { for(int x = -1; x <= 1; x++) { for(int z = -1; z <= 1; z++) { world.scheduleUpdate(pos.add(x, y, z), this, tickRate(world)); } } } world.setBlockToAir(pos); } }
Example 19
Source Project: TFC2 File: BlockGravity.java License: GNU General Public License v3.0 | 4 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { worldIn.scheduleUpdate(pos, this, tickRate(worldIn)); }