Add IDimensionTypeWrapper, IWorldWrapper, IBiomeWrapper, and IBiomeColorWrapperSingleton

This commit is contained in:
James Seibel
2021-11-15 20:51:49 -06:00
parent 880de7caf0
commit b07543f7a6
17 changed files with 212 additions and 69 deletions
@@ -31,10 +31,10 @@ import com.seibel.lod.core.util.DataPointUtil;
import com.seibel.lod.core.util.DetailDistanceUtil;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.ThreadMapUtil;
import com.seibel.lod.core.wrapperAdapters.world.IDimensionTypeWrapper;
import com.seibel.lod.core.wrapperAdapters.world.IWorldWrapper;
import com.seibel.lod.wrappers.MinecraftWrapper;
import com.seibel.lod.wrappers.chunk.ChunkWrapper;
import com.seibel.lod.wrappers.world.DimensionTypeWrapper;
import com.seibel.lod.wrappers.world.WorldWrapper;
/**
* This holds the methods that should be called
@@ -74,7 +74,7 @@ public class EventApi
if (mc.getPlayer() == null || ApiShared.lodWorld.getIsWorldNotLoaded())
return;
LodDimension lodDim = ApiShared.lodWorld.getLodDimension(DimensionTypeWrapper.getDimensionTypeWrapper(mc.getPlayer().level.dimensionType()));
LodDimension lodDim = ApiShared.lodWorld.getLodDimension(mc.getCurrentDimension());
if (lodDim == null)
return;
@@ -88,7 +88,7 @@ public class EventApi
// world events //
//==============//
public void chunkLoadEvent(ChunkWrapper chunk, DimensionTypeWrapper dimType)
public void chunkLoadEvent(ChunkWrapper chunk, IDimensionTypeWrapper dimType)
{
ApiShared.lodBuilder.generateLodNodeAsync(chunk, ApiShared.lodWorld, dimType, DistanceGenerationMode.SERVER);
}
@@ -99,7 +99,7 @@ public class EventApi
}
/** This is also called when a new dimension loads */
public void worldLoadEvent(WorldWrapper world)
public void worldLoadEvent(IWorldWrapper world)
{
DataPointUtil.worldHeight = world.getHeight();
//LodNodeGenWorker.restartExecutorService();
@@ -148,7 +148,7 @@ public class EventApi
}
}
public void blockChangeEvent(ChunkWrapper chunk, DimensionTypeWrapper dimType)
public void blockChangeEvent(ChunkWrapper chunk, IDimensionTypeWrapper dimType)
{
// recreate the LOD where the blocks were changed
ApiShared.lodBuilder.generateLodNodeAsync(chunk, ApiShared.lodWorld, dimType);
@@ -212,7 +212,7 @@ public class EventApi
// update the dimensions to fit the new width
ApiShared.lodWorld.resizeDimensionRegionWidth(newWidth);
ApiShared.lodBuilder.defaultDimensionWidthInRegions = newWidth;
ClientApi.renderer.setupBuffers(ApiShared.lodWorld.getLodDimension(DimensionTypeWrapper.getDimensionTypeWrapper(mc.getClientWorld().dimensionType())));
ClientApi.renderer.setupBuffers(ApiShared.lodWorld.getLodDimension(mc.getCurrentDimension()));
recalculateWidths = false;
//LOGGER.info("new dimension width in regions: " + newWidth + "\t potential: " + newWidth );
@@ -35,15 +35,15 @@ import com.seibel.lod.core.util.LevelPosUtil;
import com.seibel.lod.core.util.LodThreadFactory;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.ThreadMapUtil;
import com.seibel.lod.core.wrapperAdapters.world.IBiomeWrapper;
import com.seibel.lod.core.wrapperAdapters.world.IDimensionTypeWrapper;
import com.seibel.lod.core.wrapperAdapters.world.IWorldWrapper;
import com.seibel.lod.wrappers.MinecraftWrapper;
import com.seibel.lod.wrappers.block.BlockColorWrapper;
import com.seibel.lod.wrappers.block.BlockPosWrapper;
import com.seibel.lod.wrappers.block.BlockShapeWrapper;
import com.seibel.lod.wrappers.chunk.ChunkPosWrapper;
import com.seibel.lod.wrappers.chunk.ChunkWrapper;
import com.seibel.lod.wrappers.world.BiomeWrapper;
import com.seibel.lod.wrappers.world.DimensionTypeWrapper;
import com.seibel.lod.wrappers.world.WorldWrapper;
/**
* This object is in charge of creating Lod related objects.
@@ -84,12 +84,12 @@ public class LodBuilder
}
public void generateLodNodeAsync(ChunkWrapper chunk, LodWorld lodWorld, DimensionTypeWrapper dim)
public void generateLodNodeAsync(ChunkWrapper chunk, LodWorld lodWorld, IDimensionTypeWrapper dim)
{
generateLodNodeAsync(chunk, lodWorld, dim, DistanceGenerationMode.SERVER);
}
public void generateLodNodeAsync(ChunkWrapper chunk, LodWorld lodWorld, DimensionTypeWrapper dim, DistanceGenerationMode generationMode)
public void generateLodNodeAsync(ChunkWrapper chunk, LodWorld lodWorld, IDimensionTypeWrapper dim, DistanceGenerationMode generationMode)
{
if (lodWorld == null || lodWorld.getIsWorldNotLoaded())
return;
@@ -382,7 +382,7 @@ public class LodBuilder
// 1 means the lighting is a guess
int isDefault = 0;
WorldWrapper world = MinecraftWrapper.INSTANCE.getWrappedServerWorld();
IWorldWrapper world = MinecraftWrapper.INSTANCE.getWrappedServerWorld();
int blockBrightness = chunk.getEmittedBrightness(blockPos);
// get the air block above or below this block
@@ -492,7 +492,7 @@ public class LodBuilder
if (blockColorWrapper.hasTint())
{
BiomeWrapper biome = chunk.getBiome(xRel, y, zRel);
IBiomeWrapper biome = chunk.getBiome(xRel, y, zRel);
int tintValue;
if (blockColorWrapper.hasGrassTint())
// grass and green plants
@@ -29,8 +29,8 @@ import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
import com.seibel.lod.core.objects.lod.LodDimension;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.wrapperAdapters.world.IWorldWrapper;
import com.seibel.lod.wrappers.chunk.ChunkPosWrapper;
import com.seibel.lod.wrappers.world.WorldWrapper;
import com.seibel.lod.wrappers.worldGeneration.WorldGeneratorWrapper;
import net.minecraftforge.common.WorldWorkerManager.IWorker;
@@ -52,7 +52,7 @@ public class LodGenWorker implements IWorker // TODO is there a way to have this
public LodGenWorker(ChunkPosWrapper newPos, DistanceGenerationMode newGenerationMode,
LodBuilder newLodBuilder,
LodDimension newLodDimension, WorldWrapper serverWorld)
LodDimension newLodDimension, IWorldWrapper serverWorld)
{
// just a few sanity checks
if (newPos == null)
@@ -125,7 +125,7 @@ public class LodGenWorker implements IWorker // TODO is there a way to have this
public LodChunkGenThread(ChunkPosWrapper newPos, DistanceGenerationMode newGenerationMode,
LodBuilder newLodBuilder,
LodDimension newLodDimension, WorldWrapper worldWrapper)
LodDimension newLodDimension, IWorldWrapper worldWrapper)
{
worldGenWrapper = new WorldGeneratorWrapper(newLodBuilder, newLodDimension, worldWrapper);
@@ -35,9 +35,9 @@ import com.seibel.lod.core.util.DetailDistanceUtil;
import com.seibel.lod.core.util.LevelPosUtil;
import com.seibel.lod.core.util.LodThreadFactory;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.wrapperAdapters.world.IWorldWrapper;
import com.seibel.lod.wrappers.MinecraftWrapper;
import com.seibel.lod.wrappers.chunk.ChunkPosWrapper;
import com.seibel.lod.wrappers.world.WorldWrapper;
import net.minecraftforge.common.WorldWorkerManager;
@@ -116,7 +116,7 @@ public class LodWorldGenerator
// fill in positionsWaitingToBeGenerated //
//=======================================//
WorldWrapper serverWorld = LodUtil.getServerWorldFromDimension(lodDim.dimension);
IWorldWrapper serverWorld = LodUtil.getServerWorldFromDimension(lodDim.dimension);
PosToGenerateContainer posToGenerate = lodDim.getPosToGenerate(
maxChunkGenRequests,
@@ -36,10 +36,10 @@ import com.seibel.lod.core.util.DetailDistanceUtil;
import com.seibel.lod.core.util.LevelPosUtil;
import com.seibel.lod.core.util.LodThreadFactory;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.wrapperAdapters.world.IDimensionTypeWrapper;
import com.seibel.lod.core.wrapperAdapters.world.IWorldWrapper;
import com.seibel.lod.wrappers.MinecraftWrapper;
import com.seibel.lod.wrappers.chunk.ChunkPosWrapper;
import com.seibel.lod.wrappers.world.DimensionTypeWrapper;
import com.seibel.lod.wrappers.world.WorldWrapper;
@@ -57,7 +57,7 @@ import com.seibel.lod.wrappers.world.WorldWrapper;
*/
public class LodDimension
{
public final DimensionTypeWrapper dimension;
public final IDimensionTypeWrapper dimension;
/** measured in regions */
private volatile int width;
@@ -96,7 +96,7 @@ public class LodDimension
* Creates the dimension centered at (0,0)
* @param newWidth in regions
*/
public LodDimension(DimensionTypeWrapper newDimension, LodWorld lodWorld, int newWidth)
public LodDimension(IDimensionTypeWrapper newDimension, LodWorld lodWorld, int newWidth)
{
lastCutChunk = null;
lastExpandedChunk = null;
@@ -115,7 +115,7 @@ public class LodDimension
{
// local world
WorldWrapper serverWorld = LodUtil.getServerWorldFromDimension(newDimension);
IWorldWrapper serverWorld = LodUtil.getServerWorldFromDimension(newDimension);
saveDir = new File(serverWorld.getSaveFolder().getCanonicalFile().getPath() + File.separatorChar + "lod");
}
else
@@ -23,7 +23,7 @@ import java.util.Hashtable;
import java.util.Map;
import com.seibel.lod.api.lod.ClientApi;
import com.seibel.lod.wrappers.world.DimensionTypeWrapper;
import com.seibel.lod.core.wrapperAdapters.world.IDimensionTypeWrapper;
/**
* This stores all LODs for a given world.
@@ -38,7 +38,7 @@ public class LodWorld
private String worldName;
/** dimensions in this world */
private Map<DimensionTypeWrapper, LodDimension> lodDimensions;
private Map<IDimensionTypeWrapper, LodDimension> lodDimensions;
/** If true then the LOD world is setup and ready to use */
private boolean isWorldLoaded = false;
@@ -112,7 +112,7 @@ public class LodWorld
/**
* Returns null if no LodDimension exists for the given dimension
*/
public LodDimension getLodDimension(DimensionTypeWrapper dimType)
public LodDimension getLodDimension(IDimensionTypeWrapper dimType)
{
if (lodDimensions == null)
return null;
@@ -131,7 +131,7 @@ public class LodWorld
saveAllDimensions();
for (DimensionTypeWrapper key : lodDimensions.keySet())
for (IDimensionTypeWrapper key : lodDimensions.keySet())
lodDimensions.get(key).setRegionWidth(newRegionWidth);
}
@@ -147,7 +147,7 @@ public class LodWorld
// but that requires a LodDimension.hasDirtyRegions() method or something similar
ClientApi.LOGGER.info("Saving LODs");
for (DimensionTypeWrapper key : lodDimensions.keySet())
for (IDimensionTypeWrapper key : lodDimensions.keySet())
lodDimensions.get(key).saveDirtyRegionsToFileAsync();
}
@@ -32,11 +32,11 @@ import com.seibel.lod.core.objects.lod.LodDimension;
import com.seibel.lod.core.objects.lod.RegionPos;
import com.seibel.lod.core.objects.opengl.DefaultLodVertexFormats;
import com.seibel.lod.core.objects.opengl.LodVertexFormat;
import com.seibel.lod.core.wrapperAdapters.world.IDimensionTypeWrapper;
import com.seibel.lod.core.wrapperAdapters.world.IWorldWrapper;
import com.seibel.lod.wrappers.MinecraftWrapper;
import com.seibel.lod.wrappers.block.BlockPosWrapper;
import com.seibel.lod.wrappers.chunk.ChunkPosWrapper;
import com.seibel.lod.wrappers.world.DimensionTypeWrapper;
import com.seibel.lod.wrappers.world.WorldWrapper;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.renderer.WorldRenderer;
@@ -178,16 +178,16 @@ public class LodUtil
* Gets the ServerWorld for the relevant dimension.
* @return null if there is no ServerWorld for the given dimension
*/
public static WorldWrapper getServerWorldFromDimension(DimensionTypeWrapper newDimension)
public static IWorldWrapper getServerWorldFromDimension(IDimensionTypeWrapper newDimension)
{
IntegratedServer server = mc.getSinglePlayerServer();
if (server == null)
return null;
Iterable<WorldWrapper> worlds = mc.getAllServerWorlds();
WorldWrapper returnWorld = null;
Iterable<IWorldWrapper> worlds = mc.getAllServerWorlds();
IWorldWrapper returnWorld = null;
for (WorldWrapper world : worlds)
for (IWorldWrapper world : worlds)
{
if (world.getDimensionType() == newDimension)
{
@@ -237,7 +237,7 @@ public class LodUtil
* world, if in multiplayer it will return the server name, IP,
* and game version.
*/
public static String getWorldID(WorldWrapper world)
public static String getWorldID(IWorldWrapper world)
{
if (mc.hasSinglePlayerServer())
{
@@ -265,14 +265,14 @@ public class LodUtil
* This can be used to determine where to save files for a given
* dimension.
*/
public static String getDimensionIDFromWorld(WorldWrapper world)
public static String getDimensionIDFromWorld(IWorldWrapper world)
{
if (mc.hasSinglePlayerServer())
{
// this will return the world save location
// and the dimension folder
WorldWrapper serverWorld = LodUtil.getServerWorldFromDimension(world.getDimensionType());
IWorldWrapper serverWorld = LodUtil.getServerWorldFromDimension(world.getDimensionType());
if (serverWorld == null)
throw new NullPointerException("getDimensionIDFromWorld wasn't able to get the WorldWrapper for the dimension " + world.getDimensionType().getDimensionName());
@@ -0,0 +1,38 @@
/*
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
* licensed under the GNU GPL v3 License.
*
* Copyright (C) 2020 James Seibel
*
* This program 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, version 3.
*
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.core.wrapperAdapters.world;
import com.seibel.lod.wrappers.block.BlockPosWrapper;
import com.seibel.lod.wrappers.world.WorldWrapper;
/**
*
* @author Cola?
* @version 11-15-2021
*/
public interface IBiomeColorWrapperSingleton
{
public IBiomeColorWrapperSingleton getInstance();
public int getGrassColor(WorldWrapper world, BlockPosWrapper blockPos);
public int getWaterColor(WorldWrapper world, BlockPosWrapper blockPos);
public int getFoliageColor(WorldWrapper world, BlockPosWrapper blockPos);
}
@@ -0,0 +1,20 @@
package com.seibel.lod.core.wrapperAdapters.world;
/**
* This class wraps the minecraft BlockPos.Mutable (and BlockPos) class
*
* @author James Seibel
* @version 11-15-2021
*/
public interface IBiomeWrapper
{
/** Returns a color int for the given biome. */
public int getColorForBiome(int x, int z);
public int getGrassTint(int x, int z);
public int getFolliageTint();
public int getWaterTint();
}
@@ -0,0 +1,16 @@
package com.seibel.lod.core.wrapperAdapters.world;
/**
*
*
* @author James Seibel
* @version 11-15-2021
*/
public interface IDimensionTypeWrapper
{
public String getDimensionName();
public boolean hasCeiling();
public boolean hasSkyLight();
}
@@ -0,0 +1,35 @@
package com.seibel.lod.core.wrapperAdapters.world;
import java.io.File;
import com.seibel.lod.wrappers.block.BlockPosWrapper;
/**
*
* @author James Seibel
* @author ??
* @version 11-15-2021
*/
public interface IWorldWrapper
{
public IDimensionTypeWrapper getDimensionType();
public int getBlockLight(BlockPosWrapper blockPos);
public int getSkyLight(BlockPosWrapper blockPos);
public IBiomeWrapper getBiome(BlockPosWrapper blockPos);
public boolean hasCeiling();
public boolean hasSkyLight();
public boolean isEmpty();
public int getHeight();
/** @throws UnsupportedOperationException if the WorldWrapper isn't for a ServerWorld */
public File getSaveFolder() throws UnsupportedOperationException;
}
@@ -27,6 +27,7 @@ import com.seibel.lod.ModInfo;
import com.seibel.lod.api.lod.ClientApi;
import com.seibel.lod.core.enums.LodDirection;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.wrapperAdapters.world.IWorldWrapper;
import com.seibel.lod.wrappers.block.BlockPosWrapper;
import com.seibel.lod.wrappers.chunk.ChunkPosWrapper;
import com.seibel.lod.wrappers.world.DimensionTypeWrapper;
@@ -113,6 +114,7 @@ public class MinecraftWrapper
return mc.hasSingleplayerServer();
}
/** Returns the dimension the player is currently in */
public DimensionTypeWrapper getCurrentDimension()
{
return DimensionTypeWrapper.getDimensionTypeWrapper(mc.player.level.dimensionType());
@@ -294,9 +296,9 @@ public class MinecraftWrapper
}
/** Returns all worlds available to the server */
public ArrayList<WorldWrapper> getAllServerWorlds()
public ArrayList<IWorldWrapper> getAllServerWorlds()
{
ArrayList<WorldWrapper> worlds = new ArrayList<WorldWrapper>();
ArrayList<IWorldWrapper> worlds = new ArrayList<IWorldWrapper>();
Iterable<ServerWorld> serverWorlds = mc.getSingleplayerServer().getAllLevels();
for (ServerWorld world : serverWorlds)
@@ -19,6 +19,7 @@
package com.seibel.lod.wrappers.world;
import com.seibel.lod.core.wrapperAdapters.world.IBiomeColorWrapperSingleton;
import com.seibel.lod.wrappers.block.BlockPosWrapper;
import net.minecraft.world.biome.BiomeColors;
@@ -27,23 +28,32 @@ import net.minecraft.world.biome.BiomeColors;
/**
*
* @author Cola?
* @version 11-12-2021
* @version 11-15-2021
*/
public class BiomeColorWrapper
public class BiomeColorWrapperSingleton implements IBiomeColorWrapperSingleton
{
private static final BiomeColorWrapperSingleton instance = new BiomeColorWrapperSingleton();
public static int getGrassColor(WorldWrapper world, BlockPosWrapper blockPos)
@Override
public IBiomeColorWrapperSingleton getInstance()
{
return instance;
}
@Override
public int getGrassColor(WorldWrapper world, BlockPosWrapper blockPos)
{
return BiomeColors.getAverageGrassColor(world.getWorld(), blockPos.getBlockPos());
}
public static int getWaterColor(WorldWrapper world, BlockPosWrapper blockPos)
@Override
public int getWaterColor(WorldWrapper world, BlockPosWrapper blockPos)
{
return BiomeColors.getAverageWaterColor(world.getWorld(), blockPos.getBlockPos());
}
public static int getFoliageColor(WorldWrapper world, BlockPosWrapper blockPos)
@Override
public int getFoliageColor(WorldWrapper world, BlockPosWrapper blockPos)
{
return BiomeColors.getAverageFoliageColor(world.getWorld(), blockPos.getBlockPos());
}
}
@@ -1,20 +1,25 @@
package com.seibel.lod.wrappers.world;
import com.seibel.lod.core.util.ColorUtil;
import com.seibel.lod.wrappers.block.BlockColorWrapper;
import net.minecraft.block.Blocks;
import net.minecraft.world.biome.Biome;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.seibel.lod.core.util.ColorUtil;
import com.seibel.lod.core.wrapperAdapters.world.IBiomeWrapper;
import com.seibel.lod.wrappers.block.BlockColorWrapper;
//This class wraps the minecraft BlockPos.Mutable (and BlockPos) class
public class BiomeWrapper
import net.minecraft.block.Blocks;
import net.minecraft.world.biome.Biome;
/**
* This class wraps the minecraft BlockPos.Mutable (and BlockPos) class
*
* @author James Seibel
* @version 11-15-2021
*/
public class BiomeWrapper implements IBiomeWrapper
{
public static final ConcurrentMap<Biome, BiomeWrapper> biomeWrapperMap = new ConcurrentHashMap<>();
private final Biome biome;
@@ -40,6 +45,7 @@ public class BiomeWrapper
/** Returns a color int for the given biome. */
@Override
public int getColorForBiome(int x, int z)
{
int colorInt;
@@ -114,16 +120,19 @@ public class BiomeWrapper
return colorInt;
}
@Override
public int getGrassTint(int x, int z)
{
return biome.getGrassColor(x, z);
}
@Override
public int getFolliageTint()
{
return biome.getFoliageColor();
}
@Override
public int getWaterTint()
{
return biome.getWaterColor();
@@ -3,9 +3,16 @@ package com.seibel.lod.wrappers.world;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.seibel.lod.core.wrapperAdapters.world.IDimensionTypeWrapper;
import net.minecraft.world.DimensionType;
public class DimensionTypeWrapper
/**
*
* @author ??
* @version 11-15-2021
*/
public class DimensionTypeWrapper implements IDimensionTypeWrapper
{
private static final ConcurrentMap<DimensionType, DimensionTypeWrapper> dimensionTypeWrapperMap = new ConcurrentHashMap<>();
private final DimensionType dimensionType;
@@ -30,21 +37,19 @@ public class DimensionTypeWrapper
return dimensionTypeWrapper;
}
public static void clearMap()
{
dimensionTypeWrapperMap.clear();
}
@Override
public String getDimensionName()
{
return dimensionType.effectsLocation().getPath();
}
@Override
public boolean hasCeiling()
{
return dimensionType.hasCeiling();
}
@Override
public boolean hasSkyLight()
{
return dimensionType.hasSkyLight();
@@ -5,6 +5,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.seibel.lod.core.enums.WorldType;
import com.seibel.lod.core.wrapperAdapters.world.IWorldWrapper;
import com.seibel.lod.wrappers.block.BlockPosWrapper;
import net.minecraft.client.world.ClientWorld;
@@ -16,9 +17,9 @@ import net.minecraft.world.server.ServerWorld;
*
* @author James Seibel
* @author ??
* @version 11-12-2021
* @version 11-15-2021
*/
public class WorldWrapper
public class WorldWrapper implements IWorldWrapper
{
private static final ConcurrentMap<IWorld, WorldWrapper> worldWrapperMap = new ConcurrentHashMap<>();
private final IWorld world;
@@ -59,21 +60,25 @@ public class WorldWrapper
worldWrapperMap.clear();
}
@Override
public DimensionTypeWrapper getDimensionType()
{
return DimensionTypeWrapper.getDimensionTypeWrapper(world.dimensionType());
}
@Override
public int getBlockLight(BlockPosWrapper blockPos)
{
return world.getLightEngine().blockEngine.getLightValue(blockPos.getBlockPos());
}
@Override
public int getSkyLight(BlockPosWrapper blockPos)
{
return world.getLightEngine().skyEngine.getLightValue(blockPos.getBlockPos());
}
@Override
public BiomeWrapper getBiome(BlockPosWrapper blockPos)
{
return BiomeWrapper.getBiomeWrapper(world.getBiome(blockPos.getBlockPos()));
@@ -84,27 +89,32 @@ public class WorldWrapper
return world;
}
@Override
public boolean hasCeiling()
{
return world.dimensionType().hasCeiling();
}
@Override
public boolean hasSkyLight()
{
return world.dimensionType().hasSkyLight();
}
@Override
public boolean isEmpty()
{
return world == null;
}
@Override
public int getHeight()
{
return world.getHeight();
}
/** @throws UnsupportedOperationException if the WorldWrapper isn't for a ServerWorld */
@Override
public File getSaveFolder() throws UnsupportedOperationException
{
if (worldType != WorldType.ServerWorld)
@@ -13,6 +13,7 @@ import com.seibel.lod.core.builders.lodBuilding.LodBuilderConfig;
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
import com.seibel.lod.core.objects.lod.LodDimension;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.wrapperAdapters.world.IWorldWrapper;
import com.seibel.lod.wrappers.chunk.ChunkPosWrapper;
import com.seibel.lod.wrappers.chunk.ChunkWrapper;
import com.seibel.lod.wrappers.world.WorldWrapper;
@@ -55,14 +56,11 @@ public class WorldGeneratorWrapper
public final LodDimension lodDim;
public final LodBuilder lodBuilder;
// TODO should we have everything static?
// it could potentially remove some (minor) garbage collections
// by just passing in these 3 references
public WorldGeneratorWrapper(LodBuilder newLodBuilder, LodDimension newLodDimension, WorldWrapper worldWrapper)
public WorldGeneratorWrapper(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper)
{
lodBuilder = newLodBuilder;
lodDim = newLodDimension;
serverWorld = worldWrapper.getServerWorld();
serverWorld = ((WorldWrapper) worldWrapper).getServerWorld();
}