use of co.aikar.timings.WorldTimingsHandler in project SpongeCommon by SpongePowered.
the class MixinWorldServer method onConstruct.
@Inject(method = "<init>", at = @At("RETURN"))
private void onConstruct(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn, CallbackInfo callbackInfo) {
if (info == null) {
SpongeImpl.getLogger().warn("World constructed without a WorldInfo! This will likely cause problems. Subsituting dummy info.", new RuntimeException("Stack trace:"));
this.worldInfo = new WorldInfo(new WorldSettings(0, GameType.NOT_SET, false, false, WorldType.DEFAULT), "sponge$dummy_world");
}
// Checks to make sure no mod has changed our worldInfo and if so, reverts back to original.
// Mods such as FuturePack replace worldInfo with a custom one for separate world time.
// This change is not needed as all worlds use separate save handlers.
this.worldInfo = info;
this.timings = new WorldTimingsHandler((WorldServer) (Object) this);
this.dimensionId = dimensionId;
this.prevWeather = getWeather();
this.weatherStartTime = this.worldInfo.getWorldTotalTime();
((World) (Object) this).getWorldBorder().addListener(new PlayerBorderListener(this.getMinecraftServer(), dimensionId));
PortalAgentType portalAgentType = ((WorldProperties) this.worldInfo).getPortalAgentType();
if (!portalAgentType.equals(PortalAgentTypes.DEFAULT)) {
try {
this.worldTeleporter = (Teleporter) portalAgentType.getPortalAgentClass().getConstructor(new Class<?>[] { WorldServer.class }).newInstance(new Object[] { this });
} catch (Exception e) {
SpongeImpl.getLogger().log(Level.ERROR, "Could not create PortalAgent of type " + portalAgentType.getId() + " for world " + this.getName() + ": " + e.getMessage() + ". Falling back to default...");
}
}
// Turn on capturing
updateWorldGenerator();
// Need to set the active config before we call it.
this.chunkGCLoadThreshold = SpongeHooks.getActiveConfig((WorldServer) (Object) this).getConfig().getWorld().getChunkLoadThreadhold();
this.chunkGCTickInterval = this.getActiveConfig().getConfig().getWorld().getTickInterval();
this.weatherIceAndSnowEnabled = this.getActiveConfig().getConfig().getWorld().getWeatherIceAndSnow();
this.weatherThunderEnabled = this.getActiveConfig().getConfig().getWorld().getWeatherThunder();
this.updateEntityTick = 0;
this.mixinChunkProviderServer = ((IMixinChunkProviderServer) this.getChunkProvider());
this.setMemoryViewDistance(this.chooseViewDistanceValue(this.getActiveConfig().getConfig().getWorld().getViewDistance()));
}
Aggregations