mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 12:09:39 +00:00
Remove unloaded climate regions
This commit is contained in:
1 parent
c5798af241
commit
ea976ebb2f
3 files changed
+15
No files matched your search
@@ -28,6 +28,8 @@ public interface IClimateManager {
|
||||
|
||||
void removeSource(IClimateSourceProvider source);
|
||||
|
||||
void onWorldUnload(World world);
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(World world, BlockPos pos);
|
||||
|
||||
|
||||
@@ -16,8 +16,11 @@ import java.util.Map;
|
||||
|
||||
import forestry.api.climate.IClimateRegion;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.multiblock.MultiblockRegistry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
|
||||
@@ -148,6 +151,11 @@ public class ClimateEventHandler {
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
@SubscribeEvent()
|
||||
public void onWorldUnload(WorldEvent.Unload unloadWorldEvent) {
|
||||
ForestryAPI.climateManager.onWorldUnload(unloadWorldEvent.getWorld());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldTick(TickEvent.WorldTickEvent event) {
|
||||
|
||||
@@ -152,6 +152,11 @@ public class ClimateManager implements IClimateManager {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldUnload(World world) {
|
||||
regions.remove(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClimateProvider getDefaultClimate(World world, BlockPos pos) {
|
||||
|
||||
Reference in new issue
Block a user