THE UPDATE
Merging months of dev work into master. The update is playable, but untested.
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||
import net.minecraft.entity.monster.EntitySpider;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.SpawnListEntry;
|
||||
|
||||
public class BiomeGenLimbo extends BiomeGenBase
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.SpawnListEntry;
|
||||
|
||||
public class BiomeGenPocket extends BiomeGenBase
|
||||
{
|
||||
|
||||
232
StevenDimDoors/mod_pocketDim/world/CustomSkyProvider.java
Normal file
232
StevenDimDoors/mod_pocketDim/world/CustomSkyProvider.java
Normal file
@@ -0,0 +1,232 @@
|
||||
package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
|
||||
public class CustomSkyProvider extends IRenderHandler
|
||||
{
|
||||
|
||||
int starGLCallList;
|
||||
int glSkyList;
|
||||
int glSkyList2;
|
||||
|
||||
|
||||
public String getMoonRenderPath()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getSunRenderPath()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void render(float par1, WorldClient world, Minecraft mc)
|
||||
{
|
||||
|
||||
starGLCallList = GLAllocation.generateDisplayLists(3);
|
||||
glSkyList = this.starGLCallList + 1;
|
||||
glSkyList2 = this.starGLCallList + 2;
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDepthMask(false);
|
||||
mc.renderEngine.bindTexture("/misc/tunnel.png");
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (mc.theWorld.provider.isSurfaceWorld())
|
||||
{
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, par1);
|
||||
float f1 = (float)vec3.xCoord;
|
||||
float f2 = (float)vec3.yCoord;
|
||||
float f3 = (float)vec3.zCoord;
|
||||
float f4;
|
||||
|
||||
if (mc.gameSettings.anaglyph)
|
||||
{
|
||||
float f5 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
f4 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f5;
|
||||
f2 = f6;
|
||||
f3 = f4;
|
||||
}
|
||||
|
||||
GL11.glColor3f(f1, f2, f3);
|
||||
Tessellator tessellator1 = Tessellator.instance;
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_FOG);
|
||||
GL11.glColor3f(f1, f2, f3);
|
||||
GL11.glCallList(this.glSkyList);
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(par1), par1);
|
||||
float f7;
|
||||
float f8;
|
||||
float f9;
|
||||
float f10;
|
||||
|
||||
if (afloat != null)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(par1)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
f4 = afloat[0];
|
||||
f7 = afloat[1];
|
||||
f8 = afloat[2];
|
||||
float f11;
|
||||
|
||||
if (mc.gameSettings.anaglyph)
|
||||
{
|
||||
f9 = (f4 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
|
||||
f10 = (f4 * 30.0F + f7 * 70.0F) / 100.0F;
|
||||
f11 = (f4 * 30.0F + f8 * 70.0F) / 100.0F;
|
||||
f4 = f9;
|
||||
f7 = f10;
|
||||
f8 = f11;
|
||||
}
|
||||
|
||||
tessellator1.startDrawing(6);
|
||||
tessellator1.setColorRGBA_F(f4, f7, f8, afloat[3]);
|
||||
tessellator1.addVertex(0.0D, 100.0D, 0.0D);
|
||||
byte b0 = 16;
|
||||
tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);
|
||||
|
||||
for (int j = 0; j <= b0; ++j)
|
||||
{
|
||||
f11 = (float)j * (float)Math.PI * 2.0F / (float)b0;
|
||||
float f12 = MathHelper.sin(f11);
|
||||
float f13 = MathHelper.cos(f11);
|
||||
tessellator1.addVertex((double)(f12 * 120.0F), (double)(f13 * 120.0F), (double)(-f13 * 40.0F * afloat[3]));
|
||||
}
|
||||
|
||||
tessellator1.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glPushMatrix();
|
||||
f4 = 1.0F - world.getRainStrength(par1);
|
||||
f7 = 0.0F;
|
||||
f8 = 0.0F;
|
||||
f9 = 0.0F;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, f4);
|
||||
GL11.glTranslatef(f7, f8, f9);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(world.getCelestialAngle(par1) * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
f10 = 30.0F;
|
||||
mc.renderEngine.bindTexture(this.getSunRenderPath());
|
||||
tessellator1.startDrawingQuads();
|
||||
tessellator1.addVertexWithUV((double)(-f10), 100.0D, (double)(-f10), 0.0D, 0.0D);
|
||||
tessellator1.addVertexWithUV((double)f10, 100.0D, (double)(-f10), 1.0D, 0.0D);
|
||||
tessellator1.addVertexWithUV((double)f10, 100.0D, (double)f10, 1.0D, 1.0D);
|
||||
tessellator1.addVertexWithUV((double)(-f10), 100.0D, (double)f10, 0.0D, 1.0D);
|
||||
tessellator1.draw();
|
||||
f10 = 20.0F;
|
||||
mc.renderEngine.bindTexture(this.getMoonRenderPath());
|
||||
int k = world.getMoonPhase();
|
||||
int l = k % 4;
|
||||
int i1 = k / 4 % 2;
|
||||
float f14 = (float)(l + 0) ;
|
||||
float f15 = (float)(i1 + 0);
|
||||
float f16 = (float)(l + 1) ;
|
||||
float f17 = (float)(i1 + 1);
|
||||
tessellator1.startDrawingQuads();
|
||||
tessellator1.addVertexWithUV((double)(-f10), -100.0D, (double)f10, (double)f16, (double)f17);
|
||||
tessellator1.addVertexWithUV((double)f10, -100.0D, (double)f10, (double)f14, (double)f17);
|
||||
tessellator1.addVertexWithUV((double)f10, -100.0D, (double)(-f10), (double)f14, (double)f15);
|
||||
tessellator1.addVertexWithUV((double)(-f10), -100.0D, (double)(-f10), (double)f16, (double)f15);
|
||||
tessellator1.draw();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
float f18 = world.getStarBrightness(par1) * f4;
|
||||
|
||||
if (f18 > 0.0F)
|
||||
{
|
||||
GL11.glColor4f(f18, f18, f18, f18);
|
||||
GL11.glCallList(this.starGLCallList);
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_FOG);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glColor3f(0.0F, 0.0F, 0.0F);
|
||||
double d0 = mc.thePlayer.getPosition(par1).yCoord - world.getHorizon();
|
||||
|
||||
if (d0 < 0.0D)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 12.0F, 0.0F);
|
||||
GL11.glCallList(this.glSkyList2);
|
||||
GL11.glPopMatrix();
|
||||
f8 = 1.0F;
|
||||
f9 = -((float)(d0 + 65.0D));
|
||||
f10 = -f8;
|
||||
tessellator1.startDrawingQuads();
|
||||
tessellator1.setColorRGBA_I(0, 255);
|
||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f9, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)f8, (double)f9, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)(-f8));
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f9, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f9, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)f8);
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)(-f8));
|
||||
tessellator1.draw();
|
||||
}
|
||||
|
||||
if (world.provider.isSkyColored())
|
||||
{
|
||||
GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColor3f(f1, f2, f3);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, -((float)(d0 - 16.0D)), 0.0F);
|
||||
GL11.glCallList(this.glSkyList2);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
237
StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java
Normal file
237
StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java
Normal file
@@ -0,0 +1,237 @@
|
||||
package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
|
||||
public class GatewayGenerator implements IWorldGenerator
|
||||
{
|
||||
public static final int MAX_GATEWAY_GENERATION_CHANCE = 10000;
|
||||
public static final int MAX_CLUSTER_GENERATION_CHANCE = 10000;
|
||||
private static final int CLUSTER_GROWTH_CHANCE = 80;
|
||||
private static final int MAX_CLUSTER_GROWTH_CHANCE = 100;
|
||||
private static final int MIN_RIFT_Y = 4;
|
||||
private static final int MAX_RIFT_Y = 250;
|
||||
private static final int CHUNK_LENGTH = 16;
|
||||
private static final int GATEWAY_RADIUS = 4;
|
||||
private static final int MAX_GATEWAY_GENERATION_ATTEMPTS = 10;
|
||||
private static final int NETHER_CHANCE_CORRECTION = 4;
|
||||
private static final int OVERWORLD_DIMENSION_ID = 0;
|
||||
private static final int NETHER_DIMENSION_ID = -1;
|
||||
private static final int END_DIMENSION_ID = 1;
|
||||
|
||||
private final DDProperties properties;
|
||||
|
||||
public GatewayGenerator(DDProperties properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
|
||||
{
|
||||
//Don't generate rifts or gateways if the rift generation flag is disabled,
|
||||
//the current world is a pocket dimension, or the world is remote.
|
||||
//Also don't generate anything in The End.
|
||||
if (world.isRemote || (!properties.WorldRiftGenerationEnabled && !(world.provider instanceof LimboProvider)) ||
|
||||
(world.provider instanceof PocketProvider) || (world.provider.dimensionId == END_DIMENSION_ID))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//This check prevents a crash related to superflat worlds not loading World 0
|
||||
if (DimensionManager.getWorld(OVERWORLD_DIMENSION_ID) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int x, y, z;
|
||||
int attempts;
|
||||
int correction;
|
||||
boolean valid;
|
||||
DimLink link;
|
||||
NewDimData dimension;
|
||||
|
||||
//Check if we're generating things in the Nether
|
||||
if (world.provider.dimensionId == NETHER_DIMENSION_ID)
|
||||
{
|
||||
//The terrain in the Nether makes it much harder for our gateway spawning algorithm to find a spot to place a gateway.
|
||||
//Tests show that only about 15% of attempts succeed. Compensate for this by multiplying the chance of generation
|
||||
//by a correction factor.
|
||||
correction = NETHER_CHANCE_CORRECTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
//No correction
|
||||
correction = 1;
|
||||
}
|
||||
|
||||
//Randomly decide whether to place a cluster of rifts here
|
||||
if (random.nextInt(MAX_CLUSTER_GENERATION_CHANCE) < properties.ClusterGenerationChance)
|
||||
{
|
||||
link = null;
|
||||
dimension = null;
|
||||
do
|
||||
{
|
||||
//Pick a random point on the surface of the chunk
|
||||
x = chunkX * CHUNK_LENGTH + random.nextInt(CHUNK_LENGTH);
|
||||
z = chunkZ * CHUNK_LENGTH + random.nextInt(CHUNK_LENGTH);
|
||||
y = world.getHeightValue(x, z);
|
||||
|
||||
//If the point is within the acceptable altitude range, the block above is empty, and we're
|
||||
//not building on bedrock, then generate a rift there
|
||||
if (y >= MIN_RIFT_Y && y <= MAX_RIFT_Y && world.isAirBlock(x, y + 1, z) &&
|
||||
world.getBlockId(x, y, z) != Block.bedrock.blockID && //<-- Stops Nether roof spawning. DO NOT REMOVE!
|
||||
world.getBlockId(x, y - 1, z) != Block.bedrock.blockID &&
|
||||
world.getBlockId(x, y - 2, z) != Block.bedrock.blockID)
|
||||
{
|
||||
//Create a link. If this is not the first time, create a child link and connect it to the first link.
|
||||
if (link == null)
|
||||
{
|
||||
dimension = PocketManager.getDimensionData(world);
|
||||
link = dimension.createLink(x, y + 1, z, LinkTypes.POCKET);
|
||||
}
|
||||
else
|
||||
{
|
||||
dimension.createChildLink(x, y + 1, z, link);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Randomly decide whether to repeat the process and add another rift to the cluster
|
||||
while (random.nextInt(MAX_CLUSTER_GROWTH_CHANCE) < CLUSTER_GROWTH_CHANCE);
|
||||
}
|
||||
|
||||
//Check if generating structures is enabled and randomly decide whether to place a Rift Gateway here.
|
||||
//This only happens if a rift cluster was NOT generated.
|
||||
else if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < properties.GatewayGenerationChance * correction &&
|
||||
isStructureGenerationAllowed())
|
||||
{
|
||||
valid = false;
|
||||
x = y = z = 0; //Stop the compiler from freaking out
|
||||
|
||||
//Check locations for the gateway until we are satisfied or run out of attempts.
|
||||
for (attempts = 0; attempts < MAX_GATEWAY_GENERATION_ATTEMPTS && !valid; attempts++)
|
||||
{
|
||||
//Pick a random point on the surface of the chunk and check its materials
|
||||
x = chunkX * CHUNK_LENGTH + random.nextInt(CHUNK_LENGTH);
|
||||
z = chunkZ * CHUNK_LENGTH + random.nextInt(CHUNK_LENGTH);
|
||||
y = world.getHeightValue(x, z);
|
||||
valid = checkGatewayLocation(world, x, y, z);
|
||||
}
|
||||
|
||||
//Build the gateway if we found a valid location
|
||||
if (valid)
|
||||
{
|
||||
//Create a partial link to a dungeon.
|
||||
dimension = PocketManager.getDimensionData(world);
|
||||
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON);
|
||||
|
||||
//If the current dimension isn't Limbo, build a Rift Gateway out of Stone Bricks
|
||||
if (dimension.id() != properties.LimboDimensionID)
|
||||
{
|
||||
createStoneGateway(world, x, y, z, random);
|
||||
}
|
||||
else
|
||||
{
|
||||
createLimboGateway(world, x, y, z, properties.LimboBlockID);
|
||||
}
|
||||
|
||||
//Place the shiny transient door into a dungeon
|
||||
ItemDimensionalDoor.placeDoorBlock(world, x, y, z, 0, mod_pocketDim.transientDoor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void createStoneGateway(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
final int blockID = Block.stoneBrick.blockID;
|
||||
|
||||
//Replace some of the ground around the gateway with bricks
|
||||
for (int xc = -GATEWAY_RADIUS; xc <= GATEWAY_RADIUS; xc++)
|
||||
{
|
||||
for (int zc= -GATEWAY_RADIUS; zc <= GATEWAY_RADIUS; zc++)
|
||||
{
|
||||
//Check that the block is supported by an opaque block.
|
||||
//This prevents us from building over a cliff, on the peak of a mountain,
|
||||
//or the surface of the ocean or a frozen lake.
|
||||
if (world.isBlockOpaqueCube(x + xc, y - 2, z + zc))
|
||||
{
|
||||
//Randomly choose whether to place bricks or not. The math is designed so that the
|
||||
//chances of placing a block decrease as we get farther from the gateway's center.
|
||||
if (Math.abs(xc) + Math.abs(zc) < random.nextInt(2) + 3)
|
||||
{
|
||||
//Place Stone Bricks
|
||||
world.setBlock(x + xc, y - 1, z + zc, blockID, 0, 3);
|
||||
}
|
||||
else if (Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 3)
|
||||
{
|
||||
//Place Cracked Stone Bricks
|
||||
world.setBlock(x + xc, y - 1, z + zc, blockID, 2, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Use Chiseled Stone Bricks to top off the pillars around the door
|
||||
world.setBlock(x, y + 2, z + 1, blockID, 3, 3);
|
||||
world.setBlock(x, y + 2, z - 1, blockID, 3, 3);
|
||||
//Build the columns around the door
|
||||
world.setBlock(x, y + 1, z - 1, blockID, 0, 3);
|
||||
world.setBlock(x, y + 1, z + 1, blockID, 0, 3);
|
||||
world.setBlock(x, y, z - 1, blockID, 0, 3);
|
||||
world.setBlock(x, y, z + 1, blockID, 0, 3);
|
||||
}
|
||||
|
||||
private static void createLimboGateway(World world, int x, int y, int z, int blockID)
|
||||
{
|
||||
//Build the gateway out of Unraveled Fabric. Since nearly all the blocks in Limbo are of
|
||||
//that type, there is no point replacing the ground.
|
||||
world.setBlock(x, y + 2, z + 1, blockID, 0, 3);
|
||||
world.setBlock(x, y + 2, z - 1, blockID, 0, 3);
|
||||
|
||||
//Build the columns around the door
|
||||
world.setBlock(x, y + 1, z - 1, blockID, 0, 3);
|
||||
world.setBlock(x, y + 1, z + 1, blockID, 0, 3);
|
||||
world.setBlock(x, y, z - 1, blockID, 0, 3);
|
||||
world.setBlock(x, y, z + 1, blockID, 0, 3);
|
||||
}
|
||||
|
||||
private static boolean checkGatewayLocation(World world, int x, int y, int z)
|
||||
{
|
||||
//Check if the point is within the acceptable altitude range, the block above that point is empty,
|
||||
//and the block two levels down is opaque and has a reasonable material. Plus that we're not building
|
||||
//on top of bedrock.
|
||||
return (y >= MIN_RIFT_Y &&
|
||||
y <= MAX_RIFT_Y &&
|
||||
world.isAirBlock(x, y + 1, z) &&
|
||||
world.getBlockId(x, y, z) != Block.bedrock.blockID && //<-- Stops Nether roof spawning. DO NOT REMOVE!
|
||||
world.getBlockId(x, y - 1, z) != Block.bedrock.blockID &&
|
||||
checkFoundationMaterial(world, x, y - 2, z));
|
||||
}
|
||||
|
||||
private static boolean checkFoundationMaterial(World world, int x, int y, int z)
|
||||
{
|
||||
//We check the material and opacity to prevent generating gateways on top of trees or houses,
|
||||
//or on top of strange things like tall grass, water, slabs, or torches.
|
||||
//We also want to avoid generating things on top of the Nether's bedrock!
|
||||
Material material = world.getBlockMaterial(x, y, z);
|
||||
return (material != Material.leaves && material != Material.wood && material != Material.pumpkin
|
||||
&& world.isBlockOpaqueCube(x, y, z) && world.getBlockId(x, y, z) != Block.bedrock.blockID);
|
||||
}
|
||||
|
||||
private static boolean isStructureGenerationAllowed()
|
||||
{
|
||||
return DimensionManager.getWorld(OVERWORLD_DIMENSION_ID).getWorldInfo().isMapFeaturesEnabled();
|
||||
}
|
||||
}
|
||||
@@ -12,18 +12,12 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||
import net.minecraft.world.gen.MapGenBase;
|
||||
import net.minecraft.world.gen.MapGenRavine;
|
||||
import net.minecraft.world.gen.NoiseGeneratorOctaves;
|
||||
import net.minecraft.world.gen.feature.MapGenScatteredFeature;
|
||||
import net.minecraft.world.gen.structure.MapGenMineshaft;
|
||||
import net.minecraft.world.gen.structure.MapGenStronghold;
|
||||
import net.minecraft.world.gen.structure.MapGenVillage;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
|
||||
|
||||
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
|
||||
@@ -46,8 +40,6 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
||||
public NoiseGeneratorOctaves noiseGen5;
|
||||
|
||||
public World world;
|
||||
private final byte[] field_82700_c = new byte[256];
|
||||
private final byte[] field_82698_d = new byte[256];
|
||||
|
||||
/** A NoiseGeneratorOctaves used in generating terrain */
|
||||
public NoiseGeneratorOctaves noiseGen6;
|
||||
@@ -56,27 +48,11 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
||||
/** Reference to the World object. */
|
||||
private World worldObj;
|
||||
|
||||
/** are map structures going to be generated (e.g. strongholds) */
|
||||
private final boolean mapFeaturesEnabled = false;
|
||||
|
||||
/** Holds the overall noise array used in chunk generation */
|
||||
private double[] noiseArray;
|
||||
private double[] stoneNoise = new double[256];
|
||||
private MapGenBase caveGenerator = new CustomCaveGen();
|
||||
|
||||
/** Holds Stronghold Generator */
|
||||
private MapGenStronghold strongholdGenerator = new MapGenStronghold();
|
||||
|
||||
/** Holds Village Generator */
|
||||
private MapGenVillage villageGenerator = new MapGenVillage();
|
||||
|
||||
/** Holds Mineshaft Generator */
|
||||
private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
|
||||
|
||||
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
|
||||
|
||||
/** Holds ravine generator */
|
||||
private MapGenBase ravineGenerator = new MapGenRavine();
|
||||
|
||||
/** The biomes that are used to generate the chunk */
|
||||
private BiomeGenBase[] biomesForGeneration = new BiomeGenBase[1];
|
||||
|
||||
@@ -137,10 +113,11 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean chunkExists(int var1, int var2) {
|
||||
// TODO Auto-generated method stub
|
||||
public boolean chunkExists(int var1, int var2)
|
||||
{
|
||||
return super.chunkExists(var1, var2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
@@ -163,21 +165,26 @@ public class LimboProvider extends WorldProvider
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getRandomizedSpawnPoint()
|
||||
public static ChunkCoordinates getLimboSkySpawn(Random rand)
|
||||
{
|
||||
ChunkCoordinates var5 = new ChunkCoordinates(0,0,0);
|
||||
|
||||
|
||||
int spawnFuzz = 10000;
|
||||
int spawnFuzz = 1000;
|
||||
int spawnFuzzHalf = spawnFuzz / 2;
|
||||
|
||||
{
|
||||
var5.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
|
||||
var5.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
|
||||
var5.posX += rand.nextInt(spawnFuzz) - spawnFuzzHalf;
|
||||
var5.posZ += rand.nextInt(spawnFuzz) - spawnFuzzHalf;
|
||||
var5.posY = 700;
|
||||
}
|
||||
|
||||
return var5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getRandomizedSpawnPoint()
|
||||
{
|
||||
return getLimboSkySpawn(this.worldObj.rand);
|
||||
}
|
||||
}
|
||||
@@ -11,211 +11,17 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
|
||||
public class LimboSkyProvider extends IRenderHandler
|
||||
public class LimboSkyProvider extends CustomSkyProvider
|
||||
{
|
||||
|
||||
int starGLCallList;
|
||||
int glSkyList;
|
||||
int glSkyList2;
|
||||
|
||||
|
||||
@Override
|
||||
public void render(float par1, WorldClient world, Minecraft mc)
|
||||
public String getMoonRenderPath()
|
||||
{
|
||||
|
||||
starGLCallList = GLAllocation.generateDisplayLists(3);
|
||||
glSkyList = this.starGLCallList + 1;
|
||||
glSkyList2 = this.starGLCallList + 2;
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDepthMask(false);
|
||||
mc.renderEngine.bindTexture("/misc/tunnel.png");
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (mc.theWorld.provider.isSurfaceWorld())
|
||||
{
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, par1);
|
||||
float f1 = (float)vec3.xCoord;
|
||||
float f2 = (float)vec3.yCoord;
|
||||
float f3 = (float)vec3.zCoord;
|
||||
float f4;
|
||||
|
||||
if (mc.gameSettings.anaglyph)
|
||||
{
|
||||
float f5 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
f4 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f5;
|
||||
f2 = f6;
|
||||
f3 = f4;
|
||||
}
|
||||
|
||||
GL11.glColor3f(f1, f2, f3);
|
||||
Tessellator tessellator1 = Tessellator.instance;
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_FOG);
|
||||
GL11.glColor3f(f1, f2, f3);
|
||||
GL11.glCallList(this.glSkyList);
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(par1), par1);
|
||||
float f7;
|
||||
float f8;
|
||||
float f9;
|
||||
float f10;
|
||||
|
||||
if (afloat != null)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(par1)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
f4 = afloat[0];
|
||||
f7 = afloat[1];
|
||||
f8 = afloat[2];
|
||||
float f11;
|
||||
|
||||
if (mc.gameSettings.anaglyph)
|
||||
{
|
||||
f9 = (f4 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
|
||||
f10 = (f4 * 30.0F + f7 * 70.0F) / 100.0F;
|
||||
f11 = (f4 * 30.0F + f8 * 70.0F) / 100.0F;
|
||||
f4 = f9;
|
||||
f7 = f10;
|
||||
f8 = f11;
|
||||
}
|
||||
|
||||
tessellator1.startDrawing(6);
|
||||
tessellator1.setColorRGBA_F(f4, f7, f8, afloat[3]);
|
||||
tessellator1.addVertex(0.0D, 100.0D, 0.0D);
|
||||
byte b0 = 16;
|
||||
tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);
|
||||
|
||||
for (int j = 0; j <= b0; ++j)
|
||||
{
|
||||
f11 = (float)j * (float)Math.PI * 2.0F / (float)b0;
|
||||
float f12 = MathHelper.sin(f11);
|
||||
float f13 = MathHelper.cos(f11);
|
||||
tessellator1.addVertex((double)(f12 * 120.0F), (double)(f13 * 120.0F), (double)(-f13 * 40.0F * afloat[3]));
|
||||
}
|
||||
|
||||
tessellator1.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glPushMatrix();
|
||||
f4 = 1.0F - world.getRainStrength(par1);
|
||||
f7 = 0.0F;
|
||||
f8 = 0.0F;
|
||||
f9 = 0.0F;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, f4);
|
||||
GL11.glTranslatef(f7, f8, f9);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(world.getCelestialAngle(par1) * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
f10 = 30.0F;
|
||||
mc.renderEngine.bindTexture("/mods/DimDoors/textures/other/limboSun.png");
|
||||
tessellator1.startDrawingQuads();
|
||||
tessellator1.addVertexWithUV((double)(-f10), 100.0D, (double)(-f10), 0.0D, 0.0D);
|
||||
tessellator1.addVertexWithUV((double)f10, 100.0D, (double)(-f10), 1.0D, 0.0D);
|
||||
tessellator1.addVertexWithUV((double)f10, 100.0D, (double)f10, 1.0D, 1.0D);
|
||||
tessellator1.addVertexWithUV((double)(-f10), 100.0D, (double)f10, 0.0D, 1.0D);
|
||||
tessellator1.draw();
|
||||
f10 = 20.0F;
|
||||
mc.renderEngine.bindTexture("/mods/DimDoors/textures/other/limboMoon.png");
|
||||
int k = world.getMoonPhase();
|
||||
int l = k % 4;
|
||||
int i1 = k / 4 % 2;
|
||||
float f14 = (float)(l + 0) ;
|
||||
float f15 = (float)(i1 + 0);
|
||||
float f16 = (float)(l + 1) ;
|
||||
float f17 = (float)(i1 + 1);
|
||||
tessellator1.startDrawingQuads();
|
||||
tessellator1.addVertexWithUV((double)(-f10), -100.0D, (double)f10, (double)f16, (double)f17);
|
||||
tessellator1.addVertexWithUV((double)f10, -100.0D, (double)f10, (double)f14, (double)f17);
|
||||
tessellator1.addVertexWithUV((double)f10, -100.0D, (double)(-f10), (double)f14, (double)f15);
|
||||
tessellator1.addVertexWithUV((double)(-f10), -100.0D, (double)(-f10), (double)f16, (double)f15);
|
||||
tessellator1.draw();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
float f18 = world.getStarBrightness(par1) * f4;
|
||||
|
||||
if (f18 > 0.0F)
|
||||
{
|
||||
GL11.glColor4f(f18, f18, f18, f18);
|
||||
GL11.glCallList(this.starGLCallList);
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_FOG);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glColor3f(0.0F, 0.0F, 0.0F);
|
||||
double d0 = mc.thePlayer.getPosition(par1).yCoord - world.getHorizon();
|
||||
|
||||
if (d0 < 0.0D)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, 12.0F, 0.0F);
|
||||
GL11.glCallList(this.glSkyList2);
|
||||
GL11.glPopMatrix();
|
||||
f8 = 1.0F;
|
||||
f9 = -((float)(d0 + 65.0D));
|
||||
f10 = -f8;
|
||||
tessellator1.startDrawingQuads();
|
||||
tessellator1.setColorRGBA_I(0, 255);
|
||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f9, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)f8, (double)f9, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)(-f8));
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f9, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f9, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f9, (double)f8);
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)(-f8));
|
||||
tessellator1.addVertex((double)(-f8), (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)f8);
|
||||
tessellator1.addVertex((double)f8, (double)f10, (double)(-f8));
|
||||
tessellator1.draw();
|
||||
}
|
||||
|
||||
if (world.provider.isSkyColored())
|
||||
{
|
||||
GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColor3f(f1, f2, f3);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F, -((float)(d0 - 16.0D)), 0.0F);
|
||||
GL11.glCallList(this.glSkyList2);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDepthMask(true);
|
||||
}
|
||||
|
||||
return "/mods/DimDoors/textures/other/limboMoon.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSunRenderPath()
|
||||
{
|
||||
return "/mods/DimDoors/textures/other/limboSun.png";
|
||||
}
|
||||
}
|
||||
519
StevenDimDoors/mod_pocketDim/world/PocketBuilder.java
Normal file
519
StevenDimDoors/mod_pocketDim/world/PocketBuilder.java
Normal file
@@ -0,0 +1,519 @@
|
||||
package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||
import StevenDimDoors.mod_pocketDim.blocks.DimensionalDoor;
|
||||
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.DungeonData;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.DungeonSchematic;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfig;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
|
||||
import StevenDimDoors.mod_pocketDim.util.Pair;
|
||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
|
||||
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
|
||||
|
||||
public class PocketBuilder
|
||||
{
|
||||
public static final int MIN_POCKET_SIZE = 5;
|
||||
public static final int MAX_POCKET_SIZE = 51;
|
||||
public static final int DEFAULT_POCKET_SIZE = 39;
|
||||
|
||||
public static final int MIN_POCKET_WALL_THICKNESS = 1;
|
||||
public static final int MAX_POCKET_WALL_THICKNESS = 10;
|
||||
public static final int DEFAULT_POCKET_WALL_THICKNESS = 5;
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
private PocketBuilder() { }
|
||||
|
||||
/**
|
||||
* Method that takes an arbitrary link into a dungeon pocket and tries to regenerate it. First uses the origin to find that link,
|
||||
* then uses that link to find the link that originally created the dungeon. If it cant find any of these, it
|
||||
* instead makes the link that lead to this point into an exit door style link, sending the player to the overworld.
|
||||
* @param dimension The dungeon to be regenerated
|
||||
* @param linkIn The link leading somewhere into the dungeon.
|
||||
* @param properties
|
||||
* @return
|
||||
*/
|
||||
public static boolean regenerateDungeonPocket(NewDimData dimension, DimLink linkIn, DDProperties properties)
|
||||
{
|
||||
if (linkIn == null)
|
||||
{
|
||||
throw new IllegalArgumentException("link cannot be null.");
|
||||
}
|
||||
if (properties == null)
|
||||
{
|
||||
throw new IllegalArgumentException("properties cannot be null.");
|
||||
}
|
||||
//The link that is at the origin of the dungeon
|
||||
DimLink originLink = dimension.getLink(dimension.origin());
|
||||
Point4D oldLinkPos = linkIn.source();
|
||||
if(originLink==null)
|
||||
{
|
||||
int orientation = linkIn.orientation();
|
||||
originLink=dimension.createLink(oldLinkPos, LinkTypes.SAFE_EXIT, (orientation+2)%4);
|
||||
return false;
|
||||
}
|
||||
//The link that originally created the dungeon on the way in
|
||||
DimLink incomingLink = PocketManager.getLink(originLink.destination());
|
||||
if(incomingLink==null||incomingLink.linkType()!=LinkTypes.DUNGEON||!(originLink.linkType()==LinkTypes.REVERSE))
|
||||
{
|
||||
int orientation = linkIn.orientation();
|
||||
dimension.deleteLink(originLink);
|
||||
dimension.createLink(oldLinkPos, LinkTypes.SAFE_EXIT, (orientation+2)%4);
|
||||
return false;
|
||||
}
|
||||
NewDimData parent = PocketManager.getDimensionData(incomingLink.source().getDimension());
|
||||
|
||||
if (!dimension.isDungeon())
|
||||
{
|
||||
throw new IllegalArgumentException("destination must be dungeon");
|
||||
}
|
||||
if (dimension.isFilled())
|
||||
{
|
||||
throw new IllegalArgumentException("destination must be empty");
|
||||
}
|
||||
if (!dimension.isInitialized())
|
||||
{
|
||||
throw new IllegalArgumentException("destination must already exist");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//Load a world
|
||||
World world = PocketManager.loadDimension(dimension.id());
|
||||
|
||||
if (world == null || world.provider == null)
|
||||
{
|
||||
System.err.println("Could not initialize dimension for a dungeon!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Point3D destination = new Point3D(incomingLink.destination());
|
||||
loadAndValidateDungeon(dimension.dungeon(),properties).copyToWorld(world, destination, originLink.orientation(), incomingLink, random);
|
||||
dimension.setFilled(true);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static boolean generateNewDungeonPocket(DimLink link, DDProperties properties)
|
||||
{
|
||||
if (link == null)
|
||||
{
|
||||
throw new IllegalArgumentException("link cannot be null.");
|
||||
}
|
||||
if (properties == null)
|
||||
{
|
||||
throw new IllegalArgumentException("properties cannot be null.");
|
||||
}
|
||||
|
||||
if (link.hasDestination())
|
||||
{
|
||||
throw new IllegalArgumentException("link cannot have a destination assigned already.");
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
//Register a new dimension
|
||||
NewDimData parent = PocketManager.getDimensionData(link.source().getDimension());
|
||||
NewDimData dimension = PocketManager.registerPocket(parent, true);
|
||||
|
||||
//Load a world
|
||||
World world = PocketManager.loadDimension(dimension.id());
|
||||
|
||||
if (world == null || world.provider == null)
|
||||
{
|
||||
System.err.println("Could not initialize dimension for a dungeon!");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Choose a dungeon to generate
|
||||
Pair<DungeonData, DungeonSchematic> pair = selectDungeon(dimension, random, properties);
|
||||
if (pair == null)
|
||||
{
|
||||
System.err.println("Could not select a dungeon for generation!");
|
||||
return false;
|
||||
}
|
||||
DungeonData dungeon = pair.getFirst();
|
||||
DungeonSchematic schematic = pair.getSecond();
|
||||
|
||||
//Calculate the destination point
|
||||
DungeonPackConfig packConfig = dungeon.dungeonType().Owner != null ? dungeon.dungeonType().Owner.getConfig() : null;
|
||||
Point4D source = link.source();
|
||||
int orientation = getDoorOrientation(source, properties);
|
||||
Point3D destination;
|
||||
|
||||
if (packConfig != null && packConfig.doDistortDoorCoordinates())
|
||||
{
|
||||
destination = calculateNoisyDestination(source, dimension, dungeon, orientation);
|
||||
}
|
||||
else
|
||||
{
|
||||
destination = new Point3D(source.getX(), source.getY(), source.getZ());
|
||||
}
|
||||
|
||||
destination.setY( yCoordHelper.adjustDestinationY(destination.getY(), world.getHeight(), schematic.getEntranceDoorLocation().getY(), schematic.getHeight()) );
|
||||
|
||||
//Generate the dungeon
|
||||
schematic.copyToWorld(world, destination, orientation, link, random);
|
||||
|
||||
//Finish up destination initialization
|
||||
dimension.initializeDungeon(destination.getX(), destination.getY(), destination.getZ(), orientation, link, dungeon);
|
||||
dimension.setFilled(true);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static Point3D calculateNoisyDestination(Point4D source, NewDimData dimension, DungeonData dungeon, int orientation)
|
||||
{
|
||||
int depth = NewDimData.calculatePackDepth(dimension.parent(), dungeon);
|
||||
int forwardNoise = MathHelper.getRandomIntegerInRange(random, 10 * depth, 130 * depth);
|
||||
int sidewaysNoise = MathHelper.getRandomIntegerInRange(random, -10 * depth, 10 * depth);
|
||||
|
||||
//Rotate the link destination noise to point in the same direction as the door exit
|
||||
//and add it to the door's location. Use EAST as the reference orientation since linkDestination
|
||||
//is constructed as if pointing East.
|
||||
Point3D linkDestination = new Point3D(forwardNoise, 0, sidewaysNoise);
|
||||
Point3D sourcePoint = new Point3D(source.getX(), source.getY(), source.getZ());
|
||||
Point3D zeroPoint = new Point3D(0, 0, 0);
|
||||
BlockRotator.transformPoint(linkDestination, zeroPoint, orientation - BlockRotator.EAST_DOOR_METADATA, sourcePoint);
|
||||
return linkDestination;
|
||||
}
|
||||
|
||||
private static Pair<DungeonData, DungeonSchematic> selectDungeon(NewDimData dimension, Random random, DDProperties properties)
|
||||
{
|
||||
//We assume the dimension doesn't have a dungeon assigned
|
||||
if (dimension.dungeon() != null)
|
||||
{
|
||||
throw new IllegalArgumentException("dimension cannot have a dungeon assigned already.");
|
||||
}
|
||||
|
||||
DungeonData dungeon = null;
|
||||
DungeonSchematic schematic = null;
|
||||
|
||||
dungeon = DungeonHelper.instance().selectDungeon(dimension, random);
|
||||
|
||||
if (dungeon != null)
|
||||
{
|
||||
schematic = loadAndValidateDungeon(dungeon, properties);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("Could not select a dungeon at all!");
|
||||
}
|
||||
|
||||
if (schematic == null)
|
||||
{
|
||||
//TODO: In the future, remove this dungeon from the generation lists altogether.
|
||||
//That will have to wait until our code is updated to support that more easily.
|
||||
try
|
||||
{
|
||||
System.err.println("Loading the default error dungeon instead...");
|
||||
dungeon = DungeonHelper.instance().getDefaultErrorDungeon();
|
||||
schematic = loadAndValidateDungeon(dungeon, properties);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new Pair<DungeonData, DungeonSchematic>(dungeon, schematic);
|
||||
}
|
||||
|
||||
private static DungeonSchematic loadAndValidateDungeon(DungeonData dungeon, DDProperties properties)
|
||||
{
|
||||
try
|
||||
{
|
||||
DungeonSchematic schematic = dungeon.loadSchematic();
|
||||
|
||||
//Validate the dungeon's dimensions
|
||||
if (hasValidDimensions(schematic))
|
||||
{
|
||||
schematic.applyImportFilters(properties);
|
||||
|
||||
//Check that the dungeon has an entrance or we'll have a crash
|
||||
if (schematic.getEntranceDoorLocation() == null)
|
||||
{
|
||||
System.err.println("The following schematic file does not have an entrance: " + dungeon.schematicPath());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("The following schematic file has dimensions that exceed the maximum permitted dimensions for dungeons: " + dungeon.schematicPath());
|
||||
return null;
|
||||
}
|
||||
return schematic;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("An error occurred while loading the following schematic: " + dungeon.schematicPath());
|
||||
System.err.println(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasValidDimensions(DungeonSchematic schematic)
|
||||
{
|
||||
return (schematic.getWidth() <= DungeonHelper.MAX_DUNGEON_WIDTH &&
|
||||
schematic.getHeight() <= DungeonHelper.MAX_DUNGEON_HEIGHT &&
|
||||
schematic.getLength() <= DungeonHelper.MAX_DUNGEON_LENGTH);
|
||||
}
|
||||
|
||||
public static boolean generateNewPocket(DimLink link, DDProperties properties, Block door)
|
||||
{
|
||||
return generateNewPocket(link, DEFAULT_POCKET_SIZE, DEFAULT_POCKET_WALL_THICKNESS, properties, door);
|
||||
}
|
||||
|
||||
private static int getDoorOrientation(Point4D source, DDProperties properties)
|
||||
{
|
||||
World world = DimensionManager.getWorld(source.getDimension());
|
||||
if (world == null)
|
||||
{
|
||||
throw new IllegalStateException("The link's source world should be loaded!");
|
||||
}
|
||||
|
||||
//Check if the block below that point is actually a door
|
||||
int blockID = world.getBlockId(source.getX(), source.getY() - 1, source.getZ());
|
||||
if (blockID != properties.DimensionalDoorID && blockID != properties.WarpDoorID &&
|
||||
blockID != properties.TransientDoorID &&
|
||||
blockID != properties.GoldDimDoorID)
|
||||
{
|
||||
throw new IllegalStateException("The link's source is not a door block. It should be impossible to traverse a rift without a door!");
|
||||
}
|
||||
|
||||
//Return the orientation portion of its metadata
|
||||
int orientation = world.getBlockMetadata(source.getX(), source.getY() - 1, source.getZ()) & 3;
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public static boolean generateNewPocket(DimLink link, int size, int wallThickness, DDProperties properties, Block door)
|
||||
{
|
||||
if (link == null)
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (properties == null)
|
||||
{
|
||||
throw new IllegalArgumentException("properties cannot be null.");
|
||||
}
|
||||
if (link.hasDestination())
|
||||
{
|
||||
throw new IllegalArgumentException("link cannot have a destination assigned already.");
|
||||
}
|
||||
|
||||
if(door==null)
|
||||
{
|
||||
throw new IllegalArgumentException("Must have a doorItem to gen one!!");
|
||||
|
||||
}
|
||||
|
||||
if (size < MIN_POCKET_SIZE || size > MAX_POCKET_SIZE)
|
||||
{
|
||||
throw new IllegalArgumentException("size must be between " + MIN_POCKET_SIZE + " and " + MAX_POCKET_SIZE + ", inclusive.");
|
||||
}
|
||||
if (wallThickness < MIN_POCKET_WALL_THICKNESS || wallThickness > MAX_POCKET_WALL_THICKNESS)
|
||||
{
|
||||
throw new IllegalArgumentException("wallThickness must be between " + MIN_POCKET_WALL_THICKNESS + " and " + MAX_POCKET_WALL_THICKNESS + ", inclusive.");
|
||||
}
|
||||
if (size % 2 == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("size must be an odd number.");
|
||||
}
|
||||
if (size < 2 * wallThickness + 3)
|
||||
{
|
||||
throw new IllegalArgumentException("size must be large enough to fit the specified wall thickness and some air space.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//Register a new dimension
|
||||
NewDimData parent = PocketManager.getDimensionData(link.source().getDimension());
|
||||
NewDimData dimension = PocketManager.registerPocket(parent, false);
|
||||
|
||||
//Load a world
|
||||
World world = PocketManager.loadDimension(dimension.id());
|
||||
|
||||
if (world == null || world.provider == null)
|
||||
{
|
||||
System.err.println("Could not initialize dimension for a pocket!");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Calculate the destination point
|
||||
Point4D source = link.source();
|
||||
int destinationY = yCoordHelper.adjustDestinationY(source.getY(), world.getHeight(), wallThickness + 1, size);
|
||||
int orientation = getDoorOrientation(source, properties);
|
||||
|
||||
//Place a link leading back out of the pocket
|
||||
DimLink reverseLink = dimension.createLink(source.getX(), destinationY, source.getZ(), LinkTypes.REVERSE);
|
||||
parent.setDestination(reverseLink, source.getX(), source.getY(), source.getZ());
|
||||
|
||||
//Build the actual pocket area
|
||||
buildPocket(world, source.getX(), destinationY, source.getZ(), orientation, size, wallThickness, properties, door);
|
||||
|
||||
//Finish up destination initialization
|
||||
dimension.initializePocket(source.getX(), destinationY, source.getZ(), orientation, link);
|
||||
dimension.setFilled(true);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildPocket(World world, int x, int y, int z, int orientation, int size, int wallThickness, DDProperties properties, Block doorBlock)
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
throw new IllegalArgumentException("properties cannot be null.");
|
||||
}
|
||||
if (size < MIN_POCKET_SIZE || size > MAX_POCKET_SIZE)
|
||||
{
|
||||
throw new IllegalArgumentException("size must be between " + MIN_POCKET_SIZE + " and " + MAX_POCKET_SIZE + ", inclusive.");
|
||||
}
|
||||
if (wallThickness < MIN_POCKET_WALL_THICKNESS || wallThickness > MAX_POCKET_WALL_THICKNESS)
|
||||
{
|
||||
throw new IllegalArgumentException("wallThickness must be between " + MIN_POCKET_WALL_THICKNESS + " and " + MAX_POCKET_WALL_THICKNESS + ", inclusive.");
|
||||
}
|
||||
if (size % 2 == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("size must be an odd number.");
|
||||
}
|
||||
if (size < 2 * wallThickness + 3)
|
||||
{
|
||||
throw new IllegalArgumentException("size must be large enough to fit the specified wall thickness and some air space.");
|
||||
}
|
||||
if (!(doorBlock instanceof IDimDoor))
|
||||
{
|
||||
throw new IllegalArgumentException("Door must implement IDimDoor");
|
||||
}
|
||||
|
||||
|
||||
Point3D center = new Point3D(x - wallThickness + 1 + (size / 2), y - wallThickness - 1 + (size / 2), z);
|
||||
Point3D door = new Point3D(x, y, z);
|
||||
BlockRotator.transformPoint(center, door, orientation - BlockRotator.EAST_DOOR_METADATA, door);
|
||||
|
||||
//Build the outer layer of Eternal Fabric
|
||||
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), properties.PermaFabricBlockID, false, 0);
|
||||
|
||||
//Build the (wallThickness - 1) layers of Fabric of Reality
|
||||
for (int layer = 1; layer < wallThickness; layer++)
|
||||
{
|
||||
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, properties.FabricBlockID,
|
||||
layer < (wallThickness - 1) && properties.TNFREAKINGT_Enabled, properties.NonTntWeight);
|
||||
}
|
||||
|
||||
//Build the door
|
||||
int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, properties.DimensionalDoorID);
|
||||
ItemDimensionalDoor.placeDoorBlock(world, x, y - 1, z, doorOrientation, doorBlock);
|
||||
}
|
||||
|
||||
private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, int blockID, boolean placeTnt, int nonTntWeight)
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
final int startX = centerX - radius;
|
||||
final int startY = centerY - radius;
|
||||
final int startZ = centerZ - radius;
|
||||
|
||||
final int endX = centerX + radius;
|
||||
final int endY = centerY + radius;
|
||||
final int endZ = centerZ + radius;
|
||||
|
||||
//Build faces of the box
|
||||
for (x = startX; x <= endX; x++)
|
||||
{
|
||||
for (z = startZ; z <= endZ; z++)
|
||||
{
|
||||
setBlockDirectlySpecial(world, x, startY, z, blockID, 0, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, x, endY, z, blockID, 0, placeTnt, nonTntWeight);
|
||||
}
|
||||
|
||||
for (y = startY; y <= endY; y++)
|
||||
{
|
||||
setBlockDirectlySpecial(world, x, y, startZ, blockID, 0, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, x, y, endZ, blockID, 0, placeTnt, nonTntWeight);
|
||||
}
|
||||
}
|
||||
|
||||
for (y = startY; y <= endY; y++)
|
||||
{
|
||||
for (z = startZ; z <= endZ; z++)
|
||||
{
|
||||
setBlockDirectlySpecial(world, startX, y, z, blockID, 0, placeTnt, nonTntWeight);
|
||||
setBlockDirectlySpecial(world, endX, y, z, blockID, 0, placeTnt, nonTntWeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBlockDirectlySpecial(World world, int x, int y, int z, int blockID, int metadata, boolean placeTnt, int nonTntWeight)
|
||||
{
|
||||
if (placeTnt && random.nextInt(nonTntWeight + 1) == 0)
|
||||
{
|
||||
setBlockDirectly(world, x, y, z, Block.tnt.blockID, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setBlockDirectly(world, x, y, z, blockID, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBlockDirectly(World world, int x, int y, int z, int blockID, int metadata)
|
||||
{
|
||||
if (blockID != 0 && Block.blocksList[blockID] == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int cX = x >> 4;
|
||||
int cZ = z >> 4;
|
||||
int cY = y >> 4;
|
||||
Chunk chunk;
|
||||
|
||||
int localX = (x % 16) < 0 ? (x % 16) + 16 : (x % 16);
|
||||
int localZ = (z % 16) < 0 ? (z % 16) + 16 : (z % 16);
|
||||
ExtendedBlockStorage extBlockStorage;
|
||||
|
||||
chunk = world.getChunkFromChunkCoords(cX, cZ);
|
||||
extBlockStorage = chunk.getBlockStorageArray()[cY];
|
||||
if (extBlockStorage == null)
|
||||
{
|
||||
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
||||
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
||||
}
|
||||
extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID);
|
||||
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||
import StevenDimDoors.mod_pocketDim.DimData;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
|
||||
|
||||
public class PocketGenerator extends ChunkProviderGenerate implements IChunkProvider
|
||||
@@ -69,16 +69,10 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
||||
@Override
|
||||
public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3, int var4)
|
||||
{
|
||||
DimData data = dimHelper.instance.getDimData(this.worldObj.provider.dimensionId);
|
||||
if (data != null)
|
||||
NewDimData dimension = PocketManager.getDimensionData(this.worldObj);
|
||||
if (dimension != null && dimension.dungeon() != null && !dimension.dungeon().isOpen())
|
||||
{
|
||||
if (data.dungeonGenerator != null)
|
||||
{
|
||||
if (data.isDimRandomRift && data.isPocket && !data.dungeonGenerator.isOpen)
|
||||
{
|
||||
return this.worldObj.getBiomeGenForCoords(var2, var3).getSpawnableList(var1);
|
||||
}
|
||||
}
|
||||
return this.worldObj.getBiomeGenForCoords(var2, var3).getSpawnableList(var1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -6,30 +6,27 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.biome.WorldChunkManagerHell;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PocketProvider extends WorldProvider
|
||||
{
|
||||
public int exitXCoord;
|
||||
public int exitYCoord;
|
||||
public int exitZCoord;
|
||||
public int exitDimID;
|
||||
public boolean hasNoSky = true;
|
||||
|
||||
public boolean isSavingSchematic= false;
|
||||
public int dimToSave;
|
||||
private DDProperties properties;
|
||||
private MonolithSpawner spawner;
|
||||
private IRenderHandler skyRenderer;
|
||||
|
||||
public PocketProvider()
|
||||
{
|
||||
this.hasNoSky = true;
|
||||
this.skyRenderer = new PocketSkyProvider();
|
||||
|
||||
this.spawner = mod_pocketDim.spawner;
|
||||
this.properties = mod_pocketDim.properties;
|
||||
}
|
||||
@@ -37,8 +34,7 @@ public class PocketProvider extends WorldProvider
|
||||
@Override
|
||||
protected void registerWorldChunkManager()
|
||||
{
|
||||
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome,1,1);
|
||||
//this.dimensionId = ConfigAtum.dimensionID;
|
||||
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,28 +43,18 @@ public class PocketProvider extends WorldProvider
|
||||
return (dimensionId == 0 ? null : "DimensionalDoors/pocketDimID" + dimensionId);
|
||||
}
|
||||
|
||||
public void saveAsSchematic(int id)
|
||||
{
|
||||
this.isSavingSchematic=true;
|
||||
this.dimensionId=id;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
|
||||
{
|
||||
setCloudRenderer( new CloudRenderBlank());
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Vec3 getFogColor(float par1, float par2)
|
||||
{
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,6 +75,7 @@ public class PocketProvider extends WorldProvider
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
|
||||
{
|
||||
return false;
|
||||
@@ -103,6 +90,7 @@ public class PocketProvider extends WorldProvider
|
||||
return "PocketDim " + this.dimensionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRespawnDimension(EntityPlayerMP player)
|
||||
{
|
||||
int respawnDim;
|
||||
@@ -113,18 +101,25 @@ public class PocketProvider extends WorldProvider
|
||||
}
|
||||
else
|
||||
{
|
||||
respawnDim = dimHelper.instance.getDimData(this.dimensionId).exitDimLink.destDimID;
|
||||
respawnDim = PocketManager.getDimensionData(this.dimensionId).root().id();
|
||||
}
|
||||
|
||||
if (dimHelper.getWorld(respawnDim) == null)
|
||||
if (DimensionManager.getWorld(respawnDim) == null)
|
||||
{
|
||||
dimHelper.initDimension(respawnDim);
|
||||
DimensionManager.initDimension(respawnDim);
|
||||
}
|
||||
return respawnDim;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRespawnHere()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActualHeight()
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
}
|
||||
|
||||
31
StevenDimDoors/mod_pocketDim/world/PocketSkyProvider.java
Normal file
31
StevenDimDoors/mod_pocketDim/world/PocketSkyProvider.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package StevenDimDoors.mod_pocketDim.world;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
|
||||
public class PocketSkyProvider extends CustomSkyProvider
|
||||
{
|
||||
|
||||
public class LimboSkyProvider extends CustomSkyProvider
|
||||
{
|
||||
@Override
|
||||
public String getMoonRenderPath()
|
||||
{
|
||||
return "/mods/DimDoors/textures/other/pocketMoon.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSunRenderPath()
|
||||
{
|
||||
return "/mods/DimDoors/textures/other/pocketSun.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user