SPIGOT-927: Only schedule ticks for blocks in loaded chunks

This commit is contained in:
Thinkofdeath 2015-05-26 14:44:43 +01:00 committed by Zach Brown
parent 015e038b89
commit 060c7ee7c0

View File

@ -1,4 +1,4 @@
From 1c13de44e824b19644554a6b0f73272651c9b22f Mon Sep 17 00:00:00 2001
From b4ba16f862dc2d42971780eb3e1cc45d6b2eb821 Mon Sep 17 00:00:00 2001
From: "Evan A. Haskell" <eah2119@gmail.com>
Date: Sat, 19 Apr 2014 16:58:26 -0400
Subject: [PATCH] Schedule Hopper Ticks
@ -166,10 +166,10 @@ index edcb307..4b3ea37 100644
if (this.getControllerMove().a()) {
double d0 = this.getControllerMove().b();
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index c268a40..578f79d 100644
index c268a40..c4cc269 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -21,6 +21,64 @@ public abstract class TileEntity {
@@ -21,6 +21,67 @@ public abstract class TileEntity {
private int h;
protected Block e;
@ -177,6 +177,9 @@ index c268a40..578f79d 100644
+ // Helper method for scheduleTicks. If the hopper at blockposition is pointed
+ // toward this tile, then make the hopper active
+ private void scheduleTick(BlockPosition blockposition) {
+ if (!world.isLoaded(blockposition)) {
+ return;
+ }
+ TileEntity tileEntity = this.world.getTileEntity(blockposition);
+ if (tileEntity instanceof TileEntityHopper) {
+ // i is the metadeta assoiated with the direction the hopper faces.
@ -234,7 +237,7 @@ index c268a40..578f79d 100644
public TileEntity() {
this.position = BlockPosition.ZERO;
this.h = -1;
@@ -105,6 +163,10 @@ public abstract class TileEntity {
@@ -105,6 +166,10 @@ public abstract class TileEntity {
if (this.w() != Blocks.AIR) {
this.world.updateAdjacentComparators(this.position, this.w());
}