Checks to see if a given block is both water and cold enough to freeze. @param pos The block coordinates @param noWaterAdj If true, this method will only return true if there is a non-water block immediately adjacent to the specified block
(BlockPos pos, boolean noWaterAdj)
| 2696 | * to the specified block |
| 2697 | */ |
| 2698 | public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) |
| 2699 | { |
| 2700 | BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); |
| 2701 | float f = biomegenbase.getFloatTemperature(pos); |
| 2702 | |
| 2703 | if (f > 0.15F) |
| 2704 | { |
| 2705 | return false; |
| 2706 | } |
| 2707 | else |
| 2708 | { |
| 2709 | if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10) |
| 2710 | { |
| 2711 | IBlockState iblockstate = this.getBlockState(pos); |
| 2712 | Block block = iblockstate.getBlock(); |
| 2713 | |
| 2714 | if ((block == Blocks.water || block == Blocks.flowing_water) && iblockstate.getValue(BlockLiquid.LEVEL) == 0) |
| 2715 | { |
| 2716 | if (!noWaterAdj) |
| 2717 | { |
| 2718 | return true; |
| 2719 | } |
| 2720 | |
| 2721 | boolean flag = this.isWater(pos.west()) && this.isWater(pos.east()) && this.isWater(pos.north()) && this.isWater(pos.south()); |
| 2722 | |
| 2723 | if (!flag) |
| 2724 | { |
| 2725 | return true; |
| 2726 | } |
| 2727 | } |
| 2728 | } |
| 2729 | |
| 2730 | return false; |
| 2731 | } |
| 2732 | } |
| 2733 | |
| 2734 | private boolean isWater(BlockPos pos) |
| 2735 | { |
no test coverage detected