37 lines
2.3 KiB
Diff
37 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Mon, 16 Mar 2020 03:07:02 -0400
|
|
Subject: [PATCH] Don't load chunks for physics
|
|
|
|
Original code by Starlis, licensed under GNU General Public License v3.0
|
|
You can find the original code on https://github.com/starlis/empirecraft
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 980c34a1b816e9c57e31255465626192f96ae147..64f7fbeb03570a9b26d674e3bc39919619b7f065 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -895,7 +895,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos neighborPos) {
|
|
if (!this.isClientSide) {
|
|
- BlockState iblockdata = this.getBlockState(pos);
|
|
+ BlockState iblockdata = this.getBlockStateIfLoaded(pos); // EMC
|
|
+ if (iblockdata == null) return; // EMC
|
|
|
|
try {
|
|
// CraftBukkit start
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
|
index d17fb373c43b9bc3c18e3b34fd5f70d95d4d3215..58c511e075d96022289de00423ea19ea5595d21c 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
|
@@ -930,7 +930,8 @@ public abstract class BlockBehaviour {
|
|
Direction enumdirection = aenumdirection[l];
|
|
|
|
blockposition_mutableblockposition.setWithOffset(pos, enumdirection);
|
|
- BlockState iblockdata = world.getBlockState(blockposition_mutableblockposition);
|
|
+ BlockState iblockdata = world.getBlockStateIfLoaded(blockposition_mutableblockposition); // EMC
|
|
+ if (iblockdata == null) { continue; } // EMC
|
|
BlockState iblockdata1 = iblockdata.updateShape(enumdirection.getOpposite(), this.asState(), world, blockposition_mutableblockposition, pos);
|
|
|
|
Block.updateOrDestroy(iblockdata, iblockdata1, world, blockposition_mutableblockposition, flags, maxUpdateDepth);
|