Merge remote-tracking branch 'refs/remotes/origin/Worlds' into 1.10-WIP
# Conflicts: # src/main/java/com/zixiken/dimdoors/shared/DDProxyCommon.java # src/main/java/com/zixiken/dimdoors/shared/PocketPlacer.java # src/main/java/com/zixiken/dimdoors/shared/SchematicHandler.java # src/main/java/com/zixiken/dimdoors/shared/TeleportHelper.java # src/main/java/com/zixiken/dimdoors/shared/world/PocketProvider.java -Resolved all merge conflicts. -Removed a few unused imports -Refractored (moved) new classes from the Worlds branch to the new package structure that came from the Pockets branch -Changed variant size values of the default empty pocket jsons, because otherwise they would crash the game on default config pers/pub pocket size.
This commit is contained in:
commit
5bb54b0791
24 changed files with 1333 additions and 7 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.zixiken.dimdoors;
|
||||
|
||||
import com.zixiken.dimdoors.shared.TeleportCommand;
|
||||
import com.zixiken.dimdoors.shared.DDConfig;
|
||||
import com.zixiken.dimdoors.shared.DDProxyCommon;
|
||||
import com.zixiken.dimdoors.shared.PocketRegistry;
|
||||
|
@ -57,6 +58,7 @@ public class DimDoors {
|
|||
|
||||
@Mod.EventHandler
|
||||
public void serverLoad(FMLServerStartingEvent event) {
|
||||
event.registerServerCommand(new TeleportCommand());
|
||||
//@todo event.registerServerCommand( new DDCommand() ); //to register commands that this mod offers?
|
||||
RiftRegistry.Instance.reset();
|
||||
PocketRegistry.Instance.reset();
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.zixiken.dimdoors.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class CloudRenderBlank extends IRenderHandler
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void render(float partialTicks, WorldClient world, Minecraft mc)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import com.zixiken.dimdoors.shared.tileentities.TileEntityDimDoor;
|
|||
import com.zixiken.dimdoors.shared.tileentities.TileEntityDimDoorGold;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityRift;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityTransTrapdoor;
|
||||
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -20,6 +21,7 @@ public abstract class DDProxyCommon implements IDDProxy {
|
|||
|
||||
@Override
|
||||
public void onPreInitialization(FMLPreInitializationEvent event) {
|
||||
DimDoorDimensions.init();
|
||||
ModBlocks.registerBlocks();
|
||||
ModItems.registerItems();
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.zixiken.dimdoors.shared;
|
||||
|
||||
import com.zixiken.dimdoors.shared.util.Location;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Jared Johnson on 1/26/2017.
|
||||
*/
|
||||
public class TeleportCommand extends CommandBase {
|
||||
private final List aliases;
|
||||
|
||||
public TeleportCommand()
|
||||
{
|
||||
aliases = new ArrayList();
|
||||
|
||||
aliases.add("dimteleport");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "dimteleport";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage(ICommandSender sender) {
|
||||
return "dimteleport <dimension>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAliases() {
|
||||
return aliases;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
|
||||
int id = Integer.parseInt(args[0]);
|
||||
|
||||
if (sender instanceof EntityPlayerMP) {
|
||||
server.getPlayerList().transferPlayerToDimension((EntityPlayerMP) sender, Integer.parseInt(args[0]), new TeleportHelper(new Location(id, 0,300,0)));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,8 +5,6 @@ import com.zixiken.dimdoors.DimDoors;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.play.server.SPacketUpdateHealth;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.Teleporter;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.zixiken.dimdoors.shared.blocks;
|
||||
|
||||
import com.zixiken.dimdoors.shared.world.limbo.LimboDecay;
|
||||
import com.zixiken.dimdoors.shared.world.limbo.WorldProviderLimbo;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockLimbo extends Block {
|
||||
public static final String ID = "blockLimbo";
|
||||
|
||||
public BlockLimbo() {
|
||||
super(Material.GROUND, MapColor.BLACK);
|
||||
setUnlocalizedName(ID);
|
||||
setRegistryName(ID);
|
||||
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random) {
|
||||
//Make sure this block is in Limbo
|
||||
if (world.provider instanceof WorldProviderLimbo) {
|
||||
LimboDecay.applySpreadDecay(world, pos);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -147,15 +147,14 @@ public class BlockRift extends Block implements ITileEntityProvider {
|
|||
x + .5, y + .5, z + .5,
|
||||
rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D));
|
||||
*/
|
||||
if (tile.shouldClose) //renders an opposite color effect if it is being closed by the rift remover
|
||||
{
|
||||
if (tile.shouldClose) //renders an opposite color effect if it is being closed by the rift remover{
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(
|
||||
worldIn,
|
||||
x + .5, y + .5, z + .5,
|
||||
rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean tryPlacingRift(World world, BlockPos pos) {
|
||||
return world != null && !isBlockImmune(world, pos)
|
||||
&& world.setBlockState(pos, getDefaultState()); //@todo This returns false, because this block does not have blockstates configured correctly. !isBlockImmune doesn't seem to be true either though...
|
||||
|
|
|
@ -15,6 +15,7 @@ public class ModBlocks {
|
|||
public static BlockTransTrapdoor blockDimHatch;
|
||||
public static BlockDimWall blockDimWall;
|
||||
public static BlockRift blockRift;
|
||||
public static BlockLimbo blockLimbo;
|
||||
|
||||
public static void registerBlocks() {
|
||||
GameRegistry.register(blockDoorQuartz = new BlockDoorQuartz());
|
||||
|
@ -28,5 +29,6 @@ public class ModBlocks {
|
|||
GameRegistry.register(blockDimWall = new BlockDimWall());
|
||||
GameRegistry.register(blockDimDoorTransient = new BlockDimDoorTransient());
|
||||
GameRegistry.register(blockRift = new BlockRift());
|
||||
GameRegistry.register(blockLimbo = new BlockLimbo());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.zixiken.dimdoors.shared.world;
|
||||
|
||||
/**
|
||||
* Created by Jared Johnson on 1/24/2017.
|
||||
*/
|
||||
public class BiomeGenPocket {
|
||||
}
|
|
@ -0,0 +1,210 @@
|
|||
package com.zixiken.dimdoors.shared.world;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class CustomSkyProvider extends IRenderHandler {
|
||||
|
||||
int starGLCallList;
|
||||
int glSkyList;
|
||||
int glSkyList2;
|
||||
private static final ResourceLocation locationEndSkyPng = new ResourceLocation("textures/environment/end_sky.png");
|
||||
|
||||
|
||||
public ResourceLocation getMoonRenderPath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResourceLocation getSunRenderPath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@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((locationEndSkyPng));
|
||||
|
||||
if (world.provider.isSurfaceWorld()) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
Vec3d vec3 = world.getSkyColor(mc.getRenderViewEntity(), par1);
|
||||
float f1 = (float) vec3.xCoord;
|
||||
float f2 = (float) vec3.yCoord;
|
||||
float f3 = (float) vec3.zCoord;
|
||||
float f4;
|
||||
|
||||
GL11.glColor3f(f1, f2, f3);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.enableFog();
|
||||
GlStateManager.color(f1, f2, f3);
|
||||
GlStateManager.callList(this.glSkyList);
|
||||
GlStateManager.disableFog();
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(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) {
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(MathHelper.sin(world.getCelestialAngleRadians(par1)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
f4 = afloat[0];
|
||||
f7 = afloat[1];
|
||||
f8 = afloat[2];
|
||||
float f11;
|
||||
|
||||
buffer.begin(6, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
buffer.pos(0d, 100d, 0d).color(f4, f7, f8, afloat[3]).endVertex();
|
||||
|
||||
byte b0 = 16;
|
||||
|
||||
for (int j = 0; j <= b0; ++j) {
|
||||
f11 = j * (float) Math.PI * 2.0F / b0;
|
||||
float f12 = MathHelper.sin(f11);
|
||||
float f13 = MathHelper.cos(f11);
|
||||
|
||||
buffer.pos(f12 * 120.0F, f13 * 120.0F, -f13 * 40.0F * afloat[3]).color(afloat[0], afloat[1], afloat[2], 0.0f).endVertex();
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
f4 = 1.0F - world.getRainStrength(par1);
|
||||
f7 = 0.0F;
|
||||
f8 = 0.0F;
|
||||
f9 = 0.0F;
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, f4);
|
||||
GlStateManager.translate(f7, f8, f9);
|
||||
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(world.getCelestialAngle(par1) * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
f10 = 30.0F;
|
||||
mc.renderEngine.bindTexture(this.getSunRenderPath());
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos(-f10, 100.0D, -f10).tex(0.0D, 0.0D).endVertex();
|
||||
buffer.pos(f10, 100.0D, -f10).tex(1.0D, 0.0D).endVertex();
|
||||
buffer.pos(f10, 100.0D, f10).tex(1.0D, 1.0D).endVertex();
|
||||
buffer.pos(-f10, 100.0D, f10).tex(0.0D, 1.0D).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
f10 = 20.0F;
|
||||
mc.renderEngine.bindTexture(this.getMoonRenderPath());
|
||||
int k = world.getMoonPhase();
|
||||
int l = k % 4;
|
||||
int i1 = k / 4 % 2;
|
||||
float f14 = l + 0;
|
||||
float f15 = i1 + 0;
|
||||
float f16 = l + 1;
|
||||
float f17 = i1 + 1;
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos(-f10, -100.0D, f10).tex(f16, f17).endVertex();
|
||||
buffer.pos(f10, -100.0D, f10).tex(f14, f17).endVertex();
|
||||
buffer.pos(f10, -100.0D, -f10).tex(f14, f15).endVertex();
|
||||
buffer.pos(-f10, -100.0D, -f10).tex(f16, f15).endVertex();
|
||||
tessellator.draw();
|
||||
GlStateManager.disableTexture2D();
|
||||
float f18 = world.getStarBrightness(par1) * f4;
|
||||
|
||||
if (f18 > 0.0F) {
|
||||
GlStateManager.color(f18, f18, f18, f18);
|
||||
GlStateManager.callList(this.starGLCallList);
|
||||
}
|
||||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableFog();
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.color(0.0F, 0.0F, 0.0F);
|
||||
double d0 = mc.player.getPosition().getY() - world.getHorizon();
|
||||
|
||||
if (d0 < 0.0D) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0.0F, 12.0F, 0.0F);
|
||||
GlStateManager.callList(this.glSkyList2);
|
||||
GlStateManager.popMatrix();
|
||||
f8 = 1.0F;
|
||||
f9 = -((float) (d0 + 65.0D));
|
||||
f10 = -f8;
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
|
||||
buffer.pos(-f8, f9, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f9, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f10, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(-f8, f10, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(-f8, f10, -f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f10, -f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f9, -f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(-f8, f9, -f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f10, -f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f10, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f9, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f9, -f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(-f8, f9, -f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(-f8, f9, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(-f8, f10, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(-f8, f10, -f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(-f8, f10, -f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(-f8, f10, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f10, f8).color(0,0,0,1).endVertex();
|
||||
buffer.pos(f8, f10, -f8).color(0,0,0,1).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
if (world.provider.isSkyColored()) {
|
||||
GlStateManager.color(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
|
||||
} else {
|
||||
GlStateManager.color(f1, f2, f3);
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0.0F, -((float) (d0 - 16.0D)), 0.0F);
|
||||
GlStateManager.callList(this.glSkyList2);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.depthMask(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.zixiken.dimdoors.shared.world;
|
||||
|
||||
import com.zixiken.dimdoors.shared.world.limbo.WorldProviderLimbo;
|
||||
import com.zixiken.dimdoors.shared.world.personalpocket.WorldProviderPersonalPocket;
|
||||
import com.zixiken.dimdoors.shared.world.pocket.WorldProviderPocket;
|
||||
import com.zixiken.dimdoors.shared.world.pocket.WorldProviderPublicPocket;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
public class DimDoorDimensions {
|
||||
public static DimensionType LIMBO;
|
||||
public static DimensionType DUNGEON;
|
||||
public static DimensionType PRIVATE;
|
||||
public static DimensionType PUBLIC;
|
||||
|
||||
public static void init() {
|
||||
LIMBO = DimensionType.register("Limbo", "_limbo", 2, WorldProviderLimbo.class, false);
|
||||
PRIVATE = DimensionType.register("Private", "_private", 3, WorldProviderPersonalPocket.class, false); //TODO: Figure out how to consiently get proper dimension ids
|
||||
DUNGEON = DimensionType.register("Dungeon", "_dungeon", 4, WorldProviderPocket.class, false);
|
||||
PUBLIC = DimensionType.register("Public", "_public", 5, WorldProviderPublicPocket.class, false);
|
||||
|
||||
registerDimension(LIMBO);
|
||||
registerDimension(PRIVATE);
|
||||
registerDimension(DUNGEON);
|
||||
registerDimension(PUBLIC);
|
||||
}
|
||||
|
||||
public static void registerDimension(DimensionType dimension) {
|
||||
DimensionManager.registerDimension(dimension.getId(), dimension);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
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));
|
||||
this.theBiomeDecorator.treesPerChunk = 0;
|
||||
this.theBiomeDecorator.flowersPerChunk = 0;
|
||||
this.theBiomeDecorator.grassPerChunk = 0;
|
||||
|
||||
this.spawnableMonsterList.clear();
|
||||
this.spawnableCreatureList.clear();
|
||||
this.spawnableWaterCreatureList.clear();
|
||||
this.spawnableCaveCreatureList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRain() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.zixiken.dimdoors.shared.world.limbo;
|
||||
|
||||
import com.zixiken.dimdoors.shared.world.biomes.DimDoorsBiome;
|
||||
|
||||
public class LimboBiome extends DimDoorsBiome {
|
||||
public LimboBiome() {
|
||||
super("limbo");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,172 @@
|
|||
package com.zixiken.dimdoors.shared.world.limbo;
|
||||
|
||||
import com.zixiken.dimdoors.shared.blocks.BlockDimWall;
|
||||
import com.zixiken.dimdoors.shared.blocks.ModBlocks;
|
||||
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Provides methods for applying Limbo decay. Limbo decay refers to the effect that most blocks placed in Limbo
|
||||
* naturally change into stone, then cobble, then gravel, and finally Unraveled Fabric as time passes.
|
||||
*/
|
||||
public class LimboDecay {
|
||||
|
||||
private static final int MAX_DECAY_SPREAD_CHANCE = 100;
|
||||
private static final int DECAY_SPREAD_CHANCE = 50;
|
||||
private static final int CHUNK_SIZE = 16;
|
||||
private static final int SECTION_HEIGHT = 16;
|
||||
|
||||
//Provides a reversed list of the block IDs that blocks cycle through during decay.
|
||||
private static IBlockState[] decaySequence = null;
|
||||
|
||||
private static final Random random = new Random();
|
||||
private static IBlockState[] blocksImmuneToDecay = null;
|
||||
|
||||
public static IBlockState[] getDecaySequence() {
|
||||
if (decaySequence == null) {
|
||||
decaySequence = new IBlockState[] {
|
||||
ModBlocks.blockLimbo.getDefaultState(),
|
||||
Blocks.GRAVEL.getDefaultState(),
|
||||
Blocks.COBBLESTONE.getDefaultState(),
|
||||
Blocks.STONE.getDefaultState()
|
||||
};
|
||||
}
|
||||
|
||||
return decaySequence;
|
||||
}
|
||||
|
||||
public static IBlockState[] getBlocksImmuneToDecay() {
|
||||
if (blocksImmuneToDecay == null) {
|
||||
blocksImmuneToDecay = new IBlockState[] {
|
||||
ModBlocks.blockLimbo.getDefaultState(),
|
||||
ModBlocks.blockDimWall.getDefaultState().withProperty(BlockDimWall.TYPE, BlockDimWall.EnumType.ANCIENT),
|
||||
ModBlocks.blockDimDoorTransient.getDefaultState(),
|
||||
ModBlocks.blockDimDoor.getDefaultState(),
|
||||
ModBlocks.blockDimDoorWarp.getDefaultState(),
|
||||
ModBlocks.blockRift.getDefaultState(),
|
||||
ModBlocks.blockDimDoorChaos.getDefaultState(),
|
||||
ModBlocks.blockDoorGold.getDefaultState(),
|
||||
ModBlocks.blockDoorQuartz.getDefaultState(),
|
||||
ModBlocks.blockDimDoorGold.getDefaultState()
|
||||
};
|
||||
}
|
||||
|
||||
return blocksImmuneToDecay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the blocks orthogonally around a given location (presumably the location of an Unraveled Fabric block)
|
||||
* and applies Limbo decay to them. This gives the impression that decay spreads outward from Unraveled Fabric.
|
||||
*/
|
||||
public static void applySpreadDecay(World world, BlockPos pos) {
|
||||
//Check if we randomly apply decay spread or not. This can be used to moderate the frequency of
|
||||
//full spread decay checks, which can also shift its performance impact on the game.
|
||||
if (random.nextInt(MAX_DECAY_SPREAD_CHANCE) < DECAY_SPREAD_CHANCE) {
|
||||
//Apply decay to the blocks above, below, and on all four sides.
|
||||
//World.getBlockId() implements bounds checking, so we don't have to worry about reaching out of the world
|
||||
decayBlock(world, pos.up());
|
||||
decayBlock(world, pos.down());
|
||||
decayBlock(world, pos.north());
|
||||
decayBlock(world, pos.south());
|
||||
decayBlock(world, pos.west());
|
||||
decayBlock(world, pos.east());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Picks random blocks from each active chunk in Limbo and, if decay is applicable, converts them directly to Unraveled Fabric.
|
||||
* This decay method is designed to stop players from avoiding Limbo decay by building floating structures.
|
||||
*/
|
||||
public static void applyRandomFastDecay()
|
||||
{
|
||||
int x, y, z;
|
||||
int sectionY;
|
||||
int limboHeight;
|
||||
int[] limbo = DimensionManager.getDimensions(DimDoorDimensions.LIMBO);
|
||||
|
||||
|
||||
for (Integer i : limbo){
|
||||
World world = DimensionManager.getWorld(i);
|
||||
|
||||
limboHeight = world.getHeight();
|
||||
|
||||
//Obtain the coordinates of active chunks in Limbo. For each section of each chunk,
|
||||
//pick a random block and try to apply fast decay.
|
||||
for (ChunkPos chunkPos : ForgeChunkManager.getPersistentChunksFor(world).keySet()) {
|
||||
//Loop through each chunk section and fast-decay a random block
|
||||
//Apply the changes using the world object instead of directly to the chunk so that clients are always notified.
|
||||
for (sectionY = 0; sectionY < limboHeight; sectionY += SECTION_HEIGHT) {
|
||||
BlockPos pos = new BlockPos(chunkPos.chunkXPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE),
|
||||
chunkPos.chunkZPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE),
|
||||
sectionY + random.nextInt(SECTION_HEIGHT));
|
||||
decayBlockFast(world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a block can be decayed and, if so, changes it directly into Unraveled Fabric.
|
||||
*/
|
||||
private static boolean decayBlockFast(World world, BlockPos pos) {
|
||||
IBlockState block = world.getBlockState(pos);
|
||||
if (canDecayBlock(block, world, pos)) {
|
||||
world.setBlockState(pos, ModBlocks.blockLimbo.getDefaultState());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a block can be decayed and, if so, changes it to the next block ID along the decay sequence.
|
||||
*/
|
||||
private static boolean decayBlock(World world, BlockPos pos) {
|
||||
int index;
|
||||
IBlockState block = world.getBlockState(pos);
|
||||
if (canDecayBlock(block, world, pos)) {
|
||||
//Loop over the block IDs that decay can go through.
|
||||
//Find an index matching the current blockID, if any.
|
||||
for (index = 0; index < getDecaySequence().length; index++) {
|
||||
if (getDecaySequence()[index].equals(block)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Since the decay sequence is a reversed list, the block ID in the index before our match
|
||||
//is the block ID we should change this block into. A trick in this approach is that if
|
||||
//we loop over the array without finding a match, then (index - 1) will contain the
|
||||
//last ID in the array, which is the first one that all blocks decay into.
|
||||
//We assume that Unraveled Fabric is NOT decayable. Otherwise, this will go out of bounds!
|
||||
|
||||
world.setBlockState(pos, getDecaySequence()[index - 1]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a block can decay. We will not decay air, certain DD blocks, or containers.
|
||||
*/
|
||||
private static boolean canDecayBlock(IBlockState block, World world, BlockPos pos) {
|
||||
if (world.isAirBlock(pos )) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int k = 0; k < getBlocksImmuneToDecay().length; k++) {
|
||||
if (block.equals(getBlocksImmuneToDecay()[k])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return (block == null || !(block instanceof BlockContainer));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,344 @@
|
|||
package com.zixiken.dimdoors.shared.world.limbo;
|
||||
|
||||
import com.zixiken.dimdoors.shared.blocks.BlockDimWall;
|
||||
import com.zixiken.dimdoors.shared.blocks.ModBlocks;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.init.Biomes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
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.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.gen.NoiseGeneratorOctaves;
|
||||
import net.minecraft.world.gen.structure.MapGenScatteredFeature;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class LimboGenerator implements IChunkGenerator
|
||||
{
|
||||
private static Random rand;
|
||||
|
||||
/** A NoiseGeneratorOctaves used in generating terrain */
|
||||
private NoiseGeneratorOctaves noiseGen1;
|
||||
|
||||
/** A NoiseGeneratorOctaves used in generating terrain */
|
||||
private NoiseGeneratorOctaves noiseGen2;
|
||||
|
||||
/** A NoiseGeneratorOctaves used in generating terrain */
|
||||
private NoiseGeneratorOctaves noiseGen3;
|
||||
|
||||
/** A NoiseGeneratorOctaves used in generating terrain */
|
||||
private NoiseGeneratorOctaves noiseGen4;
|
||||
|
||||
/** A NoiseGeneratorOctaves used in generating terrain */
|
||||
public NoiseGeneratorOctaves noiseGen5;
|
||||
|
||||
public World world;
|
||||
|
||||
/** A NoiseGeneratorOctaves used in generating terrain */
|
||||
public NoiseGeneratorOctaves noiseGen6;
|
||||
public NoiseGeneratorOctaves mobSpawnerNoise;
|
||||
|
||||
/** Reference to the World object. */
|
||||
private World worldObj;
|
||||
|
||||
/** Holds the overall noise array used in chunk generation */
|
||||
private double[] noiseArray;
|
||||
|
||||
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
|
||||
|
||||
/** The biomes that are used to generate the chunk */
|
||||
private Biome[] biomesForGeneration = { new LimboBiome() };
|
||||
|
||||
/** A double array that hold terrain noise from noiseGen3 */
|
||||
double[] noise3;
|
||||
|
||||
/** A double array that hold terrain noise */
|
||||
double[] noise1;
|
||||
|
||||
/** A double array that hold terrain noise from noiseGen2 */
|
||||
double[] noise2;
|
||||
|
||||
/** A double array that hold terrain noise from noiseGen5 */
|
||||
double[] noise5;
|
||||
|
||||
/** A double array that holds terrain noise from noiseGen6 */
|
||||
double[] noise6;
|
||||
|
||||
/**
|
||||
* Used to store the 5x5 parabolic field that is used during terrain generation.
|
||||
*/
|
||||
float[] parabolicField;
|
||||
int[][] field_73219_j = new int[32][32];
|
||||
{
|
||||
// caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
|
||||
}
|
||||
//private CustomLimboPopulator spawner;
|
||||
|
||||
public LimboGenerator(World world, long seed /*CustomLimboPopulator spawner*/) {
|
||||
this.worldObj = world;
|
||||
LimboGenerator.rand = new Random(seed);
|
||||
this.noiseGen1 = new NoiseGeneratorOctaves(LimboGenerator.rand, 16); //base terrain
|
||||
this.noiseGen2 = new NoiseGeneratorOctaves(LimboGenerator.rand, 16); //hillyness
|
||||
this.noiseGen3 = new NoiseGeneratorOctaves(LimboGenerator.rand, 80); //seems to adjust the size of features, how stretched things are -default 8
|
||||
this.noiseGen4 = new NoiseGeneratorOctaves(LimboGenerator.rand, 4);
|
||||
this.noiseGen5 = new NoiseGeneratorOctaves(LimboGenerator.rand, 10);
|
||||
this.noiseGen6 = new NoiseGeneratorOctaves(LimboGenerator.rand, 16);
|
||||
this.mobSpawnerNoise = new NoiseGeneratorOctaves(LimboGenerator.rand, 8);
|
||||
|
||||
NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise};
|
||||
// noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens);
|
||||
this.noiseGen1 = noiseGens[0];
|
||||
this.noiseGen2 = noiseGens[1];
|
||||
this.noiseGen3 = noiseGens[2];
|
||||
this.noiseGen4 = noiseGens[3];
|
||||
this.noiseGen5 = noiseGens[4];
|
||||
this.noiseGen6 = noiseGens[5];
|
||||
this.mobSpawnerNoise = noiseGens[6];
|
||||
|
||||
this.worldObj = world;
|
||||
|
||||
//this.spawner = spawner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Chunk provideChunk(int chunkX, int chunkZ)
|
||||
{
|
||||
//TODO: Wtf? Why do you reinitialize the seed when we already initialized it in the constructor?! ~SenseiKiwi
|
||||
LimboGenerator.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
|
||||
ChunkPrimer primer = new ChunkPrimer();
|
||||
this.scale(chunkX, chunkZ, primer);
|
||||
Chunk chunk = new Chunk(this.worldObj, primer, chunkX, chunkZ);
|
||||
chunk.generateSkylightMap();
|
||||
|
||||
if (!chunk.isTerrainPopulated()) {
|
||||
chunk.setTerrainPopulated(true);
|
||||
//spawner.registerChunkForPopulation(properties.LimboDimensionID, chunkX, chunkZ);
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(int var2, int var3) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateStructures(Chunk chunkIn, int x, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) {
|
||||
if (par1ArrayOfDouble == null) {
|
||||
par1ArrayOfDouble = new double[par5 * par6 * par7];
|
||||
}
|
||||
|
||||
if (this.parabolicField == null) {
|
||||
this.parabolicField = new float[25];
|
||||
|
||||
for (int var8 = -2; var8 <= 2; ++var8) {
|
||||
for (int var9 = -2; var9 <= 2; ++var9) {
|
||||
float var10 = 10.0F / MathHelper.sqrt(var8 * var8 + var9 * var9 + 0.2F);
|
||||
this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double var44 = 884.412D; //large values here create spiky land. add a 0, good -default 884
|
||||
double var45 = 9840.412D; //large values here make sheets- default - 684
|
||||
this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D);
|
||||
this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D);
|
||||
this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2, par3, par4, par5, par6, par7, var44 / 80.0D, var45 / 160.0D, var44 / 80.0D);
|
||||
this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, var44, var45, var44);
|
||||
this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, var44, var45, var44);
|
||||
|
||||
int var12 = 0;
|
||||
int var13 = 0;
|
||||
|
||||
for (int var14 = 0; var14 < par5; ++var14) {
|
||||
for (int var15 = 0; var15 < par7; ++var15) {
|
||||
float var16 = 0.0F;
|
||||
float var17 = 0.0F;
|
||||
float var18 = 0.0F;
|
||||
byte var19 = 2;
|
||||
|
||||
for (int var21 = -var19; var21 <= var19; ++var21) {
|
||||
for (int var22 = -var19; var22 <= var19; ++var22) {
|
||||
float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (Biomes.PLAINS.getBaseHeight() + 9.0F);
|
||||
|
||||
|
||||
//this adjusts the height of the terrain
|
||||
|
||||
var16 += Biomes.PLAINS.getHeightVariation() * var24+4;
|
||||
var17 += Biomes.PLAINS.getBaseHeight() * var24-1;
|
||||
var18 += var24;
|
||||
}
|
||||
}
|
||||
|
||||
var16 /= var18;
|
||||
var17 /= var18;
|
||||
var16 = (var16 * 0.9F + 0.1F);
|
||||
var17 = (var17 * 4.0F - 1.0F) / 8.0F;
|
||||
double var47 = this.noise6[var13] / 8000.0D;
|
||||
|
||||
if (var47 < 0.0D) {
|
||||
var47 = -var47 * 0.3D;
|
||||
}
|
||||
|
||||
var47 = var47 * 3.0D - 2.0D;
|
||||
|
||||
if (var47 < 0.0D) {
|
||||
var47 /= 2.0D;
|
||||
|
||||
if (var47 < -1.0D) {
|
||||
var47 = -1.0D;
|
||||
}
|
||||
|
||||
var47 /= 1.4D;
|
||||
var47 /= 2.0D;
|
||||
}
|
||||
else {
|
||||
if (var47 > 1.0D) {
|
||||
var47 = 1.0D;
|
||||
}
|
||||
|
||||
var47 /= 8.0D;
|
||||
}
|
||||
|
||||
++var13;
|
||||
|
||||
for (int var46 = 0; var46 < par6; ++var46) {
|
||||
double var48 = var17;
|
||||
double var26 = var16;
|
||||
var48 += var47 * 0.2D;
|
||||
var48 = var48 * par6 / 16.0D;
|
||||
double var28 = par6 / 2.0D + var48 * 4.0D;
|
||||
double var30 = 0.0D;
|
||||
double var32 = (var46 - var28) * 12.0D * 128.0D / 128.0D / var26;
|
||||
|
||||
if (var32 < 0.0D) {
|
||||
var32 *= 4.0D;
|
||||
}
|
||||
|
||||
double var34 = this.noise1[var12] / 512.0D;
|
||||
double var36 = this.noise2[var12] / 512.0D;
|
||||
double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D;
|
||||
|
||||
if (var38 < 0.0D) {
|
||||
var30 = var34;
|
||||
}
|
||||
else if (var38 > 1.0D) {
|
||||
var30 = var36;
|
||||
}
|
||||
else {
|
||||
var30 = var34 + (var36 - var34) * var38;
|
||||
}
|
||||
|
||||
var30 -= var32;
|
||||
|
||||
if (var46 > par6 - 4) {
|
||||
double var40 = (var46 - (par6 - 4)) / 3.0F;
|
||||
var30 = var30 * (1.0D - var40) + -10.0D * var40;
|
||||
}
|
||||
|
||||
par1ArrayOfDouble[var12] = var30;
|
||||
++var12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return par1ArrayOfDouble;
|
||||
}
|
||||
|
||||
public void scale(int x, int z, ChunkPrimer primer) { //Coursty of
|
||||
// TODO: this:
|
||||
this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomesForGeneration, x * 4 - 2, z * 4 - 2, 10, 10);
|
||||
this.noiseArray = this.initializeNoiseField(this.noiseArray, x * 4, 0, z * 4, 5, 17, 5);
|
||||
|
||||
int xzSections = 4;
|
||||
int xzSectionSize = 4;
|
||||
int ySections = 16;
|
||||
int ySectionSize = 8;
|
||||
|
||||
double xzScale = 1.0 / xzSectionSize;
|
||||
double yScale = 1.0 / ySectionSize;
|
||||
for (int sectionX = 0; sectionX < xzSections; ++sectionX) {
|
||||
int xSectionPart = sectionX * xzSectionSize;
|
||||
int i0__ = sectionX * (xzSections + 1);
|
||||
int i1__ = (sectionX + 1) * (xzSections + 1);
|
||||
|
||||
for (int sectionZ = 0; sectionZ < xzSections; ++sectionZ) {
|
||||
int zSectionPart = sectionZ * xzSectionSize;
|
||||
int i0_0 = (i0__ + sectionZ) * (ySections + 1);
|
||||
int i0_1 = (i0__ + sectionZ + 1) * (ySections + 1);
|
||||
int i1_0 = (i1__ + sectionZ) * (ySections + 1);
|
||||
int i1_1 = (i1__ + sectionZ + 1) * (ySections + 1);
|
||||
|
||||
for (int sectionY = 0; sectionY < ySections; ++sectionY) {
|
||||
int ySectionPart = sectionY * ySectionSize;
|
||||
double v0y0 = this.noiseArray[i0_0 + sectionY];
|
||||
double v0y1 = this.noiseArray[i0_1 + sectionY];
|
||||
double v1y0 = this.noiseArray[i1_0 + sectionY];
|
||||
double v1y1 = this.noiseArray[i1_1 + sectionY];
|
||||
double d0y0 = (this.noiseArray[i0_0 + sectionY + 1] - v0y0) * yScale;
|
||||
double d0y1 = (this.noiseArray[i0_1 + sectionY + 1] - v0y1) * yScale;
|
||||
double d1y0 = (this.noiseArray[i1_0 + sectionY + 1] - v1y0) * yScale;
|
||||
double d1y1 = (this.noiseArray[i1_1 + sectionY + 1] - v1y1) * yScale;
|
||||
|
||||
for (int yRel = 0; yRel < ySectionSize; ++yRel) {
|
||||
int yCoord = ySectionPart + yRel;
|
||||
double vxy0 = v0y0;
|
||||
double vxy1 = v0y1;
|
||||
double dxy0 = (v1y0 - v0y0) * xzScale;
|
||||
double dxy1 = (v1y1 - v0y1) * xzScale;
|
||||
|
||||
for (int xRel = 0; xRel < xzSectionSize; ++xRel) {
|
||||
int xCoord = xSectionPart + xRel;
|
||||
double dxyz = (vxy1 - vxy0) * xzScale;
|
||||
double vxyz = vxy0 - dxyz;
|
||||
|
||||
for (int zRel = 0; zRel < xzSectionSize; ++zRel) {
|
||||
int zCoord = zSectionPart + zRel;
|
||||
if(vxyz > 0) {
|
||||
primer.setBlockState(xCoord, yCoord, zCoord, ModBlocks.blockLimbo.getDefaultState());
|
||||
} else if(yCoord < 6) {
|
||||
primer.setBlockState(xCoord, yCoord, zCoord, ModBlocks.blockDimWall.getDefaultState().withProperty(BlockDimWall.TYPE, BlockDimWall.EnumType.ANCIENT));
|
||||
}
|
||||
}
|
||||
|
||||
vxy0 += dxy0;
|
||||
vxy1 += dxy1;
|
||||
}
|
||||
|
||||
v0y0 += d0y0;
|
||||
v0y1 += d0y1;
|
||||
v1y0 += d1y0;
|
||||
v1y1 += d1y1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType par1EnumCreatureType, BlockPos pos) {
|
||||
return new ArrayList<Biome.SpawnListEntry>();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recreateStructures(Chunk chunkIn, int x, int z) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.zixiken.dimdoors.shared.world.limbo;
|
||||
|
||||
import com.zixiken.dimdoors.shared.world.CustomSkyProvider;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Created by Jared Johnson on 1/24/2017.
|
||||
*/
|
||||
public class LimboSkyProvider extends CustomSkyProvider
|
||||
{
|
||||
@Override
|
||||
public ResourceLocation getMoonRenderPath()
|
||||
{
|
||||
return new ResourceLocation("DimDoors:textures/other/limboMoon.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSunRenderPath() {
|
||||
return new ResourceLocation("DimDoors:textures/other/limboSun.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
package com.zixiken.dimdoors.shared.world.limbo;
|
||||
|
||||
import com.zixiken.dimdoors.client.CloudRenderBlank;
|
||||
import com.zixiken.dimdoors.shared.blocks.ModBlocks;
|
||||
import com.zixiken.dimdoors.shared.util.Location;
|
||||
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.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class WorldProviderLimbo extends WorldProvider {
|
||||
private IRenderHandler skyRenderer;
|
||||
//private CustomLimboPopulator spawner;
|
||||
|
||||
public WorldProviderLimbo() {
|
||||
this.hasNoSky = false;
|
||||
this.skyRenderer = new LimboSkyProvider();
|
||||
//this.spawner
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IRenderHandler getSkyRenderer() {
|
||||
return skyRenderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiomeForCoords(BlockPos pos) {
|
||||
return new LimboBiome();
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateLightBrightnessTable() {
|
||||
float modifier = 0.0F;
|
||||
|
||||
for (int steps = 0; steps <= 15; ++steps) {
|
||||
float var3 = 1.0F - steps / 15.0F;
|
||||
this.lightBrightnessTable[steps] = ((0.0F + var3) / (var3 * 3.0F + 1.0F) * (1.0F - modifier) + modifier)*3;
|
||||
// System.out.println( this.lightBrightnessTable[steps]+"light");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getSpawnPoint() {
|
||||
return this.getRandomizedSpawnPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateCelestialAngle(long par1, float par3) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getMoonPhase(long par1, float par3) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSaveFolder() {
|
||||
return (getDimension() == 0 ? null : "limbo" + getDimension());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCoordinateBeSpawn(int x, int z) {
|
||||
BlockPos pos = this.world.getTopSolidOrLiquidBlock(new BlockPos(x, 0, z));
|
||||
return world.getBlockState(pos).equals(ModBlocks.blockLimbo.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHorizon() {
|
||||
return 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 par1, float par2) {
|
||||
return new Vec3d(.2, .2, .2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRespawnDimension(EntityPlayerMP player) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkGenerator createChunkGenerator() {
|
||||
return new LimboGenerator(world, 45);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockFreeze(BlockPos pos, boolean byWater) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Location getLimboSkySpawn(EntityPlayer player, World world) {
|
||||
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);
|
||||
return new Location(world, x, 700, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getRandomizedSpawnPoint() {
|
||||
int x = MathHelper.clamp(this.world.rand.nextInt(), -500, 500);
|
||||
int z = MathHelper.clamp(this.world.rand.nextInt(), -500, 500);
|
||||
return new BlockPos(x, 700, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DimensionType getDimensionType() {
|
||||
return DimDoorDimensions.LIMBO;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.zixiken.dimdoors.shared.world.personalpocket;
|
||||
|
||||
import com.zixiken.dimdoors.client.CloudRenderBlank;
|
||||
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
|
||||
import com.zixiken.dimdoors.shared.world.pocket.WorldProviderPocket;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Created by Jared Johnson on 1/24/2017.
|
||||
*/
|
||||
public class WorldProviderPersonalPocket extends WorldProviderPocket {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks)
|
||||
{
|
||||
setCloudRenderer(new CloudRenderBlank());
|
||||
return new Vec3d(1,1,1);
|
||||
}
|
||||
|
||||
public boolean isSurfaceWorld() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateLightBrightnessTable() {
|
||||
for (int i = 0; i <= 15; ++i) {
|
||||
this.lightBrightnessTable[i] = (15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHorizon() {
|
||||
return world.getHeight()-256;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Vec3d getFogColor(float par1, float par2) {
|
||||
return new Vec3d(1,1,1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActualHeight() {
|
||||
return -256;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSaveFolder() {
|
||||
return (getDimension() == 0 ? null : "personal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public DimensionType getDimensionType() {
|
||||
return DimDoorDimensions.PRIVATE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.zixiken.dimdoors.shared.world.pocket;
|
||||
|
||||
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.chunk.IChunkGenerator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PocketGenerator implements IChunkGenerator {
|
||||
private World worldObj;
|
||||
|
||||
//private CustomLimboPopulator spawner;
|
||||
|
||||
public PocketGenerator(World world, long seed /*CustomLimboPopulator spawner*/) {
|
||||
this.worldObj = world;
|
||||
|
||||
//this.spawner = spawner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Chunk provideChunk(int chunkX, int chunkZ) {
|
||||
ChunkPrimer primer = new ChunkPrimer();
|
||||
Chunk chunk = new Chunk(worldObj, primer, chunkX, chunkZ);
|
||||
|
||||
if(!chunk.isTerrainPopulated()) {
|
||||
chunk.setTerrainPopulated(true);
|
||||
//spawner.registerChunkForPopulation(worldObj.provider.dimensionId, chunkX, chunkZ);
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(int chunkX, int chunkZ) {
|
||||
|
||||
}
|
||||
|
||||
@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<Biome.SpawnListEntry>();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recreateStructures(Chunk chunkIn, int x, int z) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.zixiken.dimdoors.shared.world.pocket;
|
||||
|
||||
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/limboMoon.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSunRenderPath() {
|
||||
return new ResourceLocation("DimDoors:textures/other/limboSun.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package com.zixiken.dimdoors.shared.world.pocket;
|
||||
|
||||
import com.zixiken.dimdoors.client.CloudRenderBlank;
|
||||
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
|
||||
import net.minecraft.client.renderer.Vector3d;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
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.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class WorldProviderPocket extends WorldProvider {
|
||||
//protected CustomLimboPopulator spawner;
|
||||
protected IRenderHandler skyRenderer;
|
||||
|
||||
public WorldProviderPocket() {
|
||||
this.hasNoSky = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getSaveFolder() {
|
||||
return (getDimension() == 0 ? null : "private");
|
||||
}
|
||||
|
||||
@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 par1, float par2) {
|
||||
return Vec3d.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHorizon() {
|
||||
return world.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkGenerator createChunkGenerator() {
|
||||
return new PocketGenerator(world, 0); //, spawner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSnowAt(BlockPos pos, boolean light) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockFreeze(BlockPos pos, boolean byWater) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public float calculateCelestialAngle(long par1, float par3) {
|
||||
return .5F;
|
||||
}
|
||||
|
||||
@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 int getRespawnDimension(EntityPlayerMP player) {
|
||||
return getDimension();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRespawnHere() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActualHeight() {
|
||||
return 256;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DimensionType getDimensionType() {
|
||||
return DimDoorDimensions.DUNGEON;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.zixiken.dimdoors.shared.world.pocket;
|
||||
|
||||
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
|
||||
import net.minecraft.world.DimensionType;
|
||||
|
||||
public class WorldProviderPublicPocket extends WorldProviderPocket {
|
||||
@Override
|
||||
public String getSaveFolder() {
|
||||
return (getDimension() == 0 ? null : "public");
|
||||
}
|
||||
|
||||
@Override
|
||||
public DimensionType getDimensionType() {
|
||||
return DimDoorDimensions.PUBLIC;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
"variations": [
|
||||
{
|
||||
"variantName": "defaultPersonal_3",
|
||||
"size": 3,
|
||||
"size": 1,
|
||||
"minDepth": 0,
|
||||
"maxDepth": 0,
|
||||
"weights": [100]
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"variations": [
|
||||
{
|
||||
"variantName": "defaultPublic_3",
|
||||
"size": 3,
|
||||
"size": 1,
|
||||
"minDepth": 0,
|
||||
"maxDepth": 0,
|
||||
"weights": [100]
|
||||
|
|
Loading…
Reference in a new issue