@Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if(shouldRemove(world, pos)) world.setBlockState(pos, rand.nextInt(10) == 0 ? Blocks.WATER.getDefaultState() : Blocks.AIR.getDefaultState()); }
world.setBlockState(pos2, Blocks.WATER.getDefaultState()); for (int k = 0; k < 4; ++k) { PacketSpawnParticles.create(world, pos2.getX() + random.nextDouble(), pos2.getY() + 1, pos2.getZ() + random.nextDouble(), 1, EnumParticleTypes.SMOKE_LARGE); Blocks.WATER.neighborChanged(Blocks.WATER.getDefaultState(), world, pos2, block, pos2);
public ToolEntropyManipulator() { super( AEConfig.instance().getEntropyManipulatorBattery() ); this.heatUp = new HashMap<>(); this.coolDown = new HashMap<>(); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONE.getDefaultState() ), new InWorldToolOperationResult( Blocks.COBBLESTONE.getDefaultState() ) ); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONEBRICK.getDefaultState() ), new InWorldToolOperationResult( Blocks.STONEBRICK.getStateFromMeta( 2 ) ) ); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.LAVA, true ), new InWorldToolOperationResult( Blocks.OBSIDIAN.getDefaultState() ) ); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_LAVA, true ), new InWorldToolOperationResult( Blocks.OBSIDIAN.getDefaultState() ) ); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.GRASS, true ), new InWorldToolOperationResult( Blocks.DIRT.getDefaultState() ) ); final List<ItemStack> snowBalls = new ArrayList<>(); snowBalls.add( new ItemStack( Items.SNOWBALL ) ); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult( null, snowBalls ) ); this.coolDown.put( new InWorldToolOperationIngredient( Blocks.WATER, true ), new InWorldToolOperationResult( Blocks.ICE.getDefaultState() ) ); this.heatUp.put( new InWorldToolOperationIngredient( Blocks.ICE.getDefaultState() ), new InWorldToolOperationResult( Blocks.WATER.getDefaultState() ) ); this.heatUp.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult() ); this.heatUp.put( new InWorldToolOperationIngredient( Blocks.WATER, true ), new InWorldToolOperationResult() ); this.heatUp.put( new InWorldToolOperationIngredient( Blocks.SNOW, true ), new InWorldToolOperationResult( Blocks.FLOWING_WATER.getStateFromMeta( 7 ) ) ); }
public UndergroundBiomeSlime() { super(Blocks.WATER.getDefaultState(), null, null); }
@Override public void handleClearAction(World world, BlockPos pos, StructureTemplate template, StructureBB bb) { world.setBlockState(pos, Blocks.WATER.getDefaultState()); }
private void initStuctureBlockMap() { if (STRUCTURE_BLOCKS.isEmpty()) { STRUCTURE_BLOCKS.put(GNEISS, true); STRUCTURE_BLOCKS.put(GNEISS_RELIEF, true); STRUCTURE_BLOCKS.put(GNEISS_CARVED, true); STRUCTURE_BLOCKS.put(GNEISS_BRICKS, true); STRUCTURE_BLOCKS.put(GNEISS_TILES, true); STRUCTURE_BLOCKS.put(TEMPLE_BRICK_UNBREAKING, true); STRUCTURE_BLOCKS.put(TEMPLE_PILLAR, true); STRUCTURE_BLOCKS.put(CAPSTONE, true); STRUCTURE_BLOCKS.put(BAMBOO_TORCH_LOWER, true); STRUCTURE_BLOCKS.put(BAMBOO_TORCH_UPPER, true); STRUCTURE_BLOCKS.put(GNEISS_VENT, true); STRUCTURE_BLOCKS.put(FORCE_FIELD, true); STRUCTURE_BLOCKS.put(TEMPLE_BRICK, true); STRUCTURE_BLOCKS.put(ANTLION_SPAWNER, true); STRUCTURE_BLOCKS.put(MAGMA_CRAWLER_SPAWNER, true); STRUCTURE_BLOCKS.put(TORCH_EAST, true); STRUCTURE_BLOCKS.put(TORCH_WEST, true); STRUCTURE_BLOCKS.put(TORCH_SOUTH, true); STRUCTURE_BLOCKS.put(TORCH_NORTH, true); STRUCTURE_BLOCKS.put(Blocks.LAVA.getDefaultState(), true); } }
@Override public void onPlayerHarvestDropsWithTool(BlockEvent.HarvestDropsEvent event, @Nonnull ItemStack toolStack, @Nonnull ItemStack thisUpgradeStack) { EntityPlayer player = event.getHarvester(); BlockPos pos = event.getPos(); World world = event.getWorld(); world.setBlockState(pos, Blocks.LAVA.getDefaultState()); quickLavaBlocks.put(Pair.of(player.dimension, pos), world.rand.nextInt(30) + 1); event.getDrops().clear(); }
private boolean hasWaterSource(World world, BlockPos pos) { return world.getBlockState(pos.add(0, -2, 0)) == Blocks.WATER.getDefaultState(); }
public boolean hasWaterSource(World world, BlockPos pos) { return world.getBlockState(pos.add(0, -2, 0)) == Blocks.WATER.getDefaultState(); }
@Override public void fillFloor(World world, BlockPos pos, IBlockState state) { if(waterChance > 0 && !isBorder(world, pos, state) && world.rand.nextInt(waterChance) == 0) world.setBlockState(pos, Blocks.WATER.getDefaultState()); else super.fillFloor(world, pos, state); }
public IBlockState getLiquidBlock() { if (liquidBlock == null) { Block b = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(LIQUID_BLOCK)); if (b == null) { LostCities.logger.error("Bad liquid block: " + LIQUID_BLOCK + "!"); liquidBlock = Blocks.WATER.getDefaultState(); } else { liquidBlock = b.getDefaultState(); } } return liquidBlock; }
public static IBlockState pathingTypeToBlock(PathingBlockType type, int dimension) { switch (type) { case AIR: return Blocks.AIR.getDefaultState(); case WATER: return Blocks.WATER.getDefaultState(); case AVOID: return Blocks.LAVA.getDefaultState(); case SOLID: // Dimension solid types switch (dimension) { case -1: return Blocks.NETHERRACK.getDefaultState(); case 0: default: // The fallback solid type return Blocks.STONE.getDefaultState(); case 1: return Blocks.END_STONE.getDefaultState(); } default: return null; } } }
@Override public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) { worldIn.setBlockState(pos, Blocks.WATER.getDefaultState().withProperty(LEVEL, state.getValue(LEVEL))); }
@SubscribeEvent public void onWorldTick(WorldTickEvent event) { if (event.phase == Phase.END && event.world == world) { world.setBlockState(pos, Blocks.WATER.getDefaultState()); MinecraftForge.EVENT_BUS.unregister(this); } } }
@Override public void fillFloor(World world, BlockPos pos, IBlockState state) { if(lavaChance > 0 && !isBorder(world, pos, state) && world.rand.nextInt(lavaChance) == 0) world.setBlockState(pos, Blocks.LAVA.getDefaultState()); else if(obsidianChance > 0 && world.rand.nextInt(obsidianChance) == 0) world.setBlockState(pos, Blocks.OBSIDIAN.getDefaultState(), 2); else if(UndergroundBiomes.firestoneEnabled) world.setBlockState(pos, UndergroundBiomes.firestoneState, 2); else super.fillFloor(world, pos, state); }
/** * change block to water * * @param world world object * @return if it was changed */ public static boolean applyWater(World world, BlockPos pos) { Block target = world.getBlockState(pos.offset(EnumFacing.DOWN)).getBlock(); if (target == Blocks.DIRT) { world.setBlockState(pos.offset(EnumFacing.DOWN), Blocks.WATER.getDefaultState(), 3); return true; } else if (target == Blocks.GRASS) { world.setBlockState(pos.offset(EnumFacing.DOWN), Blocks.WATER.getDefaultState(), 3); return true; } return false; }
public void onHitWater(RayTraceResult mop) { World world = getEntityWorld(); BlockPos posWater = this.getPosition(); if (world.getBlockState(posWater) != Blocks.WATER.getDefaultState()) { posWater = null;// look for the closest water source, sometimes it was // air and we // got ice right above the water if we dont do this check if (world.getBlockState(mop.getBlockPos()) == Blocks.WATER.getDefaultState()) posWater = mop.getBlockPos(); else if (world.getBlockState(mop.getBlockPos().offset(mop.sideHit)) == Blocks.WATER.getDefaultState()) posWater = mop.getBlockPos().offset(mop.sideHit); } if (posWater != null) { world.setBlockState(posWater, Blocks.ICE.getDefaultState()); } }
private void buildFloor(World world, BlockPos pos, int w, int h, Random rand) { createPyramid(world, pos.add(0, 5, 0), Blocks.AIR.getDefaultState(), true, 24, 24); for (int i = -h * 2; i <= h * 2; i++) for (int j = -w * 2; j <= w * 2; j++) if (canPlaceFloorAt(world, pos, pos.add(j, 0, i))) { if (rand.nextInt(15) == 0) if (rand.nextBoolean() && rand.nextBoolean()) world.setBlockState(pos.add(j, 0, i), Blocks.LAVA.getDefaultState()); else world.setBlockState(pos.add(j, 0, i), GNEISS_VENT); else world.setBlockState(pos.add(j, 0, i), GNEISS_TILES, 2); } }
private EnumActionResult hydrate(EntityPlayer player, ItemStack stack, World world, BlockPos pos) { if (HFApi.crops.hydrateSoil(player, world, pos)) { displayParticle(world, pos, EnumParticleTypes.WATER_SPLASH, Blocks.WATER.getDefaultState()); playSound(world, pos, SoundEvents.ENTITY_GENERIC_SWIM, SoundCategory.NEUTRAL); ToolHelper.performTask(player, stack, this); if (!player.capabilities.isCreativeMode) { getCapability(stack).drain(1, true); } return EnumActionResult.SUCCESS; } else return EnumActionResult.FAIL; }
public LavaGeneratorRecipeWrapper(@Nonnull IGuiHelper guiHelper) { final IBlockState gen = MachineObject.block_lava_generator.getBlockNN().getDefaultState().withProperty(EnumRenderMode.RENDER, EnumRenderMode.FRONT_ON); final IBlockState chassis = ModObject.block_machine_base.getBlockNN().getDefaultState().withProperty(EnumRenderPart.SUB, EnumRenderPart.BODY); final IBlockState waterfull = Blocks.WATER.getDefaultState().withProperty(net.minecraft.block.BlockLiquid.LEVEL, 15); final IBlockState water = Blocks.WATER.getDefaultState().withProperty(net.minecraft.block.BlockLiquid.LEVEL, 13); final IBlockState air = Blocks.AIR.getDefaultState(); this.bsr = new BlockSceneRenderer(new NNList<>(Pair.of(new BlockPos(1, 1, 1), chassis), Pair.of(new BlockPos(1, 1, 1), gen), Pair.of(new BlockPos(1, 0, 1), waterfull), Pair.of(new BlockPos(1, 1, 0), air), Pair.of(new BlockPos(0, 1, 1), water), Pair.of(new BlockPos(1, 1, 2), water), Pair.of(new BlockPos(2, 1, 1), water))); }