Cleanup/Implement some todos (#5660)

This commit is contained in:
ichttt authored and LexManos committed 2019-04-17 13:57:32 -07:00
1 parent e868739675
commit c0aa4c8517
5 files changed
+28 -22

No files matched your search

@@ -88,16 +88,10 @@ public class WorldWorkerManager
{
boolean hasWork();
default void work() {}; //TODO: Remove in 1.13.
/**
* Perform a task, returning true from this will have the manager call this function again this tick if there is time left.
* Returning false will skip calling this worker until next tick.
*/
default boolean doWork()
{
work();
return true;
}
boolean doWork();
}
}
@@ -28,6 +28,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import net.minecraftforge.registries.ForgeRegistries;
import javax.annotation.Nullable;
@@ -133,7 +135,7 @@ public class BlockSnapshot
World world = this.world != null ? this.world.get() : null;
if (world == null)
{
world = null; // TODO Server static access? FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(getDimId());
world = ServerLifecycleHooks.getCurrentServer().getWorld(DimensionType.getById(getDimId()));
this.world = new WeakReference<World>(world);
}
return world;