mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 12:09:39 +00:00
Prevent farms on a chunk edge from loading unloaded chunks
This commit is contained in:
1 parent
79c56311c2
commit
d35075d681
3 files changed
+46
-27
No files matched your search
@@ -10,12 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
|
||||
public class FarmTarget {
|
||||
|
||||
private final BlockPos start;
|
||||
@@ -47,7 +48,7 @@ public class FarmTarget {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setExtentAndYOffset(World world, BlockPos platformPosition) {
|
||||
public void setExtentAndYOffset(World world, @Nullable BlockPos platformPosition) {
|
||||
if (platformPosition == null) {
|
||||
extent = 0;
|
||||
return;
|
||||
@@ -55,6 +56,9 @@ public class FarmTarget {
|
||||
|
||||
BlockPos.MutableBlockPos position = new BlockPos.MutableBlockPos(platformPosition);
|
||||
for (extent = 0; extent < limit; extent++) {
|
||||
if (!world.isBlockLoaded(position)) {
|
||||
break;
|
||||
}
|
||||
IBlockState blockState = world.getBlockState(position);
|
||||
if (!FarmHelper.bricks.contains(blockState.getBlock())) {
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user