Meteor world gen (#4409)

Start doing meteor world gen things
This commit is contained in:
Eutro
2020-06-12 10:36:45 +01:00
committed by GitHub
parent ae69ad6d8a
commit 65482357f7
33 changed files with 1099 additions and 1072 deletions
+10 -14
View File
@@ -19,17 +19,14 @@
package appeng.core;
import java.io.File;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import appeng.api.AEApi;
import appeng.block.paint.PaintSplotchesModel;
import appeng.block.qnb.QnbFormedModel;
import appeng.bootstrap.components.IClientSetupComponent;
import appeng.bootstrap.components.IInitComponent;
import appeng.bootstrap.components.IPostInitComponent;
import appeng.bootstrap.components.ItemColorComponent;
import appeng.capabilities.Capabilities;
import appeng.client.ClientHelper;
import appeng.client.render.DummyFluidItemModel;
@@ -45,9 +42,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler;
import appeng.parts.PartPlacement;
import appeng.parts.automation.PlaneModel;
import appeng.parts.automation.PlaneModelLoader;
import appeng.server.AECommand;
import appeng.server.ServerHelper;
import com.google.common.base.Stopwatch;
import net.minecraft.block.Block;
@@ -56,14 +51,18 @@ import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.particles.ParticleType;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.CrashReportExtender;
import net.minecraftforge.fml.DistExecutor;
@@ -75,12 +74,8 @@ import net.minecraftforge.fml.config.ModConfig;
import appeng.core.crash.ModCrashEnhancement;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppedEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
import net.minecraftforge.fml.event.server.*;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.network.NetworkRegistry;
import javax.annotation.Nonnull;
@@ -136,6 +131,7 @@ public final class AppEng
modEventBus.addGenericListener(TileEntityType.class, registration::registerTileEntities);
modEventBus.addGenericListener(ContainerType.class, registration::registerContainerTypes);
modEventBus.addGenericListener(IRecipeSerializer.class, registration::registerRecipeSerializers);
modEventBus.addGenericListener(Feature.class, registration::registerWorldGen);
modEventBus.addListener(registration::registerParticleFactories);
modEventBus.addListener(registration::registerTextures);
modEventBus.addListener(registration::registerCommands);
@@ -150,7 +146,7 @@ public final class AppEng
MinecraftForge.EVENT_BUS.addListener( TickHandler.INSTANCE::unloadWorld );
MinecraftForge.EVENT_BUS.addListener( TickHandler.INSTANCE::onTick );
MinecraftForge.EVENT_BUS.addListener( this::serverAboutToStart );
MinecraftForge.EVENT_BUS.addListener( this::onServerAboutToStart );
MinecraftForge.EVENT_BUS.addListener( this::serverStopped );
MinecraftForge.EVENT_BUS.addListener( this::serverStopping );
@@ -305,9 +301,9 @@ public final class AppEng
AELog.info( "Post Initialization ( ended after " + start.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
}
private void serverAboutToStart( final FMLServerStartedEvent evt )
private void onServerAboutToStart(final FMLServerAboutToStartEvent evt)
{
WorldData.onServerAboutToStart( evt.getServer() );
WorldData.onServerStarting( evt.getServer() );
}
private void serverStopping( final FMLServerStoppingEvent event )
+47 -30
View File
@@ -26,6 +26,7 @@ import appeng.api.definitions.IItems;
import appeng.api.definitions.IParts;
import appeng.api.features.IRegistryContainer;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.features.IWorldGen;
import appeng.api.movable.IMovableRegistry;
import appeng.api.networking.IGridCacheRegistry;
import appeng.api.networking.crafting.ICraftingGrid;
@@ -37,7 +38,6 @@ import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.ITickManager;
import appeng.bootstrap.IModelRegistry;
import appeng.bootstrap.components.*;
import appeng.capabilities.Capabilities;
import appeng.client.gui.implementations.GuiCellWorkbench;
import appeng.client.gui.implementations.GuiChest;
import appeng.client.gui.implementations.GuiCondenser;
@@ -101,6 +101,7 @@ import appeng.recipes.handlers.InscriberRecipeSerializer;
import appeng.server.AECommand;
import appeng.tile.AEBaseTile;
import net.minecraft.advancements.CriteriaTriggers;
import appeng.worldgen.MeteoriteWorldGen;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScreenManager;
@@ -112,6 +113,13 @@ import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.particles.ParticleType;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.IFeatureConfig;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.placement.Placement;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.*;
@@ -127,6 +135,8 @@ import net.minecraftforge.fml.network.IContainerFactory;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry;
import java.util.Objects;
final class Registration
{
@@ -752,16 +762,6 @@ final class Registration
// FIXME {
// FIXME // TODO: VILLAGER TRADING
// FIXME // VillagerRegistry.instance().getRegisteredVillagers().registerVillageTradeHandler( 3, new AETrading() );
// FIXME }
// FIXME if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) )
// FIXME {
// FIXME GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 );
// FIXME }
// FIXME
// FIXME if( AEConfig.instance().isFeatureEnabled( AEFeature.METEORITE_WORLD_GEN ) )
// FIXME {
// FIXME GameRegistry.registerWorldGenerator( new MeteoriteWorldGen(), 0 );
// FIXME }
final IMovableRegistry mr = registries.movable();
@@ -799,25 +799,42 @@ final class Registration
*/
mr.whiteListTileEntity( AEBaseTile.class );
// FIXME /*
// FIXME * world gen
// FIXME */
// FIXME for( final WorldGenType type : WorldGenType.values() )
// FIXME {
// FIXME registries.worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
// FIXME
// FIXME // nether
// FIXME registries.worldgen().disableWorldGenForDimension( type, -1 );
// FIXME
// FIXME // end
// FIXME registries.worldgen().disableWorldGenForDimension( type, 1 );
// FIXME }
// FIXME
// FIXME // whitelist from config
// FIXME for( final int dimension : AEConfig.instance().getMeteoriteDimensionWhitelist() )
// FIXME {
// FIXME registries.worldgen().enableWorldGenForDimension( WorldGenType.METEORITES, dimension );
// FIXME }
/*
* world gen
*/
for( final IWorldGen.WorldGenType type : IWorldGen.WorldGenType.values() )
{
// FIXME: registries.worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
registries.worldgen().disableWorldGenForDimension( type, DimensionType.THE_NETHER.getRegistryName() );
registries.worldgen().disableWorldGenForDimension( type, DimensionType.THE_NETHER.getRegistryName() );
}
// whitelist from config
for( final String dimension : AEConfig.instance().getMeteoriteDimensionWhitelist() )
{
registries.worldgen().enableWorldGenForDimension( IWorldGen.WorldGenType.METEORITES, new ResourceLocation( dimension ) );
}
ForgeRegistries.BIOMES.forEach(
b -> {
b.addFeature(GenerationStage.Decoration.TOP_LAYER_MODIFICATION,
new ConfiguredFeature<NoFeatureConfig, Feature<NoFeatureConfig>>(
MeteoriteWorldGen.INSTANCE,
IFeatureConfig.NO_FEATURE_CONFIG
)
);
}
);
}
public void registerWorldGen( RegistryEvent.Register<Feature<?>> evt )
{
IForgeRegistry<Feature<?>> r = evt.getRegistry();
r.register( MeteoriteWorldGen.INSTANCE );
}
// private static class ModelLoaderWrapper implements IModelRegistry
@@ -21,10 +21,13 @@ package appeng.core.features.registries;
import java.util.HashSet;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraft.world.dimension.Dimension;
import appeng.api.features.IWorldGen;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.common.extensions.IForgeDimension;
public final class WorldGenRegistry implements IWorldGen
@@ -61,7 +64,7 @@ public final class WorldGenRegistry implements IWorldGen
}
@Override
public void enableWorldGenForDimension( final WorldGenType type, final int dimensionID )
public void enableWorldGenForDimension( final WorldGenType type, final ResourceLocation dimensionID )
{
if( type == null )
{
@@ -72,7 +75,7 @@ public final class WorldGenRegistry implements IWorldGen
}
@Override
public void disableWorldGenForDimension( final WorldGenType type, final int dimensionID )
public void disableWorldGenForDimension( final WorldGenType type, final ResourceLocation dimensionID )
{
if( type == null )
{
@@ -95,9 +98,10 @@ public final class WorldGenRegistry implements IWorldGen
throw new IllegalArgumentException( "Bad Provider Passed" );
}
ResourceLocation id = w.dimension.getDimension().getType().getRegistryName();
final boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.dimension.getClass() );
final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.dimension.getDimension() );
final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.dimension.getDimension() );
final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( id );
final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( id );
if( isBadProvider || isBadDimension )
{
@@ -116,7 +120,7 @@ public final class WorldGenRegistry implements IWorldGen
{
final HashSet<Class<? extends Dimension>> badProviders = new HashSet<>();
final HashSet<Integer> badDimensions = new HashSet<>();
final HashSet<Integer> enabledDimensions = new HashSet<>();
final HashSet<ResourceLocation> badDimensions = new HashSet<>();
final HashSet<ResourceLocation> enabledDimensions = new HashSet<>();
}
}
@@ -19,6 +19,7 @@
package appeng.core.sync.packets;
import appeng.core.worlddata.WorldData;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.PlayerEntity;
@@ -77,6 +78,6 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba
this.talkBackTo = player;
final DimensionalCoord loc = new DimensionalCoord( player.world, this.cx << 4, this.cdy << 5, this.cz << 4 );
// FIXME WorldData.instance().compassData().service().getCompassDirection( loc, 174, this );
WorldData.instance().compassData().service().getCompassDirection( loc, 174, this );
}
}
@@ -19,6 +19,7 @@
package appeng.core.sync.packets;
import appeng.hooks.CompassManager;
import appeng.hooks.CompassResult;
import io.netty.buffer.Unpooled;
@@ -71,6 +72,6 @@ public class PacketCompassResponse extends AppEngPacket
@Override
public void clientPacketData( final INetworkInfo network, final PlayerEntity player )
{
// TODO CompassManager.INSTANCE.postResult( this.attunement, this.cx << 4, this.cdy << 5, this.cz << 4, this.cr );
CompassManager.INSTANCE.postResult( this.attunement, this.cx << 4, this.cdy << 5, this.cz << 4, this.cr );
}
}
@@ -38,9 +38,8 @@ final class CompassData implements IWorldCompassData
@Nonnull
private final CompassService service;
public CompassData( @Nonnull final File compassDirectory, @Nonnull final CompassService service )
public CompassData( @Nonnull final CompassService service )
{
Preconditions.checkNotNull( compassDirectory );
Preconditions.checkNotNull( service );
this.service = service;
@@ -41,7 +41,4 @@ public interface IWorldData
@Nonnull
IWorldCompassData compassData();
@Nonnull
IWorldSpawnData spawnData();
}
@@ -33,14 +33,6 @@ import com.google.common.base.Preconditions;
*/
public class MeteorDataNameEncoder
{
private static final char DATA_SEPARATOR = '_';
private static final char BASE_EXTENSION_SEPARATOR = '.';
private static final String FILE_EXTENSION = "dat";
private final char dataSeparator;
@Nonnull
private final String fileExtension;
private final char baseExtSeparator;
private final int bitScale;
/**
@@ -48,23 +40,11 @@ public class MeteorDataNameEncoder
*/
public MeteorDataNameEncoder( final int bitScale )
{
this( DATA_SEPARATOR, BASE_EXTENSION_SEPARATOR, FILE_EXTENSION, bitScale );
}
private MeteorDataNameEncoder( final char dataSeparator, final char baseExtSeparator, @Nonnull final String fileExtension, final int bitScale )
{
Preconditions.checkNotNull( fileExtension );
Preconditions.checkArgument( !fileExtension.isEmpty() );
Preconditions.checkArgument( bitScale >= 0 );
this.dataSeparator = dataSeparator;
this.baseExtSeparator = baseExtSeparator;
this.fileExtension = fileExtension;
this.bitScale = bitScale;
}
/**
* @param dimension ID of the processed dimension. Can be any integer
* @param chunkX X coordinate of the chunk. Can be any integer
* @param chunkZ Z coordinate of the chunk. Can be any integer
*
@@ -73,12 +53,10 @@ public class MeteorDataNameEncoder
*
* @since rv3 05.06.2015
*/
public String encode( final int dimension, final int chunkX, final int chunkZ )
public String encode( final int chunkX, final int chunkZ )
{
final int shiftedX = chunkX >> this.bitScale;
final int shiftedZ = chunkZ >> this.bitScale;
return String.format( "%d%c%d%c%d%c%s", dimension, this.dataSeparator, shiftedX, this.dataSeparator, shiftedZ, this.baseExtSeparator,
this.fileExtension );
return shiftedX + "_" + shiftedZ;
}
}
@@ -1,224 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.worlddata;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import javax.annotation.Nonnull;
import com.google.common.base.Preconditions;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompressedStreamTools;
import appeng.core.AELog;
import net.minecraft.world.dimension.Dimension;
/**
* @author thatsIch
* @version rv3 - 30.05.2015
* @since rv3 30.05.2015
*/
final class SpawnData implements IWorldSpawnData
{
@Nonnull
private final File spawnDirectory;
@Nonnull
private final MeteorDataNameEncoder encoder;
public SpawnData( @Nonnull final File spawnDirectory )
{
Preconditions.checkNotNull( spawnDirectory );
this.spawnDirectory = spawnDirectory;
this.encoder = new MeteorDataNameEncoder( 4 );
}
@Override
public void setGenerated(final Dimension dim, final int chunkX, final int chunkZ )
{
int dimId = dim.getType().getId(); // FIXME This is most likely borked, see new string ids
synchronized( SpawnData.class )
{
final CompoundNBT data = this.loadSpawnData( dimId, chunkX, chunkZ );
// edit.
data.putBoolean(chunkX + "," + chunkZ, true);
this.writeSpawnData( dimId, chunkX, chunkZ, data );
}
}
@Override
public boolean hasGenerated( final Dimension dim, final int chunkX, final int chunkZ )
{
int dimId = dim.getType().getId(); // FIXME This is most likely borked, see new string ids
synchronized( SpawnData.class )
{
final CompoundNBT data = this.loadSpawnData( dimId, chunkX, chunkZ );
return data.getBoolean( chunkX + "," + chunkZ );
}
}
@Override
public boolean addNearByMeteorites( final Dimension dim, final int chunkX, final int chunkZ, final CompoundNBT newData )
{
int dimId = dim.getType().getId(); // FIXME This is most likely borked, see new string ids
synchronized( SpawnData.class )
{
final CompoundNBT data = this.loadSpawnData( dimId, chunkX, chunkZ );
// edit.
final int size = data.getInt( "num" );
data.put( String.valueOf( size ), newData );
data.putInt( "num", size + 1 );
this.writeSpawnData( dimId, chunkX, chunkZ, data );
return true;
}
}
@Override
public Collection<CompoundNBT> getNearByMeteorites( final Dimension dim, final int chunkX, final int chunkZ )
{
final Collection<CompoundNBT> ll = new ArrayList<>();
synchronized( SpawnData.class )
{
for( int x = -1; x <= 1; x++ )
{
for( int z = -1; z <= 1; z++ )
{
final int cx = x + ( chunkX >> 4 );
final int cz = z + ( chunkZ >> 4 );
// FIXME Using the numerical dimension id here is fishy
final CompoundNBT data = this.loadSpawnData( dim.getType().getId(), cx << 4, cz << 4 );
if( data != null )
{
// edit.
final int size = data.getInt( "num" );
for( int s = 0; s < size; s++ )
{
ll.add( data.getCompound( String.valueOf( s ) ) );
}
}
}
}
}
return ll;
}
private CompoundNBT loadSpawnData( final int dim, final int chunkX, final int chunkZ )
{
if( !Thread.holdsLock( SpawnData.class ) )
{
throw new IllegalStateException( "Invalid Request" );
}
CompoundNBT data = null;
final String fileName = this.encoder.encode( dim, chunkX, chunkZ );
final File file = new File( this.spawnDirectory, fileName );
if( file.isFile() )
{
FileInputStream fileInputStream = null;
try
{
fileInputStream = new FileInputStream( file );
data = CompressedStreamTools.readCompressed( fileInputStream );
}
catch( final Throwable e )
{
data = new CompoundNBT();
AELog.debug( e );
}
finally
{
if( fileInputStream != null )
{
try
{
fileInputStream.close();
}
catch( final IOException e )
{
AELog.debug( e );
}
}
}
}
else
{
data = new CompoundNBT();
}
return data;
}
private void writeSpawnData( final int dim, final int chunkX, final int chunkZ, final CompoundNBT data )
{
if( !Thread.holdsLock( SpawnData.class ) )
{
throw new IllegalStateException( "Invalid Request" );
}
final String fileName = this.encoder.encode( dim, chunkX, chunkZ );
final File file = new File( this.spawnDirectory, fileName );
FileOutputStream fileOutputStream = null;
try
{
fileOutputStream = new FileOutputStream( file );
CompressedStreamTools.writeCompressed( data, fileOutputStream );
}
catch( final Throwable e )
{
AELog.debug( e );
}
finally
{
if( fileOutputStream != null )
{
try
{
fileOutputStream.close();
}
catch( final IOException e )
{
AELog.debug( e );
}
}
}
}
}
@@ -19,6 +19,8 @@
package appeng.core.worlddata;
import appeng.services.CompassService;
import appeng.services.compass.CompassThreadFactory;
import com.google.common.base.Preconditions;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.dimension.DimensionType;
@@ -26,6 +28,7 @@ import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.concurrent.ThreadFactory;
/**
@@ -48,34 +51,33 @@ public final class WorldData implements IWorldData
@Nullable
private static IWorldData instance;
@Nullable
private static MinecraftServer server;
private final IWorldPlayerData playerData;
private final IWorldGridStorageData storageData;
private final IWorldCompassData compassData;
private final IWorldSpawnData spawnData;
private WorldData( @Nonnull final MinecraftServer server )
private WorldData( @Nonnull final ServerWorld overworld )
{
Preconditions.checkNotNull( server );
Preconditions.checkNotNull( overworld );
// Attach shared data to the server's overworld dimension
ServerWorld overworld = server.getWorld(DimensionType.OVERWORLD);
if (overworld == null) {
if (overworld.getDimension().getType() != DimensionType.OVERWORLD) {
throw new IllegalStateException("The server doesn't have an Overworld dimension we could store our data on!");
}
final PlayerData playerData = overworld.getSavedData().getOrCreate(PlayerData::new, PlayerData.NAME);
final StorageData storageData = overworld.getSavedData().getOrCreate(StorageData::new, StorageData.NAME);
// final ThreadFactory compassThreadFactory = new CompassThreadFactory();
// final CompassService compassService = new CompassService( this.compassDirectory, compassThreadFactory );
// final CompassData compassData = new CompassData( this.compassDirectory, compassService );
//
// final IWorldSpawnData spawnData = new SpawnData( this.spawnDirectory );
final ThreadFactory compassThreadFactory = new CompassThreadFactory();
final CompassService compassService = new CompassService(server, compassThreadFactory );
final CompassData compassData = new CompassData( compassService );
this.playerData = playerData;
this.storageData = storageData;
this.compassData = null; // compassData;
this.spawnData = null; // spawnData;
this.compassData = compassData;
}
/**
@@ -85,8 +87,19 @@ public final class WorldData implements IWorldData
*/
@Deprecated
@Nonnull
public static IWorldData instance()
public synchronized static IWorldData instance()
{
// The overworld is lazily loaded, meaning we cannot access it right away
// when the server is starting, but the first time the instance is accessed,
// we create the actual world data
if (instance == null) {
if (server == null) {
throw new IllegalStateException("No server set.");
}
ServerWorld overworld = server.getWorld(DimensionType.OVERWORLD);
instance = new WorldData(overworld);
}
return instance;
}
@@ -94,12 +107,10 @@ public final class WorldData implements IWorldData
* Requires to start up from external from here
*
* drawback of the singleton build style
*
* @param server
*/
public static void onServerAboutToStart( MinecraftServer server )
public static void onServerStarting(MinecraftServer server)
{
instance = new WorldData(server);
WorldData.server = server;
}
@Override
@@ -111,8 +122,9 @@ public final class WorldData implements IWorldData
@Override
public void onServerStoppped()
{
Preconditions.checkNotNull( instance );
Preconditions.checkNotNull( server );
instance = null;
WorldData.server = null;
}
@Nonnull
@@ -135,11 +147,4 @@ public final class WorldData implements IWorldData
{
return this.compassData;
}
@Nonnull
@Override
public IWorldSpawnData spawnData()
{
return this.spawnData;
}
}