@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()); }
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 ) ) ); }
@Override public void handleClearAction(World world, BlockPos pos, StructureTemplate template, StructureBB bb) { world.setBlockState(pos, Blocks.WATER.getDefaultState()); }
@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; }
@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); }
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))); }
@Override public void handleClearAction(World world, BlockPos pos, StructureTemplate template, StructureBB bb) { if (pos.getY() < bb.min.getY() + template.getOffset().getY()) { world.setBlockState(pos, Blocks.WATER.getDefaultState()); } else { super.handleClearAction(world, pos, template, bb); } } }
@Override public void handleClearAction(World world, BlockPos pos, StructureTemplate template, StructureBB bb) { if (pos.getY() >= bb.min.getY() + template.getOffset().getY()) { super.handleClearAction(world, pos, template, bb); } else { world.setBlockState(pos, Blocks.WATER.getDefaultState()); } }
@Override public void handleClearAction(World world, BlockPos pos, StructureTemplate template, StructureBB bb) { int maxWaterY = bb.min.getY() + template.getOffset().getY() - 1; if (pos.getY() <= maxWaterY) { world.setBlockState(pos, Blocks.WATER.getDefaultState()); } else { super.handleClearAction(world, pos, template, bb); } }
private boolean trySetWater(World world, IFarmHousing farmHousing, BlockPos position) { if (isWaterSourceBlock(world, position) || !canPlaceWater(world, position)) { return false; } if (!farmHousing.hasLiquid(STACK_WATER)) { return false; } produce.addAll(BlockUtil.getBlockDrops(world, position)); BlockUtil.setBlockWithPlaceSound(world, position, Blocks.WATER.getDefaultState()); farmHousing.removeLiquid(STACK_WATER); return true; }
public void addInteractions() { addInteraction(Blocks.GRASS, Blocks.DIRT); addInteraction(Blocks.WATER.getDefaultState(), Blocks.ICE); addInteraction(Blocks.WATER, Blocks.SNOW); addInteraction(Blocks.FLOWING_WATER.getDefaultState(), Blocks.ICE); addInteraction(Blocks.FLOWING_WATER, Blocks.SNOW); addInteraction(Blocks.LAVA.getDefaultState(), Blocks.OBSIDIAN); addInteraction(Blocks.LAVA, Blocks.STONE); addInteraction(Blocks.LEAVES, Blocks.AIR); addInteraction(Blocks.LEAVES2, Blocks.AIR); addInteraction(Blocks.TALLGRASS, Blocks.AIR); addInteraction(Blocks.FIRE, Blocks.AIR); addInteraction(TFFluids.blockFluidGlowstone.getDefaultState(), Blocks.GLOWSTONE); }
@Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { super.neighborChanged(state, worldIn, pos, blockIn, fromPos); if (fromPos.up().equals(pos)) { if(worldIn.getBlockState(fromPos).getBlockFaceShape(worldIn, fromPos, EnumFacing.UP) != BlockFaceShape.SOLID) { //remove current block and replace it with water block worldIn.destroyBlock(pos, true); worldIn.setBlockState(pos, Blocks.WATER.getDefaultState().withProperty(LEVEL, state.getValue(LEVEL))); return; } } worldIn.scheduleUpdate(pos, state.getBlock(), 5); }