remove WorldConfig

This commit is contained in:
dfsek 2021-12-02 19:46:35 -07:00
parent a2a8f6e471
commit 2c963e14d5
5 changed files with 0 additions and 118 deletions

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 2020-2021 Polyhedral Development
*
* The Terra API is licensed under the terms of the MIT License. For more details,
* reference the LICENSE file in the common/api directory.
*/
package com.dfsek.terra.api.config;
import java.util.Map;
import com.dfsek.terra.api.registry.Registry;
import com.dfsek.terra.api.util.StringIdentifiable;
import com.dfsek.terra.api.world.ServerWorld;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
public interface WorldConfig extends StringIdentifiable {
<T> Registry<T> getRegistry(Class<T> clazz);
ServerWorld getWorld();
BiomeProvider getProvider();
ConfigPack getPack();
Map<String, String> getLocatable();
}

View File

@ -1,84 +0,0 @@
/*
* This file is part of Terra.
*
* Terra is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Terra 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Terra. If not, see <https://www.gnu.org/licenses/>.
*/
package com.dfsek.terra.config.pack;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
import com.dfsek.terra.api.Platform;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.config.WorldConfig;
import com.dfsek.terra.api.registry.Registry;
import com.dfsek.terra.api.world.ServerWorld;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.registry.LockedRegistryImpl;
public class WorldConfigImpl implements WorldConfig {
private final BiomeProvider provider;
private final ServerWorld world;
private final ConfigPackImpl pack;
private final Map<Type, Registry<?>> registryMap = new HashMap<>();
public WorldConfigImpl(ServerWorld world, ConfigPackImpl pack, Platform platform) {
this.world = world;
this.pack = pack;
pack.getRegistryMap().forEach((clazz, pair) -> registryMap.put(clazz, new LockedRegistryImpl<>(pair.getLeft())));
this.provider = pack.getBiomeProvider();
}
@Override
@SuppressWarnings("unchecked")
public <T> Registry<T> getRegistry(Class<T> clazz) {
return (LockedRegistryImpl<T>) registryMap.get(clazz);
}
@Override
public ServerWorld getWorld() {
return world;
}
@Override
public BiomeProvider getProvider() {
return provider;
}
@Override
public ConfigPack getPack() {
return pack;
}
@Override
public Map<String, String> getLocatable() {
return pack.getLocatable();
}
@Override
public String getID() {
return pack.getID();
}
public ConfigPackTemplate getTemplate() {
return pack.getTemplate();
}
}

View File

@ -17,13 +17,9 @@
package com.dfsek.terra.bukkit.world;
import java.io.File;
import java.util.UUID;
import com.dfsek.terra.api.block.entity.BlockEntity;
import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.config.WorldConfig;
import com.dfsek.terra.api.entity.Entity;
import com.dfsek.terra.api.entity.EntityType;
import com.dfsek.terra.api.world.ServerWorld;

View File

@ -44,7 +44,6 @@ import java.util.List;
import com.dfsek.terra.api.block.entity.BlockEntity;
import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.config.WorldConfig;
import com.dfsek.terra.api.entity.Entity;
import com.dfsek.terra.api.entity.EntityType;
import com.dfsek.terra.api.util.vector.Vector3;

View File

@ -45,7 +45,6 @@ import java.util.concurrent.Executor;
import com.dfsek.terra.api.block.entity.BlockEntity;
import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.config.WorldConfig;
import com.dfsek.terra.api.entity.Entity;
import com.dfsek.terra.api.entity.EntityType;
import com.dfsek.terra.api.util.vector.Vector3;