Merged in Mazes and Nether Branches #123

Merged
SenseiKiwi merged 10 commits from master into master 2014-01-04 07:42:05 +00:00
39 changed files with 393 additions and 320 deletions

View File

@@ -0,0 +1,69 @@
package StevenDimDoors.experimental;
import StevenDimDoors.mod_pocketDim.Point3D;
public class BoundingBox
{
protected Point3D minCorner;
protected Point3D maxCorner;
public BoundingBox(int x, int y, int z, int width, int height, int length)
{
this.minCorner = new Point3D(x, y, z);
this.maxCorner = new Point3D(x + width - 1, y + height - 1, z + length - 1);
}
public BoundingBox(Point3D minCorner, Point3D maxCorner)
{
this.minCorner = minCorner;
this.maxCorner = maxCorner;
}
public int width()
{
return (maxCorner.getX() - minCorner.getX() + 1);
}
public int height()
{
return (maxCorner.getY() - minCorner.getY() + 1);
}
public int length()
{
return (maxCorner.getZ() - minCorner.getZ() + 1);
}
public Point3D minCorner()
{
return minCorner;
}
public Point3D maxCorner()
{
return maxCorner;
}
public boolean contains(int x, int y, int z)
{
return ((minCorner.getX() <= x && x <= maxCorner.getX()) &&
(minCorner.getY() <= y && y <= maxCorner.getY()) &&
(minCorner.getZ() <= z && z <= maxCorner.getZ()));
}
public boolean intersects(BoundingBox other)
{
// To be clear, having one box inside another counts as intersecting
boolean xi = (this.minCorner.getX() <= other.minCorner.getX() && other.minCorner.getX() <= this.maxCorner.getX()) ||
(other.minCorner.getX() <= this.minCorner.getX() && this.minCorner.getX() <= other.maxCorner.getX());
boolean yi = (this.minCorner.getY() <= other.minCorner.getY() && other.minCorner.getY() <= this.maxCorner.getY()) ||
(other.minCorner.getY() <= this.minCorner.getY() && this.minCorner.getY() <= other.maxCorner.getY());
boolean zi = (this.minCorner.getZ() <= other.minCorner.getZ() && other.minCorner.getZ() <= this.maxCorner.getZ()) ||
(other.minCorner.getZ() <= this.minCorner.getZ() && this.minCorner.getZ() <= other.maxCorner.getZ());
return xi && yi && zi;
}
}

View File

@@ -21,6 +21,8 @@ public class MazeBuilder
buildRooms(design.getRoomGraph(), world, offset); buildRooms(design.getRoomGraph(), world, offset);
carveDoorways(design.getRoomGraph(), world, offset, decay, random); carveDoorways(design.getRoomGraph(), world, offset, decay, random);
//placeDoors(design, world, offset);
applyRandomDestruction(design, world, offset, decay, random); applyRandomDestruction(design, world, offset, decay, random);
} }

View File

@@ -7,6 +7,7 @@ public class MazeDesign
private PartitionNode root; private PartitionNode root;
private DirectedGraph<PartitionNode, DoorwayData> rooms; private DirectedGraph<PartitionNode, DoorwayData> rooms;
private ArrayList<IGraphNode<PartitionNode, DoorwayData>> cores; private ArrayList<IGraphNode<PartitionNode, DoorwayData>> cores;
private ArrayList<BoundingBox> protectedAreas;
public MazeDesign(PartitionNode root, DirectedGraph<PartitionNode, DoorwayData> rooms, public MazeDesign(PartitionNode root, DirectedGraph<PartitionNode, DoorwayData> rooms,
ArrayList<IGraphNode<PartitionNode, DoorwayData>> cores) ArrayList<IGraphNode<PartitionNode, DoorwayData>> cores)
@@ -31,6 +32,11 @@ public class MazeDesign
return cores; return cores;
} }
public ArrayList<BoundingBox> getProtectedAreas()
{
return protectedAreas;
}
public int width() public int width()
{ {
return root.width(); return root.width();

View File

@@ -2,41 +2,22 @@ package StevenDimDoors.experimental;
import StevenDimDoors.mod_pocketDim.Point3D; import StevenDimDoors.mod_pocketDim.Point3D;
public class PartitionNode public class PartitionNode extends BoundingBox
{ {
private Point3D minCorner;
private Point3D maxCorner;
private PartitionNode parent; private PartitionNode parent;
private PartitionNode leftChild = null; private PartitionNode leftChild = null;
private PartitionNode rightChild = null; private PartitionNode rightChild = null;
public PartitionNode(int width, int height, int length) public PartitionNode(int width, int height, int length)
{ {
super(new Point3D(0, 0, 0), new Point3D(width - 1, height - 1, length - 1));
parent = null; parent = null;
minCorner = new Point3D(0, 0, 0);
maxCorner = new Point3D(width - 1, height - 1, length - 1);
} }
private PartitionNode(PartitionNode parent, Point3D minCorner, Point3D maxCorner) private PartitionNode(PartitionNode parent, Point3D minCorner, Point3D maxCorner)
{ {
super(minCorner, maxCorner);
this.parent = parent; this.parent = parent;
this.minCorner = minCorner;
this.maxCorner = maxCorner;
}
public int width()
{
return (maxCorner.getX() - minCorner.getX() + 1);
}
public int height()
{
return (maxCorner.getY() - minCorner.getY() + 1);
}
public int length()
{
return (maxCorner.getZ() - minCorner.getZ() + 1);
} }
public boolean isLeaf() public boolean isLeaf()
@@ -54,16 +35,6 @@ public class PartitionNode
return rightChild; return rightChild;
} }
public Point3D minCorner()
{
return minCorner;
}
public Point3D maxCorner()
{
return maxCorner;
}
public PartitionNode parent() public PartitionNode parent()
{ {
return parent; return parent;
@@ -122,13 +93,6 @@ public class PartitionNode
parent = null; parent = null;
} }
} }
public boolean contains(int x, int y, int z)
{
return ((minCorner.getX() <= x && x <= maxCorner.getX()) &&
(minCorner.getY() <= y && y <= maxCorner.getY()) &&
(minCorner.getZ() <= z && z <= maxCorner.getZ()));
}
public PartitionNode findPoint(int x, int y, int z) public PartitionNode findPoint(int x, int y, int z)
{ {

View File

@@ -586,6 +586,7 @@ public class PocketManager
//Any pocket dimension must be listed with PocketManager to have a dimension ID //Any pocket dimension must be listed with PocketManager to have a dimension ID
//assigned, so it's safe to assume that any unknown dimensions don't belong to us. //assigned, so it's safe to assume that any unknown dimensions don't belong to us.
//FIXME: What's the point of this condition? Most calls to this function will crash anyway! ~SenseiKiwi
if(PocketManager.dimensionData == null) if(PocketManager.dimensionData == null)
{ {
System.out.println("Something odd happend during shutdown"); System.out.println("Something odd happend during shutdown");

View File

@@ -14,16 +14,15 @@ import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.world.World; import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.Point3D; import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor; import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.LinkTypes; import StevenDimDoors.mod_pocketDim.core.LinkTypes;
import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator; import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
import StevenDimDoors.mod_pocketDim.schematic.CompoundFilter; import StevenDimDoors.mod_pocketDim.schematic.CompoundFilter;
import StevenDimDoors.mod_pocketDim.schematic.InvalidSchematicException; import StevenDimDoors.mod_pocketDim.schematic.InvalidSchematicException;
@@ -35,13 +34,14 @@ import StevenDimDoors.mod_pocketDim.util.Point4D;
public class DungeonSchematic extends Schematic { public class DungeonSchematic extends Schematic {
private static final short MAX_VANILLA_BLOCK_ID = 158; private static final short MAX_VANILLA_BLOCK_ID = 173;
private static final short STANDARD_FABRIC_OF_REALITY_ID = 1973; private static final short STANDARD_FABRIC_OF_REALITY_ID = 1973;
private static final short STANDARD_ETERNAL_FABRIC_ID = 220; private static final short STANDARD_ETERNAL_FABRIC_ID = 220;
private static final short STANDARD_WARP_DOOR_ID = 1975; private static final short STANDARD_WARP_DOOR_ID = 1975;
private static final short STANDARD_DIMENSIONAL_DOOR_ID = 1970; private static final short STANDARD_DIMENSIONAL_DOOR_ID = 1970;
private static final short MONOLITH_SPAWN_MARKER_ID = (short) Block.endPortalFrame.blockID; private static final short MONOLITH_SPAWN_MARKER_ID = (short) Block.endPortalFrame.blockID;
private static final short EXIT_DOOR_MARKER_ID = (short) Block.sandStone.blockID; private static final short EXIT_DOOR_MARKER_ID = (short) Block.sandStone.blockID;
private static final int NETHER_DIMENSION_ID = -1;
private int orientation; private int orientation;
private Point3D entranceDoorLocation; private Point3D entranceDoorLocation;
@@ -242,12 +242,12 @@ public class DungeonSchematic extends Schematic {
filler.apply(world, minCorner, maxCorner); filler.apply(world, minCorner, maxCorner);
//Set up entrance door rift //Set up entrance door rift
createEntranceReverseLink(dimension, pocketCenter, entryLink, world); createEntranceReverseLink(world, dimension, pocketCenter, entryLink);
//Set up link data for dimensional doors //Set up link data for dimensional doors
for (Point3D location : dimensionalDoorLocations) for (Point3D location : dimensionalDoorLocations)
{ {
createDimensionalDoorLink(dimension, location, entranceDoorLocation, turnAngle, pocketCenter,world); createDimensionalDoorLink(world, dimension, location, entranceDoorLocation, turnAngle, pocketCenter);
} }
//Set up link data for exit door //Set up link data for exit door
@@ -262,6 +262,16 @@ public class DungeonSchematic extends Schematic {
{ {
spawnMonolith(world, location, entranceDoorLocation, turnAngle, pocketCenter, canSpawn); spawnMonolith(world, location, entranceDoorLocation, turnAngle, pocketCenter, canSpawn);
} }
// If this is a Nether dungeon, search for a sign near the entry door and write the dimension's depth.
// Checking if this is specifically a Nether pack dungeon is a bit tricky, so I'm going to use this
// approach to check - if the dungeon is rooted in the Nether, then it SHOULD be a Nether dungeon.
// This isn't necessarily true if someone uses dd-rift to spawn a dungeon, but it should work under
// normal use of the mod.
if (dimension.root().id() == NETHER_DIMENSION_ID)
{
writeDepthSign(world, pocketCenter, dimension.depth());
}
} }
private static void transformCorners(Point3D schematicEntrance, Point3D pocketCenter, int turnAngle, Point3D minCorner, Point3D maxCorner) private static void transformCorners(Point3D schematicEntrance, Point3D pocketCenter, int turnAngle, Point3D minCorner, Point3D maxCorner)
@@ -289,24 +299,22 @@ public class DungeonSchematic extends Schematic {
} }
} }
private static void createEntranceReverseLink(NewDimData dimension, Point3D pocketCenter, DimLink entryLink,World world) private static void createEntranceReverseLink(World world, NewDimData dimension, Point3D pocketCenter, DimLink entryLink)
{ {
int orientation = world.getBlockMetadata(pocketCenter.getX(), pocketCenter.getY()-1, pocketCenter.getZ()); int orientation = world.getBlockMetadata(pocketCenter.getX(), pocketCenter.getY() - 1, pocketCenter.getZ());
DimLink reverseLink = dimension.createLink(pocketCenter.getX(), pocketCenter.getY(), pocketCenter.getZ(), LinkTypes.REVERSE,orientation); DimLink reverseLink = dimension.createLink(pocketCenter.getX(), pocketCenter.getY(), pocketCenter.getZ(), LinkTypes.REVERSE, orientation);
Point4D destination = entryLink.source(); Point4D destination = entryLink.source();
NewDimData prevDim = PocketManager.getDimensionData(destination.getDimension()); NewDimData prevDim = PocketManager.getDimensionData(destination.getDimension());
prevDim.setDestination(reverseLink, destination.getX(), destination.getY(), destination.getZ()); prevDim.setDestination(reverseLink, destination.getX(), destination.getY(), destination.getZ());
initDoorTileEntity(world, pocketCenter); initDoorTileEntity(world, pocketCenter);
} }
private static void createExitDoorLink(World world, NewDimData dimension, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter) private static void createExitDoorLink(World world, NewDimData dimension, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter)
{ {
//Transform the door's location to the pocket coordinate system //Transform the door's location to the pocket coordinate system
Point3D location = point.clone(); Point3D location = point.clone();
BlockRotator.transformPoint(location, entrance, rotation, pocketCenter); BlockRotator.transformPoint(location, entrance, rotation, pocketCenter);
int orientation = world.getBlockMetadata(location.getX(), location.getY()-1, location.getZ()); int orientation = world.getBlockMetadata(location.getX(), location.getY() - 1, location.getZ());
dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON_EXIT, orientation); dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON_EXIT, orientation);
//Replace the sandstone block under the exit door with the same block as the one underneath it //Replace the sandstone block under the exit door with the same block as the one underneath it
int x = location.getX(); int x = location.getX();
@@ -319,20 +327,17 @@ public class DungeonSchematic extends Schematic {
setBlockDirectly(world, x, y + 1, z, blockID, metadata); setBlockDirectly(world, x, y + 1, z, blockID, metadata);
} }
initDoorTileEntity(world, location); initDoorTileEntity(world, location);
} }
private static void createDimensionalDoorLink(NewDimData dimension, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter,World world) private static void createDimensionalDoorLink(World world, NewDimData dimension, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter)
{ {
//Transform the door's location to the pocket coordinate system //Transform the door's location to the pocket coordinate system
Point3D location = point.clone(); Point3D location = point.clone();
BlockRotator.transformPoint(location, entrance, rotation, pocketCenter); BlockRotator.transformPoint(location, entrance, rotation, pocketCenter);
int orientation = world.getBlockMetadata(location.getX(), location.getY()-1, location.getZ()); int orientation = world.getBlockMetadata(location.getX(), location.getY() - 1, location.getZ());
dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON, orientation); dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON, orientation);
initDoorTileEntity(world, location); initDoorTileEntity(world, location);
} }
private static void spawnMonolith(World world, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter, boolean canSpawn) private static void spawnMonolith(World world, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter, boolean canSpawn)
@@ -350,21 +355,49 @@ public class DungeonSchematic extends Schematic {
world.spawnEntityInWorld(mob); world.spawnEntityInWorld(mob);
} }
} }
private static void initDoorTileEntity(World world, Point3D point) private static void initDoorTileEntity(World world, Point3D point)
{ {
Block door = Block.blocksList[world.getBlockId(point.getX(), point.getY(), point.getZ())]; Block door = Block.blocksList[world.getBlockId(point.getX(), point.getY(), point.getZ())];
Block door2 = Block.blocksList[world.getBlockId(point.getX(), point.getY()-1, point.getZ())]; Block door2 = Block.blocksList[world.getBlockId(point.getX(), point.getY() - 1, point.getZ())];
if(door instanceof IDimDoor&&door2 instanceof IDimDoor) if (door instanceof IDimDoor && door2 instanceof IDimDoor)
{ {
((IDimDoor) door).initDoorTE(world, point.getX(), point.getY(), point.getZ()); ((IDimDoor) door).initDoorTE(world, point.getX(), point.getY(), point.getZ());
((IDimDoor) door).initDoorTE(world, point.getX(), point.getY()-1, point.getZ()); ((IDimDoor) door).initDoorTE(world, point.getX(), point.getY() - 1, point.getZ());
} }
else else
{ {
throw new IllegalArgumentException("Tried to init a dim door TE on a block that isnt a Dim Door!!"); throw new IllegalArgumentException("Tried to init a dim door TE on a block that isnt a Dim Door!!");
} }
}
private static void writeDepthSign(World world, Point3D pocketCenter, int depth)
{
final int SEARCH_RANGE = 5;
int x, y, z, block;
int dx, dy, dz;
for (dy = SEARCH_RANGE; dy >= -SEARCH_RANGE; dy--)
{
for (dz = -SEARCH_RANGE; dz <= SEARCH_RANGE; dz++)
{
for (dx = -SEARCH_RANGE; dx <= SEARCH_RANGE; dx++)
{
x = pocketCenter.getX() + dx;
y = pocketCenter.getY() + dy;
z = pocketCenter.getZ() + dz;
block = world.getBlockId(x, y, z);
if (block == Block.signWall.blockID || block == Block.signPost.blockID)
{
TileEntitySign signEntity = new TileEntitySign();
signEntity.signText[1] = "Level " + depth;
world.setBlockTileEntity(x, y, z, signEntity);
return;
}
}
}
}
} }
} }

View File

@@ -50,6 +50,8 @@ public class DungeonHelper
private static final String DUNGEON_CREATION_GUIDE_SOURCE_PATH = "/mods/DimDoors/text/How_to_add_dungeons.txt"; private static final String DUNGEON_CREATION_GUIDE_SOURCE_PATH = "/mods/DimDoors/text/How_to_add_dungeons.txt";
private static final String RUINS_PACK_PATH = "/schematics/ruins"; private static final String RUINS_PACK_PATH = "/schematics/ruins";
private static final String BUNDLED_RUINS_LIST_PATH = "/schematics/ruins.txt"; private static final String BUNDLED_RUINS_LIST_PATH = "/schematics/ruins.txt";
private static final String NETHER_PACK_PATH = "/schematics/nether";
private static final String BUNDLED_NETHER_LIST_PATH = "/schematics/nether.txt";
private static final String STANDARD_CONFIG_FILE_NAME = "rules.txt"; private static final String STANDARD_CONFIG_FILE_NAME = "rules.txt";
private static final int NETHER_DIMENSION_ID = -1; private static final int NETHER_DIMENSION_ID = -1;
@@ -72,6 +74,7 @@ public class DungeonHelper
private ArrayList<DungeonData> registeredDungeons = new ArrayList<DungeonData>(); private ArrayList<DungeonData> registeredDungeons = new ArrayList<DungeonData>();
private DungeonPack RuinsPack; private DungeonPack RuinsPack;
private DungeonPack NetherPack;
private HashMap<String, DungeonPack> dungeonPackMapping = new HashMap<String, DungeonPack>(); private HashMap<String, DungeonPack> dungeonPackMapping = new HashMap<String, DungeonPack>();
private ArrayList<DungeonPack> dungeonPackList = new ArrayList<DungeonPack>(); private ArrayList<DungeonPack> dungeonPackList = new ArrayList<DungeonPack>();
@@ -246,8 +249,7 @@ public class DungeonHelper
{ {
if (data.id() == NETHER_DIMENSION_ID) if (data.id() == NETHER_DIMENSION_ID)
{ {
//TODO: Change this to the nether-side pack later ^_^ pack = NetherPack;
pack = RuinsPack;
} }
else else
{ {
@@ -261,7 +263,7 @@ public class DungeonHelper
{ {
//Create a link above the specified position. Link to a new pocket dimension. //Create a link above the specified position. Link to a new pocket dimension.
NewDimData dimension = PocketManager.getDimensionData(world); NewDimData dimension = PocketManager.getDimensionData(world);
DimLink link = dimension.createLink(x, y + 1, z, LinkTypes.POCKET,3); DimLink link = dimension.createLink(x, y + 1, z, LinkTypes.POCKET, 3);
//Place a Warp Door linked to that pocket //Place a Warp Door linked to that pocket
ItemDimensionalDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.warpDoor); ItemDimensionalDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.warpDoor);
@@ -434,6 +436,9 @@ public class DungeonHelper
registerBundledPack(BUNDLED_RUINS_LIST_PATH, RUINS_PACK_PATH, "Ruins", reader); registerBundledPack(BUNDLED_RUINS_LIST_PATH, RUINS_PACK_PATH, "Ruins", reader);
RuinsPack = getDungeonPack("Ruins"); RuinsPack = getDungeonPack("Ruins");
registerBundledPack(BUNDLED_NETHER_LIST_PATH, NETHER_PACK_PATH, "Nether", reader);
NetherPack = getDungeonPack("Nether");
System.out.println("Finished registering bundled dungeon packs"); System.out.println("Finished registering bundled dungeon packs");
} }
@@ -497,7 +502,7 @@ public class DungeonHelper
public DungeonData selectDungeon(NewDimData dimension, Random random) public DungeonData selectDungeon(NewDimData dimension, Random random)
{ {
DungeonPack pack = getDimDungeonPack(dimension); DungeonPack pack = getDimDungeonPack(dimension.parent());
DungeonData selection; DungeonData selection;
DungeonPackConfig config; DungeonPackConfig config;
DungeonPack selectedPack; DungeonPack selectedPack;

View File

@@ -40,8 +40,6 @@ public class TileEntityDimDoor extends TileEntity
public void readFromNBT(NBTTagCompound nbt) public void readFromNBT(NBTTagCompound nbt)
{ {
super.readFromNBT(nbt); super.readFromNBT(nbt);
@SuppressWarnings("unused") // ???
int i = nbt.getInteger(("Size"));
try try
{ {
@@ -60,8 +58,6 @@ public class TileEntityDimDoor extends TileEntity
@Override @Override
public void writeToNBT(NBTTagCompound nbt) public void writeToNBT(NBTTagCompound nbt)
{ {
@SuppressWarnings("unused") // ?????
int i = 0;
super.writeToNBT(nbt); super.writeToNBT(nbt);
nbt.setBoolean("openOrClosed", this.openOrClosed); nbt.setBoolean("openOrClosed", this.openOrClosed);

View File

@@ -1,19 +1,14 @@
package StevenDimDoors.mod_pocketDim.tileentities; package StevenDimDoors.mod_pocketDim.tileentities;
import java.awt.List;
import StevenDimDoors.mod_pocketDim.IChunkLoader;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDim.world.PocketBuilder;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkCoordIntPair;
import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type; import net.minecraftforge.common.ForgeChunkManager.Type;
import StevenDimDoors.mod_pocketDim.IChunkLoader;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDim.world.PocketBuilder;
public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLoader public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLoader
{ {
@@ -85,9 +80,6 @@ public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLo
ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair((origin.getX()+xOffset >> 4)+chunkX, (origin.getZ()+zOffset >> 4)+chunkZ)); ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair((origin.getX()+xOffset >> 4)+chunkX, (origin.getZ()+zOffset >> 4)+chunkZ));
} }
} }
} }
@Override @Override
@@ -96,37 +88,4 @@ public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLo
ForgeChunkManager.releaseTicket(chunkTicket); ForgeChunkManager.releaseTicket(chunkTicket);
super.invalidate(); super.invalidate();
} }
@Override
public void readFromNBT(NBTTagCompound nbt)
{ // this and write both call user, and super saves/reads all the same data. why override at all?
super.readFromNBT(nbt);
@SuppressWarnings("unused") // ???
int i = nbt.getInteger(("Size"));
try
{
this.openOrClosed = nbt.getBoolean("openOrClosed");
this.orientation = nbt.getInteger("orientation");
this.hasExit = nbt.getBoolean("hasExit");
this.isDungeonChainLink = nbt.getBoolean("isDungeonChainLink");
}
catch (Exception e) // ???
{
}
}
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@SuppressWarnings("unused") // ?????
int i = 0;
super.writeToNBT(nbt);
nbt.setBoolean("openOrClosed", this.openOrClosed);
nbt.setBoolean("hasExit", this.hasExit);
nbt.setInteger("orientation", this.orientation);
nbt.setBoolean("isDungeonChainLink", isDungeonChainLink);
}
} }

View File

@@ -136,7 +136,7 @@ public class GatewayGenerator implements IWorldGenerator
{ {
//Create a partial link to a dungeon. //Create a partial link to a dungeon.
dimension = PocketManager.getDimensionData(world); dimension = PocketManager.getDimensionData(world);
link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,0); link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON, 0);
//If the current dimension isn't Limbo, build a Rift Gateway out of Stone Bricks //If the current dimension isn't Limbo, build a Rift Gateway out of Stone Bricks
if (dimension.id() != properties.LimboDimensionID) if (dimension.id() != properties.LimboDimensionID)

View File

@@ -31,11 +31,11 @@ public class PocketBuilder
public static final int MIN_POCKET_SIZE = 5; public static final int MIN_POCKET_SIZE = 5;
public static final int MAX_POCKET_SIZE = 51; public static final int MAX_POCKET_SIZE = 51;
public static final int DEFAULT_POCKET_SIZE = 39; public static final int DEFAULT_POCKET_SIZE = 39;
public static final int MIN_POCKET_WALL_THICKNESS = 1; public static final int MIN_POCKET_WALL_THICKNESS = 1;
public static final int MAX_POCKET_WALL_THICKNESS = 10; public static final int MAX_POCKET_WALL_THICKNESS = 10;
public static final int DEFAULT_POCKET_WALL_THICKNESS = 5; public static final int DEFAULT_POCKET_WALL_THICKNESS = 5;
private static final Random random = new Random(); private static final Random random = new Random();
private PocketBuilder() { } private PocketBuilder() { }
@@ -49,7 +49,7 @@ public class PocketBuilder
* @param properties * @param properties
* @return * @return
*/ */
public static boolean regenerateDungeonPocket(NewDimData dimension, DimLink linkIn, DDProperties properties) public static boolean regenerateDungeonPocket(NewDimData dimension, DimLink linkIn, DDProperties properties)
{ {
if (linkIn == null) if (linkIn == null)
@@ -79,7 +79,7 @@ public class PocketBuilder
return false; return false;
} }
NewDimData parent = PocketManager.getDimensionData(incomingLink.source().getDimension()); NewDimData parent = PocketManager.getDimensionData(incomingLink.source().getDimension());
if (!dimension.isDungeon()) if (!dimension.isDungeon())
{ {
throw new IllegalArgumentException("destination must be dungeon"); throw new IllegalArgumentException("destination must be dungeon");
@@ -92,18 +92,18 @@ public class PocketBuilder
{ {
throw new IllegalArgumentException("destination must already exist"); throw new IllegalArgumentException("destination must already exist");
} }
try try
{ {
//Load a world //Load a world
World world = PocketManager.loadDimension(dimension.id()); World world = PocketManager.loadDimension(dimension.id());
if (world == null || world.provider == null) if (world == null || world.provider == null)
{ {
System.err.println("Could not initialize dimension for a dungeon!"); System.err.println("Could not initialize dimension for a dungeon!");
return false; return false;
} }
Point3D destination = new Point3D(incomingLink.destination()); Point3D destination = new Point3D(incomingLink.destination());
loadAndValidateDungeon(dimension.dungeon(), properties).copyToWorld(world, destination, originLink.orientation(), incomingLink, random, properties); loadAndValidateDungeon(dimension.dungeon(), properties).copyToWorld(world, destination, originLink.orientation(), incomingLink, random, properties);
dimension.setFilled(true); dimension.setFilled(true);
@@ -115,130 +115,126 @@ public class PocketBuilder
return false; return false;
} }
} }
private static boolean buildDungeonPocket(DungeonData dungeon, NewDimData dimension, DimLink link, DungeonSchematic schematic,World world, DDProperties properties) private static boolean buildDungeonPocket(DungeonData dungeon, NewDimData dimension, DimLink link, DungeonSchematic schematic,World world, DDProperties properties)
{ {
//Calculate the destination point
DungeonPackConfig packConfig = dungeon.dungeonType().Owner != null ? dungeon.dungeonType().Owner.getConfig() : null;
Point4D source = link.source();
int orientation = link.orientation();
Point3D destination;
//Calculate the destination point if (packConfig != null && packConfig.doDistortDoorCoordinates())
DungeonPackConfig packConfig = dungeon.dungeonType().Owner != null ? dungeon.dungeonType().Owner.getConfig() : null; {
Point4D source = link.source(); destination = calculateNoisyDestination(source, dimension, dungeon, orientation);
int orientation = link.orientation(); }
Point3D destination; else
{
if (packConfig != null && packConfig.doDistortDoorCoordinates()) destination = new Point3D(source.getX(), source.getY(), source.getZ());
{ }
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, properties);
//Finish up destination initialization
dimension.initializeDungeon(destination.getX(), destination.getY(), destination.getZ(), orientation, link, dungeon);
dimension.setFilled(true);
return true;
}
public static boolean generateSelectedDungeonPocket(DimLink link, DDProperties properties,DungeonData data)
{
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.");
}
destination.setY( yCoordHelper.adjustDestinationY(destination.getY(), world.getHeight(), schematic.getEntranceDoorLocation().getY(), schematic.getHeight()) );
//Register a new dimension
NewDimData parent = PocketManager.getDimensionData(link.source().getDimension()); //Generate the dungeon
NewDimData dimension = PocketManager.registerPocket(parent, true); schematic.copyToWorld(world, destination, orientation, link, random, properties);
//Load a world //Finish up destination initialization
World world = PocketManager.loadDimension(dimension.id()); dimension.initializeDungeon(destination.getX(), destination.getY(), destination.getZ(), orientation, link, dungeon);
dimension.setFilled(true);
if (world == null || world.provider == null)
{ return true;
System.err.println("Could not initialize dimension for a dungeon!"); }
return false;
} public static boolean generateSelectedDungeonPocket(DimLink link, DDProperties properties,DungeonData data)
{
DungeonData dungeon = null; if (link == null)
DungeonSchematic schematic = 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.");
}
//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;
}
DungeonData dungeon = null;
DungeonSchematic schematic = null;
dungeon = data;
if (data == null)
{
System.err.println("Could not select a dungeon for generation!");
return false;
}
schematic = loadAndValidateDungeon(dungeon,properties);
return PocketBuilder.buildDungeonPocket(dungeon, dimension, link, schematic, world, properties);
}
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.");
}
//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();
return buildDungeonPocket(dungeon, dimension, link, schematic, world, properties);
}
dungeon = data;
if (data == null)
{
System.err.println("Could not select a dungeon for generation!");
return false;
}
schematic = loadAndValidateDungeon(dungeon,properties);
return PocketBuilder.buildDungeonPocket(dungeon, dimension, link, schematic, world, properties);
}
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.");
}
//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();
return buildDungeonPocket(dungeon, dimension, link, schematic, world, properties);
}
private static Point3D calculateNoisyDestination(Point4D source, NewDimData dimension, DungeonData dungeon, int orientation) private static Point3D calculateNoisyDestination(Point4D source, NewDimData dimension, DungeonData dungeon, int orientation)
{ {
int depth = NewDimData.calculatePackDepth(dimension.parent(), dungeon); int depth = NewDimData.calculatePackDepth(dimension.parent(), dungeon);
@@ -262,12 +258,12 @@ public class PocketBuilder
{ {
throw new IllegalArgumentException("dimension cannot have a dungeon assigned already."); throw new IllegalArgumentException("dimension cannot have a dungeon assigned already.");
} }
DungeonData dungeon = null; DungeonData dungeon = null;
DungeonSchematic schematic = null; DungeonSchematic schematic = null;
dungeon = DungeonHelper.instance().selectDungeon(dimension, random); dungeon = DungeonHelper.instance().selectDungeon(dimension, random);
if (dungeon != null) if (dungeon != null)
{ {
schematic = loadAndValidateDungeon(dungeon, properties); schematic = loadAndValidateDungeon(dungeon, properties);
@@ -276,7 +272,7 @@ public class PocketBuilder
{ {
System.err.println("Could not select a dungeon at all!"); System.err.println("Could not select a dungeon at all!");
} }
if (schematic == null) if (schematic == null)
{ {
//TODO: In the future, remove this dungeon from the generation lists altogether. //TODO: In the future, remove this dungeon from the generation lists altogether.
@@ -295,13 +291,13 @@ public class PocketBuilder
} }
return new Pair<DungeonData, DungeonSchematic>(dungeon, schematic); return new Pair<DungeonData, DungeonSchematic>(dungeon, schematic);
} }
private static DungeonSchematic loadAndValidateDungeon(DungeonData dungeon, DDProperties properties) private static DungeonSchematic loadAndValidateDungeon(DungeonData dungeon, DDProperties properties)
{ {
try try
{ {
DungeonSchematic schematic = dungeon.loadSchematic(); DungeonSchematic schematic = dungeon.loadSchematic();
//Validate the dungeon's dimensions //Validate the dungeon's dimensions
if (hasValidDimensions(schematic)) if (hasValidDimensions(schematic))
{ {
@@ -328,19 +324,19 @@ public class PocketBuilder
return null; return null;
} }
} }
private static boolean hasValidDimensions(DungeonSchematic schematic) private static boolean hasValidDimensions(DungeonSchematic schematic)
{ {
return (schematic.getWidth() <= DungeonHelper.MAX_DUNGEON_WIDTH && return (schematic.getWidth() <= DungeonHelper.MAX_DUNGEON_WIDTH &&
schematic.getHeight() <= DungeonHelper.MAX_DUNGEON_HEIGHT && schematic.getHeight() <= DungeonHelper.MAX_DUNGEON_HEIGHT &&
schematic.getLength() <= DungeonHelper.MAX_DUNGEON_LENGTH); schematic.getLength() <= DungeonHelper.MAX_DUNGEON_LENGTH);
} }
public static boolean generateNewPocket(DimLink link, DDProperties properties, Block door) public static boolean generateNewPocket(DimLink link, DDProperties properties, Block door)
{ {
return generateNewPocket(link, DEFAULT_POCKET_SIZE, DEFAULT_POCKET_WALL_THICKNESS, properties, door); return generateNewPocket(link, DEFAULT_POCKET_SIZE, DEFAULT_POCKET_WALL_THICKNESS, properties, door);
} }
private static int getDoorOrientation(Point4D source, DDProperties properties) private static int getDoorOrientation(Point4D source, DDProperties properties)
{ {
World world = DimensionManager.getWorld(source.getDimension()); World world = DimensionManager.getWorld(source.getDimension());
@@ -352,12 +348,12 @@ public class PocketBuilder
//Check if the block below that point is actually a door //Check if the block below that point is actually a door
int blockID = world.getBlockId(source.getX(), source.getY() - 1, source.getZ()); int blockID = world.getBlockId(source.getX(), source.getY() - 1, source.getZ());
if (blockID != properties.DimensionalDoorID && blockID != properties.WarpDoorID && if (blockID != properties.DimensionalDoorID && blockID != properties.WarpDoorID &&
blockID != properties.TransientDoorID && blockID != properties.TransientDoorID &&
blockID != properties.GoldDimDoorID) 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!"); 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 //Return the orientation portion of its metadata
int orientation = world.getBlockMetadata(source.getX(), source.getY() - 1, source.getZ()) & 3; int orientation = world.getBlockMetadata(source.getX(), source.getY() - 1, source.getZ()) & 3;
return orientation; return orientation;
@@ -377,13 +373,13 @@ public class PocketBuilder
{ {
throw new IllegalArgumentException("link cannot have a destination assigned already."); throw new IllegalArgumentException("link cannot have a destination assigned already.");
} }
if(door==null) if(door==null)
{ {
throw new IllegalArgumentException("Must have a doorItem to gen one!!"); throw new IllegalArgumentException("Must have a doorItem to gen one!!");
} }
if (size < MIN_POCKET_SIZE || size > MAX_POCKET_SIZE) if (size < MIN_POCKET_SIZE || size > MAX_POCKET_SIZE)
{ {
throw new IllegalArgumentException("size must be between " + MIN_POCKET_SIZE + " and " + MAX_POCKET_SIZE + ", inclusive."); throw new IllegalArgumentException("size must be between " + MIN_POCKET_SIZE + " and " + MAX_POCKET_SIZE + ", inclusive.");
@@ -400,34 +396,34 @@ public class PocketBuilder
{ {
throw new IllegalArgumentException("size must be large enough to fit the specified wall thickness and some air space."); throw new IllegalArgumentException("size must be large enough to fit the specified wall thickness and some air space.");
} }
try try
{ {
//Register a new dimension //Register a new dimension
NewDimData parent = PocketManager.getDimensionData(link.source().getDimension()); NewDimData parent = PocketManager.getDimensionData(link.source().getDimension());
NewDimData dimension = PocketManager.registerPocket(parent, false); NewDimData dimension = PocketManager.registerPocket(parent, false);
//Load a world //Load a world
World world = PocketManager.loadDimension(dimension.id()); World world = PocketManager.loadDimension(dimension.id());
if (world == null || world.provider == null) if (world == null || world.provider == null)
{ {
System.err.println("Could not initialize dimension for a pocket!"); System.err.println("Could not initialize dimension for a pocket!");
return false; return false;
} }
//Calculate the destination point //Calculate the destination point
Point4D source = link.source(); Point4D source = link.source();
int destinationY = yCoordHelper.adjustDestinationY(source.getY(), world.getHeight(), wallThickness + 1, size); int destinationY = yCoordHelper.adjustDestinationY(source.getY(), world.getHeight(), wallThickness + 1, size);
int orientation = getDoorOrientation(source, properties); int orientation = getDoorOrientation(source, properties);
//Place a link leading back out of the pocket //Place a link leading back out of the pocket
DimLink reverseLink = dimension.createLink(source.getX(), destinationY, source.getZ(), LinkTypes.REVERSE,(link.orientation()+2)%4); DimLink reverseLink = dimension.createLink(source.getX(), destinationY, source.getZ(), LinkTypes.REVERSE,(link.orientation()+2)%4);
parent.setDestination(reverseLink, source.getX(), source.getY(), source.getZ()); parent.setDestination(reverseLink, source.getX(), source.getY(), source.getZ());
//Build the actual pocket area //Build the actual pocket area
buildPocket(world, source.getX(), destinationY, source.getZ(), orientation, size, wallThickness, properties, door); buildPocket(world, source.getX(), destinationY, source.getZ(), orientation, size, wallThickness, properties, door);
//Finish up destination initialization //Finish up destination initialization
dimension.initializePocket(source.getX(), destinationY, source.getZ(), orientation, link); dimension.initializePocket(source.getX(), destinationY, source.getZ(), orientation, link);
dimension.setFilled(true); dimension.setFilled(true);
@@ -466,13 +462,12 @@ public class PocketBuilder
{ {
throw new IllegalArgumentException("Door must implement IDimDoor"); throw new IllegalArgumentException("Door must implement IDimDoor");
} }
Point3D center = new Point3D(x - wallThickness + 1 + (size / 2), y - wallThickness - 1 + (size / 2), z); Point3D center = new Point3D(x - wallThickness + 1 + (size / 2), y - wallThickness - 1 + (size / 2), z);
Point3D door = new Point3D(x, y, z); Point3D door = new Point3D(x, y, z);
BlockRotator.transformPoint(center, door, orientation - BlockRotator.EAST_DOOR_METADATA, door); BlockRotator.transformPoint(center, door, orientation - BlockRotator.EAST_DOOR_METADATA, door);
//Build the outer layer of Eternal Fabric //Build the outer layer of Eternal Fabric
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), properties.PermaFabricBlockID, false, 0); buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), properties.PermaFabricBlockID, false, 0);
@@ -480,12 +475,11 @@ public class PocketBuilder
for (int layer = 1; layer < wallThickness; layer++) for (int layer = 1; layer < wallThickness; layer++)
{ {
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, properties.FabricBlockID, buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, properties.FabricBlockID,
layer < (wallThickness - 1) && properties.TNFREAKINGT_Enabled, properties.NonTntWeight); layer < (wallThickness - 1) && properties.TNFREAKINGT_Enabled, properties.NonTntWeight);
} }
//MazeBuilder.generate(world, x, y, z, random); //MazeBuilder.generate(world, x, y, z, random);
//Build the door //Build the door
int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, properties.DimensionalDoorID); 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); ItemDimensionalDoor.placeDoorBlock(world, x, y - 1, z, doorOrientation, doorBlock);
@@ -494,15 +488,15 @@ public class PocketBuilder
private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, int blockID, boolean placeTnt, int nonTntWeight) private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, int blockID, boolean placeTnt, int nonTntWeight)
{ {
int x, y, z; int x, y, z;
final int startX = centerX - radius; final int startX = centerX - radius;
final int startY = centerY - radius; final int startY = centerY - radius;
final int startZ = centerZ - radius; final int startZ = centerZ - radius;
final int endX = centerX + radius; final int endX = centerX + radius;
final int endY = centerY + radius; final int endY = centerY + radius;
final int endZ = centerZ + radius; final int endZ = centerZ + radius;
//Build faces of the box //Build faces of the box
for (x = startX; x <= endX; x++) for (x = startX; x <= endX; x++)
{ {
@@ -511,14 +505,14 @@ public class PocketBuilder
setBlockDirectlySpecial(world, x, startY, z, blockID, 0, placeTnt, nonTntWeight); setBlockDirectlySpecial(world, x, startY, z, blockID, 0, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, endY, z, blockID, 0, placeTnt, nonTntWeight); setBlockDirectlySpecial(world, x, endY, z, blockID, 0, placeTnt, nonTntWeight);
} }
for (y = startY; y <= endY; y++) for (y = startY; y <= endY; y++)
{ {
setBlockDirectlySpecial(world, x, y, startZ, blockID, 0, placeTnt, nonTntWeight); setBlockDirectlySpecial(world, x, y, startZ, blockID, 0, placeTnt, nonTntWeight);
setBlockDirectlySpecial(world, x, y, endZ, blockID, 0, placeTnt, nonTntWeight); setBlockDirectlySpecial(world, x, y, endZ, blockID, 0, placeTnt, nonTntWeight);
} }
} }
for (y = startY; y <= endY; y++) for (y = startY; y <= endY; y++)
{ {
for (z = startZ; z <= endZ; z++) for (z = startZ; z <= endZ; z++)
@@ -540,7 +534,7 @@ public class PocketBuilder
setBlockDirectly(world, x, y, z, blockID, metadata); setBlockDirectly(world, x, y, z, blockID, metadata);
} }
} }
private static void setBlockDirectly(World world, int x, int y, int z, int blockID, int metadata) private static void setBlockDirectly(World world, int x, int y, int z, int blockID, int metadata)
{ {
if (blockID != 0 && Block.blocksList[blockID] == null) if (blockID != 0 && Block.blocksList[blockID] == null)
@@ -549,8 +543,8 @@ public class PocketBuilder
} }
int cX = x >> 4; int cX = x >> 4;
int cZ = z >> 4; int cZ = z >> 4;
int cY = y >> 4; int cY = y >> 4;
Chunk chunk; Chunk chunk;
int localX = (x % 16) < 0 ? (x % 16) + 16 : (x % 16); int localX = (x % 16) < 0 ? (x % 16) + 16 : (x % 16);

View File

@@ -20,7 +20,6 @@ public class PocketProvider extends WorldProvider
{ {
private DDProperties properties; private DDProperties properties;
private MonolithSpawner spawner; private MonolithSpawner spawner;
@SuppressWarnings("unused") // ?
private IRenderHandler skyRenderer; private IRenderHandler skyRenderer;
public PocketProvider() public PocketProvider()

View File

@@ -4,7 +4,6 @@ import java.nio.FloatBuffer;
import java.util.Random; import java.util.Random;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@@ -14,6 +13,9 @@ import org.lwjgl.opengl.GL11;
import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -21,9 +23,12 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class RenderDimDoor extends TileEntitySpecialRenderer public class RenderDimDoor extends TileEntitySpecialRenderer
{ {
FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16); private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
private ResourceLocation riftPath= new ResourceLocation(mod_pocketDim.modid+":textures/other/RIFT.png"); private ResourceLocation riftPath= new ResourceLocation(mod_pocketDim.modid + ":textures/other/RIFT.png");
private ResourceLocation warpPath= new ResourceLocation(mod_pocketDim.modid+":textures/other/WARP.png"); private ResourceLocation warpPath= new ResourceLocation(mod_pocketDim.modid + ":textures/other/WARP.png");
private static final int NETHER_DIMENSION_ID = -1;
private static DDProperties properties = null;
public RenderDimDoor() public RenderDimDoor()
{ {
@@ -31,13 +36,11 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
properties = DDProperties.instance(); properties = DDProperties.instance();
} }
private static DDProperties properties = null;
/** /**
* Renders the dimdoor. * Renders the dimdoor.
*/ */
public void renderDimDoorTileEntity(TileEntityDimDoor tile, double x, public void renderDimDoorTileEntity(TileEntityDimDoor tile, double x,
double y, double z, float par8) double y, double z)
{ {
try try
{ {
@@ -108,7 +111,6 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
GL11.glTranslatef(0, GL11.glTranslatef(0,
Minecraft.getSystemTime() % 200000L / 200000.0F, Minecraft.getSystemTime() % 200000L / 200000.0F,
0.0F); 0.0F);
GL11.glTranslatef(0, 0, GL11.glTranslatef(0, 0,
Minecraft.getSystemTime() % 200000L / 200000.0F); Minecraft.getSystemTime() % 200000L / 200000.0F);
@@ -186,17 +188,32 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(0.5F, 0.5F, 0.5F);
GL11.glBegin(GL11.GL_QUADS); GL11.glBegin(GL11.GL_QUADS);
float var21 = rand.nextFloat() * 0.5F + 0.1F; // Set the portal's color depending on whether it's in the Nether
float var22 = rand.nextFloat() * 0.4F + 0.4F; float var21, var22, var23;
float var23 = rand.nextFloat() * 0.6F + 0.5F; NewDimData dimension = PocketManager.getDimensionData(tile.worldObj);
if (dimension.root().id() == NETHER_DIMENSION_ID)
if (count == 0)
{ {
var23 = 1.0F; var21 = rand.nextFloat() * 0.5F + 0.4F;
var22 = 1.0F; var22 = rand.nextFloat() * 0.05F;
// yConverted = 1.0F; var23 = rand.nextFloat() * 0.05F;
if (count == 0)
{
var21 = 1.0F;
}
} }
else
{
var21 = rand.nextFloat() * 0.5F + 0.1F;
var22 = rand.nextFloat() * 0.4F + 0.4F;
var23 = rand.nextFloat() * 0.6F + 0.5F;
if (count == 0)
{
var23 = 1.0F;
var22 = 1.0F;
}
}
GL11.glColor4d(var21 * var17, var22 * var17, var23 * var17, 1.0F); GL11.glColor4d(var21 * var17, var22 * var17, var23 * var17, 1.0F);
if (tile.openOrClosed) if (tile.openOrClosed)
{ {
@@ -215,9 +232,8 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
GL11.glVertex3d(x + 1, y + 1, z + .01); GL11.glVertex3d(x + 1, y + 1, z + .01);
GL11.glVertex3d(x + 1, y - 1, z + .01); GL11.glVertex3d(x + 1, y - 1, z + .01);
GL11.glVertex3d(x, y - 1, z + .01); GL11.glVertex3d(x, y - 1, z + .01);
break; break;
case 2: // case 2:
GL11.glVertex3d(x + .99, y + 1, z); GL11.glVertex3d(x + .99, y + 1, z);
GL11.glVertex3d(x + .99, y + 1, z + 1.0D); GL11.glVertex3d(x + .99, y + 1, z + 1.0D);
GL11.glVertex3d(x + .99, y - 1, z + 1.0D); GL11.glVertex3d(x + .99, y - 1, z + 1.0D);
@@ -229,9 +245,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
GL11.glVertex3d(x + 1, y + 1, z + .99); GL11.glVertex3d(x + 1, y + 1, z + .99);
GL11.glVertex3d(x, y + 1, z + .99); GL11.glVertex3d(x, y + 1, z + .99);
break; break;
case 4:// case 4:
// GL11.glTranslatef();
GL11.glVertex3d(x + .15F, y - 1, z); GL11.glVertex3d(x + .15F, y - 1, z);
GL11.glVertex3d(x + .15, y - 1, z + 1.0D); GL11.glVertex3d(x + .15, y - 1, z + 1.0D);
GL11.glVertex3d(x + .15, y + 1, z + 1.0D); GL11.glVertex3d(x + .15, y + 1, z + 1.0D);
@@ -242,9 +256,8 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
GL11.glVertex3d(x + 1, y + 1, z + .15); GL11.glVertex3d(x + 1, y + 1, z + .15);
GL11.glVertex3d(x + 1, y - 1, z + .15); GL11.glVertex3d(x + 1, y - 1, z + .15);
GL11.glVertex3d(x, y - 1, z + .15); GL11.glVertex3d(x, y - 1, z + .15);
break; break;
case 6: // case 6:
GL11.glVertex3d(x + .85, y + 1, z); GL11.glVertex3d(x + .85, y + 1, z);
GL11.glVertex3d(x + .85, y + 1, z + 1.0D); GL11.glVertex3d(x + .85, y + 1, z + 1.0D);
GL11.glVertex3d(x + .85, y - 1, z + 1.0D); GL11.glVertex3d(x + .85, y - 1, z + 1.0D);
@@ -256,8 +269,6 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
GL11.glVertex3d(x + 1, y + 1, z + .85); GL11.glVertex3d(x + 1, y + 1, z + .85);
GL11.glVertex3d(x, y + 1, z + .85); GL11.glVertex3d(x, y + 1, z + .85);
break; break;
default:
break;
} }
} }
@@ -275,22 +286,20 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHTING);
} }
private FloatBuffer getFloatBuffer(float par1, float par2, float par3, private FloatBuffer getFloatBuffer(float par1, float par2, float par3, float par4)
float par4)
{ {
this.field_76908_a.clear(); buffer.clear();
this.field_76908_a.put(par1).put(par2).put(par3).put(par4); buffer.put(par1).put(par2).put(par3).put(par4);
this.field_76908_a.flip(); buffer.flip();
return this.field_76908_a; return buffer;
} }
public void renderTileEntityAt(TileEntity par1TileEntity, double par2, @Override
double par4, double par6, float par8) public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
{ {
if (properties.DoorRenderingEnabled) if (properties.DoorRenderingEnabled)
{ {
this.renderDimDoorTileEntity((TileEntityDimDoor) par1TileEntity, renderDimDoorTileEntity((TileEntityDimDoor) par1TileEntity, par2, par4, par6);
par2, par4, par6, par8);
} }
} }
} }

View File

@@ -0,0 +1,16 @@
/schematics/nether/ComplexHall_SK-CourtyardAmbush_Open_100.schematic
/schematics/nether/ComplexHall_SK-Intersection_Open_100.schematic
/schematics/nether/ComplexHall_SK-SoulWastes_Open_100.schematic
/schematics/nether/ComplexHall_SK-Starfall_Open_100.schematic
/schematics/nether/ComplexHall_SK-TheCauldron_Open_100.schematic
/schematics/nether/Maze_SK-BrimstoneMines_Open_80.schematic
/schematics/nether/Maze_SK-QuartzfoldCave_Open_40.schematic
/schematics/nether/Maze_SK-Tangle_Open_80.schematic
/schematics/nether/SimpleHall_SK-AnvilValley_Open_100.schematic
/schematics/nether/SimpleHall_SK-Arena_Open_100.schematic
/schematics/nether/SimpleHall_SK-DarkPathLeft_Open_50.schematic
/schematics/nether/SimpleHall_SK-DarkPathRight_Open_50.schematic
/schematics/nether/SimpleHall_SK-DiamondRoom_Open_100.schematic
/schematics/nether/SimpleHall_SK-LongBridge_Open_100.schematic
/schematics/nether/SimpleHall_SK-SpiralStairsDown_Open_100.schematic
/schematics/nether/SimpleHall_SK-TheFurnace_Open_100.schematic

View File

@@ -0,0 +1,21 @@
Version 1
Types:
SimpleHall
ComplexHall
Maze
Settings:
AllowDuplicatesInChain = false
AllowPackChangeOut = false
DistortDoorCoordinates = false
## Prevent this pack from being selected for transitioning in once we've transitioned out
AllowPackChangeIn = false
Rules:
Maze ? ? ? ? ? ? ? ? ? -> Maze
? -> SimpleHall ComplexHall
-> Maze

View File

@@ -8,7 +8,7 @@
/schematics/ruins/ComplexHall_SK-AnchoredDescent_Open_50.schematic /schematics/ruins/ComplexHall_SK-AnchoredDescent_Open_50.schematic
/schematics/ruins/ComplexHall_SK-HallwayHiddenTreasure-B_Closed_50.schematic /schematics/ruins/ComplexHall_SK-HallwayHiddenTreasure-B_Closed_50.schematic
/schematics/ruins/ComplexHall_SK-HiddenStairs_Open_100.schematic /schematics/ruins/ComplexHall_SK-HiddenStairs_Open_100.schematic
/schematics/ruins/ComplexHall_SK-LostGarden_Open_10.schematic /schematics/ruins/ComplexHall_SK-LostGarden_Open_40.schematic
/schematics/ruins/ComplexHall_SK-RuinsOhNo_Open_50.schematic /schematics/ruins/ComplexHall_SK-RuinsOhNo_Open_50.schematic
/schematics/ruins/complexHall_smallBranchWithExit_closed_100.schematic /schematics/ruins/complexHall_smallBranchWithExit_closed_100.schematic
/schematics/ruins/complexHall_smallRotundaWithExit_closed_100.schematic /schematics/ruins/complexHall_smallRotundaWithExit_closed_100.schematic
@@ -19,7 +19,7 @@
/schematics/ruins/deadEnd_fallingTrapO_open_100.schematic /schematics/ruins/deadEnd_fallingTrapO_open_100.schematic
/schematics/ruins/deadEnd_hiddenStaircaseO_open_100.schematic /schematics/ruins/deadEnd_hiddenStaircaseO_open_100.schematic
/schematics/ruins/deadEnd_lavaTrapO_open_100.schematic /schematics/ruins/deadEnd_lavaTrapO_open_100.schematic
/schematics/ruins/deadend_randomTree_open_75.schematic /schematics/ruins/deadEnd_randomTree_open_75.schematic
/schematics/ruins/DeadEnd_SK-EyesOfTricksters_Open_50.schematic /schematics/ruins/DeadEnd_SK-EyesOfTricksters_Open_50.schematic
/schematics/ruins/DeadEnd_SK-FarAwayInTheDark_Open_100.schematic /schematics/ruins/DeadEnd_SK-FarAwayInTheDark_Open_100.schematic
/schematics/ruins/DeadEnd_SK-UnstableDesert_Open_50.schematic /schematics/ruins/DeadEnd_SK-UnstableDesert_Open_50.schematic
@@ -37,8 +37,8 @@
/schematics/ruins/hub_fortRuins_open_100.schematic /schematics/ruins/hub_fortRuins_open_100.schematic
/schematics/ruins/hub_hallwayTrapRooms1_closed_100.schematic /schematics/ruins/hub_hallwayTrapRooms1_closed_100.schematic
/schematics/ruins/hub_longDoorHallway_closed_100.schematic /schematics/ruins/hub_longDoorHallway_closed_100.schematic
/schematics/ruins/Hub_SK-Claustrophobia_Open_10.schematic /schematics/ruins/Hub_SK-Claustrophobia_Open_40.schematic
/schematics/ruins/Hub_SK-FractalCage_Open_20.schematic /schematics/ruins/Hub_SK-FractalCage_Open_40.schematic
/schematics/ruins/Hub_SK-HeartOfDisorder_Open_50.schematic /schematics/ruins/Hub_SK-HeartOfDisorder_Open_50.schematic
/schematics/ruins/Hub_SK-TheNexus_Open_40.schematic /schematics/ruins/Hub_SK-TheNexus_Open_40.schematic
/schematics/ruins/maze_smallMaze1_closed_100.schematic /schematics/ruins/maze_smallMaze1_closed_100.schematic
@@ -53,9 +53,9 @@
/schematics/ruins/SimpleHall_SK-LeftUpPath_Open_50.schematic /schematics/ruins/SimpleHall_SK-LeftUpPath_Open_50.schematic
/schematics/ruins/SimpleHall_SK-RightDownStairs_Open_50.schematic /schematics/ruins/SimpleHall_SK-RightDownStairs_Open_50.schematic
/schematics/ruins/SimpleHall_SK-RightUpPath_Open_50.schematic /schematics/ruins/SimpleHall_SK-RightUpPath_Open_50.schematic
/schematics/ruins/SimpleHall_SK-SpiralHallway_Open_100.schematic
/schematics/ruins/SimpleHall_SK-UTurnLeft_Open_50.schematic /schematics/ruins/SimpleHall_SK-UTurnLeft_Open_50.schematic
/schematics/ruins/SimpleHall_SK-UTurnRight_Open_50.schematic /schematics/ruins/SimpleHall_SK-UTurnRight_Open_50.schematic
/schematics/ruins/SimpleHall_SK-SpiralHallway_Open_100.schematic
/schematics/ruins/simpleHall_smallSimpleLeft_closed_100.schematic /schematics/ruins/simpleHall_smallSimpleLeft_closed_100.schematic
/schematics/ruins/simpleHall_smallSimpleRight_closed_100.schematic /schematics/ruins/simpleHall_smallSimpleRight_closed_100.schematic
/schematics/ruins/trap_fakeTNTTrap_closed_100.schematic /schematics/ruins/trap_fakeTNTTrap_closed_100.schematic
@@ -67,10 +67,9 @@
/schematics/ruins/trap_pistonFloorPlatform_closed_100.schematic /schematics/ruins/trap_pistonFloorPlatform_closed_100.schematic
/schematics/ruins/trap_pistonHallway_closed_100.schematic /schematics/ruins/trap_pistonHallway_closed_100.schematic
/schematics/ruins/trap_pistonSmasherHall_closed_100.schematic /schematics/ruins/trap_pistonSmasherHall_closed_100.schematic
/schematics/ruins/trap_raceTheTNTHall_closed_50.schematic
/schematics/ruins/Trap_SK-FakeTNTTrap-B_Closed_50.schematic /schematics/ruins/Trap_SK-FakeTNTTrap-B_Closed_50.schematic
/schematics/ruins/Trap_SK-NicolesTower_Open_50.schematic /schematics/ruins/Trap_SK-NicolesTower_Open_50.schematic
/schematics/ruins/Trap_SK-RestlessCorridor_Open_10.schematic /schematics/ruins/Trap_SK-RestlessCorridor_Open_40.schematic
/schematics/ruins/Trap_SK-SimpleLeftTrap_Closed_50.schematic /schematics/ruins/Trap_SK-SimpleLeftTrap_Closed_50.schematic
/schematics/ruins/Trap_SK-SimpleRightTrap_Closed_50.schematic /schematics/ruins/Trap_SK-SimpleRightTrap_Closed_50.schematic
/schematics/ruins/Trap_SK-TrappedStairsDown_Closed_50.schematic /schematics/ruins/Trap_SK-TrappedStairsDown_Closed_50.schematic