Biome fixes

This commit is contained in:
Runemoro 2017-12-18 13:14:50 -05:00
parent 30e735385f
commit 4c7c10f5d3
22 changed files with 405 additions and 340 deletions

View file

@ -8,7 +8,9 @@ import com.zixiken.dimdoors.shared.sound.ModSounds;
import com.zixiken.dimdoors.shared.tileentities.*;
import com.zixiken.dimdoors.shared.util.DefaultSchematicGenerator;
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import com.zixiken.dimdoors.shared.world.ModBiomes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@ -24,10 +26,11 @@ public abstract class DDProxyCommon implements IDDProxy {
MinecraftForge.EVENT_BUS.register(ModItems.class);
MinecraftForge.EVENT_BUS.register(CraftingManager.class); // TODO: ModRecipes?
MinecraftForge.EVENT_BUS.register(ModSounds.class);
MinecraftForge.EVENT_BUS.register(ModBiomes.class);
DimDoorDimensions.init();
DimDoorDimensions.registerDimensions();
GameRegistry.registerTileEntity(TileEntityVerticalEntranceRift.class, "TileEntityVerticalEntranceRift"); // TODO: use new registry
GameRegistry.registerTileEntity(TileEntityVerticalEntranceRift.class, "TileEntityVerticalEntranceRift"); // TODO: new forge registry system?
GameRegistry.registerTileEntity(TileEntityFloatingRift.class, "TileEntityFloatingRift");
GameRegistry.registerTileEntity(TileEntityHorizontalEntranceRift.class, "TileEntityHorizontalEntranceRift");
@ -37,6 +40,7 @@ public abstract class DDProxyCommon implements IDDProxy {
@Override
public void onInitialization(FMLInitializationEvent event) {
SchematicHandler.INSTANCE.loadSchematics();
DefaultSchematicGenerator.generateDefaultSchematics();
}

View file

@ -6,10 +6,13 @@ import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class EventHandler {
@ -25,11 +28,11 @@ public class EventHandler {
}
}
@SubscribeEvent
public static void onLivingFall(LivingFallEvent event) {
@SubscribeEvent(priority = EventPriority.LOWEST) // don't let other mods do something based on the event
public static void onLivingHurt(LivingHurtEvent event) {
Entity entity = event.getEntity();
if (entity.dimension == DimDoorDimensions.LIMBO.getId()) {
event.setCanceled(true); // no fall damage in limbo
if (entity.dimension == DimDoorDimensions.LIMBO.getId() && event.getSource() == DamageSource.FALL) {
event.setCanceled(true);// no fall damage in LIMBO
}
}

View file

@ -291,13 +291,19 @@ public abstract class TileEntityRift extends TileEntity implements ITickable { /
RiftRegistry privateRiftRegistry = RiftRegistry.getForDim(DimDoorDimensions.getPrivateDimID());
/*Pocket*/ pocket = privatePocketRegistry.getPocket(privatePocketRegistry.getPrivatePocketID(uuid));
if (pocket == null) { // generate the private pocket and get its entrance
pocket = PocketGenerator.generatePrivatePocket(virtualLocation != null ? virtualLocation.toBuilder().depth(-2).build() : null); // set to where the pocket was first created TODO: private pocket deletion
pocket = PocketGenerator.generatePrivatePocket(virtualLocation != null ? virtualLocation.toBuilder().depth(-2).build() : null); // set to where the pocket was first created
pocket.setup();
privatePocketRegistry.setPrivatePocketID(uuid, pocket.getId());
destLoc = pocket.getEntrance();
} else {
destLoc = privateRiftRegistry.getPrivatePocketEntrance(uuid); // get the last used entrance
if (destLoc == null) destLoc = pocket.getEntrance(); // if there's none, then set the target to the main entrance
if (destLoc == null) { // if the pocket entrance is gone, then create a new private pocket
pocket = PocketGenerator.generatePrivatePocket(virtualLocation != null ? virtualLocation.toBuilder().depth(-2).build() : null);
pocket.setup();
privatePocketRegistry.setPrivatePocketID(uuid, pocket.getId());
destLoc = pocket.getEntrance();
}
}
// privateRiftRegistry.setPrivatePocketEntrance(uuid, null); // --forget the last entered entrance-- Actually, remember it. We'll eventually store it only in the rift registry, not in the pocket.
} else {
@ -321,7 +327,7 @@ public abstract class TileEntityRift extends TileEntity implements ITickable { /
}
if (destLoc == null) {
if (entity instanceof EntityPlayer) DimDoors.chat((EntityPlayer) entity, "You tried to escape a pocket or leave your private pocket, but you teleported into it!");
return false; // TODO: limbo?
return false; // TODO: LIMBO?
}
} else {
return false; // Non-player/owned entity tried to escape/leave private pocket

View file

@ -1,17 +1,11 @@
package com.zixiken.dimdoors.shared.util;
import com.zixiken.dimdoors.DimDoors;
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
public class WorldUtils {
public static World getWorld(int dim) {
World world = DimDoors.proxy.getWorldServer(dim);
if (world == null) {
throw new RuntimeException("Something went wrong!");
}
return world;
return DimDoors.proxy.getWorldServer(dim);
}
public static int getDim(World world) {

View file

@ -22,14 +22,13 @@ public class DimDoorDimensions {
@Getter private static int maxPocketDimID;
private static final List<EnumPocketType> pocketTypes = new ArrayList<>();
private static final Map<EnumPocketType, DimensionType> pocketDimensionTypes = new HashMap<>();
private static final List<DimensionType> CUSTOM = new ArrayList<>();
@Getter private static int limboDimID;
@Getter private static int privateDimID;
@Getter private static int publicDimID;
@Getter private static int dungeonDimID;
public static void init() {
public static void registerDimensions() { // TODO: new forge registry system?
// Lowercase names because all minecraft dimensions are lowercase, _pockets suffix to make it clear what the world is
minPocketDimID = DDConfig.getBaseDimID();
int dimID = minPocketDimID;
@ -50,14 +49,6 @@ public class DimDoorDimensions {
for (EnumPocketType pocketType : pocketDimensionTypes.keySet()) {
registerDimension(pocketDimensionTypes.get(pocketType));
}
// TODO: For future use? Like, server owners can add their own set of DimDoors DimensionTypes via the configs? Or is this nonsense?
// for (int i = 0; i < 0; i++) {
// dimID++;
// DimensionType tempType = DimensionType.register("Name", "_name", dimID, WorldProvider.class, false);
// CUSTOM.add(tempType);
// registerDimension(tempType);
//}
}
public static void registerDimension(DimensionType dimension) {
@ -68,7 +59,7 @@ public class DimDoorDimensions {
return pocketDimensionTypes.get(pocketType);
}
public static boolean isPocketDimension(int id) {
public static boolean isPocketDimension(int id) { // TODO: also add isPocketDimension(World)?
return id >= minPocketDimID && id <= maxPocketDimID;
}

View file

@ -0,0 +1,34 @@
package com.zixiken.dimdoors.shared.world;
import com.zixiken.dimdoors.DimDoors;
import com.zixiken.dimdoors.shared.world.limbodimension.BiomeLimbo;
import com.zixiken.dimdoors.shared.world.pocketdimension.BiomeBlank;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class ModBiomes {
public static final BiomeLimbo LIMBO = new BiomeLimbo();
public static final BiomeBlank WHITE_VOID = new BiomeBlank(true, false);
public static final BiomeBlank BLACK_VOID = new BiomeBlank(false, false);
public static final BiomeBlank DANGEROUS_BLACK_VOID = new BiomeBlank(false, true);
@SubscribeEvent
public static void registerBiomes(RegistryEvent.Register<Biome> event) {
LIMBO.setRegistryName(new ResourceLocation(DimDoors.MODID, "limbo"));
WHITE_VOID.setRegistryName(new ResourceLocation(DimDoors.MODID, "white_void"));
BLACK_VOID.setRegistryName(new ResourceLocation(DimDoors.MODID, "black_void"));
DANGEROUS_BLACK_VOID.setRegistryName(new ResourceLocation(DimDoors.MODID, "dangerous_black_void"));
event.getRegistry().registerAll(
LIMBO,
WHITE_VOID,
BLACK_VOID,
DANGEROUS_BLACK_VOID);
BiomeDictionary.addTypes(LIMBO, BiomeDictionary.Type.VOID); // TODO: check that this prevents other mods' worldgen (ex. Biomes O' Plenty)
BiomeDictionary.addTypes(WHITE_VOID, BiomeDictionary.Type.VOID);
BiomeDictionary.addTypes(BLACK_VOID, BiomeDictionary.Type.VOID);
BiomeDictionary.addTypes(DANGEROUS_BLACK_VOID, BiomeDictionary.Type.VOID);
}
}

View file

@ -1,22 +0,0 @@
package com.zixiken.dimdoors.shared.world;
import net.minecraft.world.DimensionType;
import net.minecraft.world.WorldProvider;
public class PocketProvider extends WorldProvider {
/*@Override
public String getDimensionName() {
return "Pocket Dimension";
}
@Override
public String getInternalNameSuffix() {
return "_pocket";
}*/
@Override
public DimensionType getDimensionType() {
return DimensionType.OVERWORLD;
}
}

View file

@ -1,26 +0,0 @@
package com.zixiken.dimdoors.shared.world.biomes;
import net.minecraft.world.biome.Biome;
/**
* Created by Jared Johnson on 1/24/2017.
*/
public class DimDoorsBiome extends Biome {
public DimDoorsBiome(String name) {
super(new BiomeProperties(name));
decorator.treesPerChunk = 0;
decorator.flowersPerChunk = 0;
decorator.grassPerChunk = 0;
spawnableMonsterList.clear();
spawnableCreatureList.clear();
spawnableWaterCreatureList.clear();
spawnableCaveCreatureList.clear();
}
@Override
public boolean canRain() {
return false;
}
}

View file

@ -2,7 +2,7 @@ package com.zixiken.dimdoors.shared.world.gateways;
import com.zixiken.dimdoors.shared.DDConfig;
import com.zixiken.dimdoors.shared.blocks.ModBlocks;
import com.zixiken.dimdoors.shared.world.PocketProvider;
import com.zixiken.dimdoors.shared.world.pocketdimension.WorldProviderPocket;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
@ -51,7 +51,7 @@ public class GatewayGenerator implements IWorldGenerator
// Also don't generate anything in the Nether, The End, or in Witchery's Spirit World.
// We only match against Spirit World using hashing to speed up the process a little (hopefully).
int dimensionID = world.provider.getDimension();
if (world.isRemote || (world.provider instanceof PocketProvider) || (dimensionID == END_DIMENSION_ID) || (dimensionID == NETHER_DIMENSION_ID)) {
if (world.isRemote || (world.provider instanceof WorldProviderPocket) || (dimensionID == END_DIMENSION_ID) || (dimensionID == NETHER_DIMENSION_ID)) {
return;
}

View file

@ -8,6 +8,7 @@ public class GatewaySandstonePillars extends BaseSchematicGateway {
super("sandstonePillars");
}
@Override
public Biome[] getBiomes() {
return new Biome[] {Biomes.DESERT, Biomes.DESERT_HILLS, Biomes.MUTATED_DESERT};
}

View file

@ -0,0 +1,60 @@
package com.zixiken.dimdoors.shared.world.limbodimension;
import com.zixiken.dimdoors.shared.entities.EntityMonolith;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Random;
public class BiomeLimbo extends Biome {
public BiomeLimbo() {
super(new Biome.BiomeProperties("Limbo")
.setRainDisabled()
.setRainfall(0)
.setWaterColor(0x000000));
// topBlock = Blocks.AIR.getDefaultState();
// fillerBlock = Blocks.AIR.getDefaultState();
spawnableMonsterList.clear();
spawnableCreatureList.clear();
spawnableWaterCreatureList.clear();
spawnableCaveCreatureList.clear();
spawnableMonsterList.add(new SpawnListEntry(EntityMonolith.class, 100, 4, 4));
flowers.clear();
}
// TODO: move generation here
@Override public BiomeDecorator createBiomeDecorator() { return null; }
@Override public void decorate(World worldIn, Random rand, BlockPos pos) {}
@Override public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {}
@Override
@SideOnly(Side.CLIENT)
public int getSkyColorByTemp(float currentTemperature) { // TODO: what does this do?
return super.getSkyColorByTemp(currentTemperature);
}
// TODO: check that black/white grass and foliage in getModdedBiomeGrassColor is compatible with other mods such as Quark's greener grass option
@Override
@SideOnly(Side.CLIENT)
public int getGrassColorAtPos(BlockPos pos) {
return getModdedBiomeGrassColor(0x000000);
}
@Override
@SideOnly(Side.CLIENT)
public int getFoliageColorAtPos(BlockPos pos) {
return getModdedBiomeFoliageColor(0x000000);
}
}

View file

@ -1,10 +0,0 @@
package com.zixiken.dimdoors.shared.world.limbodimension;
import com.zixiken.dimdoors.shared.world.biomes.DimDoorsBiome;
public class LimboBiome extends DimDoorsBiome {
public LimboBiome() {
super("limbo");
}
}

View file

@ -2,6 +2,7 @@ package com.zixiken.dimdoors.shared.world.limbodimension;
import com.zixiken.dimdoors.shared.blocks.BlockFabric;
import com.zixiken.dimdoors.shared.blocks.ModBlocks;
import com.zixiken.dimdoors.shared.world.ModBiomes;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Biomes;
import net.minecraft.util.math.BlockPos;
@ -53,7 +54,7 @@ public class LimboGenerator implements IChunkGenerator {
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
/** The biomes that are used to generate the chunk */
private Biome[] biomesForGeneration = { new LimboBiome() };
private Biome[] biomesForGeneration = { ModBiomes.LIMBO };
/** A double array that hold terrain noise from noiseGen3 */
double[] noise3;

View file

@ -5,6 +5,7 @@ import com.zixiken.dimdoors.shared.blocks.BlockFabric;
import com.zixiken.dimdoors.shared.blocks.ModBlocks;
import com.zixiken.dimdoors.shared.util.Location;
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import com.zixiken.dimdoors.shared.world.ModBiomes;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -13,7 +14,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.DimensionType;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeProviderSingle;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.fml.relauncher.Side;
@ -21,41 +22,18 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class WorldProviderLimbo extends WorldProvider {
private IRenderHandler skyRenderer;
private LimboBiome limboBiome;
@SideOnly(Side.CLIENT) private final IRenderHandler skyRenderer = new LimboSkyProvider();
@SideOnly(Side.CLIENT) private final IRenderHandler cloudRenderer = new CloudRenderBlank();
public WorldProviderLimbo() {
@Override
public void init() {
hasSkyLight = false;
skyRenderer = new LimboSkyProvider();
limboBiome = new LimboBiome();
//this.spawner
}
@Override
@SideOnly(Side.CLIENT)
public IRenderHandler getSkyRenderer() {
return skyRenderer;
}
@Override
public Biome getBiomeForCoords(BlockPos pos) {
return limboBiome;
biomeProvider = new BiomeProviderSingle(ModBiomes.LIMBO);
}
@Override
public boolean canRespawnHere() {
return false; //properties.HardcoreLimboEnabled;
}
@Override
public boolean isBlockHighHumidity(BlockPos pos)
{
return false;
}
@Override
public boolean canSnowAt(BlockPos pos, boolean checkLight) {
return false;
return false; // TODO: properties.HardcoreLimboEnabled;
}
@Override
@ -64,8 +42,7 @@ public class WorldProviderLimbo extends WorldProvider {
for (int steps = 0; steps <= 15; ++steps) {
float var3 = 1.0F - steps / 15.0F;
lightBrightnessTable[steps] = ((0.0F + var3) / (var3 * 3.0F + 1.0F) * (1.0F - modifier) + modifier)*3;
// System.out.println( this.lightBrightnessTable[steps]+"light");
lightBrightnessTable[steps] = ((0.0F + var3) / (var3 * 3.0F + 1.0F) * (1.0F - modifier) + modifier) * 3;
}
}
@ -79,14 +56,10 @@ public class WorldProviderLimbo extends WorldProvider {
return 0;
}
@SideOnly(Side.CLIENT)
public int getMoonPhase(long par1, float par3) {
return 4;
}
@Override
public String getSaveFolder() {
return "DIM" + getDimension() + "DimDoorsLimbo";
@SideOnly(Side.CLIENT)
public int getMoonPhase(long worldTime) {
return 4;
}
@Override
@ -100,20 +73,6 @@ public class WorldProviderLimbo extends WorldProvider {
return (double) world.getHeight() / 4 - 800;
}
@SideOnly(Side.CLIENT)
@Override
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks)
{
setCloudRenderer( new CloudRenderBlank());
return Vec3d.ZERO;
}
@SideOnly(Side.CLIENT)
@Override
public Vec3d getFogColor(float p_76562_1_, float p_76562_2_) {
return new Vec3d(.2, .2, .2);
}
@Override
public int getRespawnDimension(EntityPlayerMP player) {
return 0;
@ -121,17 +80,12 @@ public class WorldProviderLimbo extends WorldProvider {
@Override
public IChunkGenerator createChunkGenerator() {
return new LimboGenerator(world, 45);
}
@Override
public boolean canBlockFreeze(BlockPos pos, boolean byWater) {
return false;
return new LimboGenerator(world, world.getSeed());
}
public static Location getLimboSkySpawn(EntityPlayer player) {
int x = (int) player.posX + MathHelper.clamp(player.world.rand.nextInt(), -100, 100); //-properties.LimboEntryRange, properties.LimboEntryRange);
int z = (int) player.posZ + MathHelper.clamp(player.world.rand.nextInt(), -100, 100); //-properties.LimboEntryRange, properties.LimboEntryRange);
int x = (int) player.posX + MathHelper.clamp(player.world.rand.nextInt(), -100, 100); // TODO: -properties.LimboEntryRange, properties.LimboEntryRange);
int z = (int) player.posZ + MathHelper.clamp(player.world.rand.nextInt(), -100, 100); // TODO: -properties.LimboEntryRange, properties.LimboEntryRange);
return new Location(DimDoorDimensions.LIMBO.getId(), x, 700, z);
}
@ -146,4 +100,29 @@ public class WorldProviderLimbo extends WorldProvider {
public DimensionType getDimensionType() {
return DimDoorDimensions.LIMBO;
}
@SideOnly(Side.CLIENT)
@Override
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
return Vec3d.ZERO;
}
@SideOnly(Side.CLIENT)
@Override
public Vec3d getFogColor(float celestialAngle, float partialTicks) {
return new Vec3d(.2, .2, .2);
}
@Override
@SideOnly(Side.CLIENT)
public IRenderHandler getSkyRenderer() {
return skyRenderer;
}
@Override
@SideOnly(Side.CLIENT)
public IRenderHandler getCloudRenderer() {
return cloudRenderer;
}
}

View file

@ -0,0 +1,64 @@
package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.shared.entities.EntityMonolith;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Random;
public class BiomeBlank extends Biome {
private boolean white;
public BiomeBlank(boolean white, boolean monoliths) { // TODO: split this class
super(new BiomeProperties((monoliths ? "Dangerous " : "") + (white ? "White" : "Black") + " Void")
.setBaseHeight(0F)
.setHeightVariation(0F)
.setRainDisabled()
.setRainfall(0));
// TODO: set water color too?
this.white = white;
topBlock = Blocks.AIR.getDefaultState();
fillerBlock = Blocks.AIR.getDefaultState();
spawnableMonsterList.clear();
spawnableCreatureList.clear();
spawnableWaterCreatureList.clear();
spawnableCaveCreatureList.clear();
if (monoliths) spawnableMonsterList.add(new SpawnListEntry(EntityMonolith.class, 100, 4, 4));
flowers.clear();
}
@Override public BiomeDecorator createBiomeDecorator() { return null; } // For efficiency
@Override public void decorate(World worldIn, Random rand, BlockPos pos) {}
@Override public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {}
@Override
@SideOnly(Side.CLIENT)
public int getSkyColorByTemp(float currentTemperature) {
return white ? 0xFFFFFF : 0x000000;
}
// TODO: check that black/white grass and foliage in getModdedBiomeGrassColor is compatible with other mods such as Quark's greener grass option
@Override
@SideOnly(Side.CLIENT)
public int getGrassColorAtPos(BlockPos pos) {
return getModdedBiomeGrassColor(white ? 0xFFFFFF : 0x111111);
}
@Override
@SideOnly(Side.CLIENT)
public int getFoliageColorAtPos(BlockPos pos) {
return getModdedBiomeFoliageColor(white ? 0xFFFFFF : 0x111111);
}
}

View file

@ -0,0 +1,47 @@
package com.zixiken.dimdoors.shared.world.pocketdimension;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.gen.IChunkGenerator;
import javax.annotation.Nullable;
import java.util.List;
public class ChunkGeneratorBlank implements IChunkGenerator {
private World world;
public ChunkGeneratorBlank(World world, long seed) {
this.world = world;
}
@Override
public Chunk generateChunk(int x, int z) {
Chunk chunk = new Chunk(world, new ChunkPrimer(), x, z);
if(!chunk.isTerrainPopulated()) chunk.setTerrainPopulated(true);
return chunk;
}
@Override
public void populate(int x, int z) {}
@Override
public boolean generateStructures(Chunk chunkIn, int x, int z) {
return false;
}
@Override @Nullable public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, boolean findUnexplored) { return null; }
@Override public void recreateStructures(Chunk chunkIn, int x, int z) {}
@Override public boolean isInsideStructure(World worldIn, String structureName, BlockPos pos) { return false; }
@Override
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
return world.getBiome(pos).getSpawnableList(creatureType);
}
}

View file

@ -1,69 +0,0 @@
package com.zixiken.dimdoors.shared.world.pocketdimension;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.gen.IChunkGenerator;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public class PocketChunkGenerator implements IChunkGenerator {
private World worldObj;
//private CustomLimboPopulator spawner;
public PocketChunkGenerator(World world, long seed /*CustomLimboPopulator spawner*/) {
worldObj = world;
//this.spawner = spawner;
}
@Override
public Chunk generateChunk(int x, int z) {
ChunkPrimer primer = new ChunkPrimer();
Chunk chunk = new Chunk(worldObj, primer, x, z);
if(!chunk.isTerrainPopulated()) {
chunk.setTerrainPopulated(true);
//spawner.registerChunkForPopulation(worldObj.provider.dimensionId, chunkX, chunkZ);
}
return chunk;
}
@Override
public void populate(int x, int z) {
}
@Override
public boolean generateStructures(Chunk chunkIn, int x, int z) {
return false;
}
@Override
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
return new ArrayList<>();
}
@Nullable
@Override
public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, boolean findUnexplored) {
return null;
}
@Override
public void recreateStructures(Chunk chunkIn, int x, int z) {
}
@Override
public boolean isInsideStructure(World worldIn, String structureName, BlockPos pos) {
return false;
}
}

View file

@ -1,20 +0,0 @@
package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.shared.world.CustomSkyProvider;
import net.minecraft.util.ResourceLocation;
/**
* Created by Jared Johnson on 1/24/2017.
*/
public class PocketSkyProvider extends CustomSkyProvider {
@Override
public ResourceLocation getMoonRenderPath() {
return new ResourceLocation("DimDoors:textures/other/limbo_moon.png");
}
@Override
public ResourceLocation getSunRenderPath() {
return new ResourceLocation("DimDoors:textures/other/limbo_sun.png");
}
}

View file

@ -1,23 +1,44 @@
package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.client.CloudRenderBlank;
import com.zixiken.dimdoors.shared.pockets.EnumPocketType;
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import com.zixiken.dimdoors.shared.world.ModBiomes;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.biome.BiomeProviderSingle;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class WorldProviderDungeonPocket extends WorldProviderPublicPocket {
public class WorldProviderDungeonPocket extends WorldProviderPocket {
@Override
public void init() {
super.init();
biomeProvider = new BiomeProviderSingle(ModBiomes.DANGEROUS_BLACK_VOID);
}
@Override
public EnumPocketType getPocketType() {
return EnumPocketType.DUNGEON;
}
@Override
public String getSaveFolder() {
return "DIM" + getDimension() + "DimDoorsDungeon";
}
@Override
public int getRespawnDimension(EntityPlayerMP player) {
return DimDoorDimensions.LIMBO.getId();
}
@SideOnly(Side.CLIENT)
@Override
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
setCloudRenderer(new CloudRenderBlank());
return Vec3d.ZERO;
}
@Override
@SideOnly(Side.CLIENT)
public Vec3d getFogColor(float celestialAngle, float partialTicks) {
return Vec3d.ZERO;
}
}

View file

@ -2,27 +2,30 @@ package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.client.CloudRenderBlank;
import com.zixiken.dimdoors.shared.pockets.EnumPocketType;
import com.zixiken.dimdoors.shared.world.ModBiomes;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.biome.BiomeProviderSingle;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Created by Jared Johnson on 1/24/2017.
*/
public class WorldProviderPersonalPocket extends WorldProviderPublicPocket {
@SideOnly(Side.CLIENT)
public class WorldProviderPersonalPocket extends WorldProviderPocket {
@Override
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
setCloudRenderer(new CloudRenderBlank());
return new Vec3d(1, 1, 1);
public void init() {
super.init();
biomeProvider = new BiomeProviderSingle(ModBiomes.WHITE_VOID);
}
@Override
public EnumPocketType getPocketType() {
return EnumPocketType.PRIVATE;
}
@Override
protected void generateLightBrightnessTable() {
for (int i = 0; i <= 15; ++i) {
this.lightBrightnessTable[i] = (15);
lightBrightnessTable[i] = 15;
}
}
@ -31,24 +34,20 @@ public class WorldProviderPersonalPocket extends WorldProviderPublicPocket {
return world.getHeight() - 256;
}
@SideOnly(Side.CLIENT)
@Override
public Vec3d getFogColor(float p_76562_1_, float p_76562_2_) {
return new Vec3d(1, 1, 1);
}
@Override
public int getActualHeight() {
return -256;
}
@SideOnly(Side.CLIENT)
@Override
public EnumPocketType getPocketType() {
return EnumPocketType.PRIVATE;
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
return new Vec3d(1, 1, 1);
}
@Override
public String getSaveFolder() {
return "DIM" + getDimension() + "DimDoorsPersonal";
@SideOnly(Side.CLIENT)
public Vec3d getFogColor(float celestialAngle, float partialTicks) {
return new Vec3d(1, 1, 1);
}
}

View file

@ -0,0 +1,71 @@
package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.client.CloudRenderBlank;
import com.zixiken.dimdoors.shared.pockets.EnumPocketType;
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.DimensionType;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
public abstract class WorldProviderPocket extends WorldProvider {
@SideOnly(Side.CLIENT) private final IRenderHandler cloudRenderer = new CloudRenderBlank();
@Override
public void init() {
// TODO: save pocket registry nbt here? (see WorldProviderEnd)
hasSkyLight = true;
}
@Override
public IChunkGenerator createChunkGenerator() {
return new ChunkGeneratorBlank(world, world.getSeed());
}
@Override
public DimensionType getDimensionType() {
return DimDoorDimensions.getPocketDimensionType(getPocketType());
}
@Override public float calculateCelestialAngle(long worldTime, float partialTicks) { return 0.0F; }
@Override public boolean canRespawnHere() { return false; }
@Override public boolean isSurfaceWorld() { return false; }
@Override public boolean canCoordinateBeSpawn(int x, int z) { return true; } // Spawn is set even if it canCoordinateBeSpawn is false after 1000 tries anyway
@Override public int getAverageGroundLevel() { return 15; } // TODO: set this to 10 + yBase in the config
@Override public boolean shouldMapSpin(String entity, double x, double z, double rotation) { return true; }
@Override @Nullable
@SideOnly(Side.CLIENT) public float[] calcSunriseSunsetColors(float celestialAngle, float partialTicks) { return null; }
@Override
@SideOnly(Side.CLIENT)
public IRenderHandler getCloudRenderer() {
return cloudRenderer;
}
@Override @SideOnly(Side.CLIENT) public boolean doesXZShowFog(int x, int z) {
return false; // TODO: set this to true outside of pockets
}
@Override
@SideOnly(Side.CLIENT)
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
return Vec3d.ZERO;
}
@Override @SideOnly(Side.CLIENT) public Vec3d getFogColor(float celestialAngle, float partialTicks) { return Vec3d.ZERO; }
public abstract EnumPocketType getPocketType();
}

View file

@ -2,24 +2,24 @@ package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.client.CloudRenderBlank;
import com.zixiken.dimdoors.shared.pockets.EnumPocketType;
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import com.zixiken.dimdoors.shared.world.ModBiomes;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.DimensionType;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.client.IRenderHandler;
import net.minecraft.world.biome.BiomeProviderSingle;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class WorldProviderPublicPocket extends WorldProvider { //@todo, we might want an abstract super class to this one?
public class WorldProviderPublicPocket extends WorldProviderPocket {
//protected CustomLimboPopulator spawner;
protected IRenderHandler skyRenderer;
@Override
public void init() {
super.init();
biomeProvider = new BiomeProviderSingle(ModBiomes.BLACK_VOID);
}
public WorldProviderPublicPocket() {
hasSkyLight = true;
@Override
public EnumPocketType getPocketType() {
return EnumPocketType.PUBLIC;
}
@SideOnly(Side.CLIENT)
@ -29,72 +29,9 @@ public class WorldProviderPublicPocket extends WorldProvider { //@todo, we might
return Vec3d.ZERO;
}
@SideOnly(Side.CLIENT)
@Override
public Vec3d getFogColor(float p_76562_1_, float p_76562_2_) {
@SideOnly(Side.CLIENT)
public Vec3d getFogColor(float celestialAngle, float partialTicks) {
return Vec3d.ZERO;
}
@Override
public double getHorizon() {
return world.getHeight();
}
@Override
public IChunkGenerator createChunkGenerator() {
return new PocketChunkGenerator(world, 0); //, spawner);
}
@Override
public boolean canSnowAt(BlockPos pos, boolean checkLight) {
return false;
}
@Override
public boolean canBlockFreeze(BlockPos pos, boolean byWater) {
return false;
}
@Override
public float calculateCelestialAngle(long worldTime, float partialTicks) {
return .5F;
}
@Override
public boolean isSurfaceWorld() {
return false;
}
/*@Override
protected void generateLightBrightnessTable() {
for (int steps = 0; steps <= 15; ++steps) {
float var3 = (float) (Math.pow(steps, 1.5) / Math.pow(15.0F, 1.5));
this.lightBrightnessTable[15 - steps] = var3;
System.out.println(this.lightBrightnessTable[steps] + "light");
}
}*/
@Override
public boolean canRespawnHere() {
return false;
}
@Override
public int getActualHeight() {
return 256;
}
public EnumPocketType getPocketType() {
return EnumPocketType.PUBLIC;
}
@Override
public String getSaveFolder() {
return "DIM" + getDimension() + "DimDoorsPublic";
}
@Override
public DimensionType getDimensionType() {
return DimDoorDimensions.getPocketDimensionType(getPocketType());
}
}