I derped. Oh well. #122

Merged
StevenRS11 merged 18 commits from mazes into master 2014-01-04 07:15:16 +00:00
7 changed files with 65 additions and 13 deletions
Showing only changes of commit 394f92d5fc - Show all commits

View File

@@ -25,7 +25,6 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SuppressWarnings("deprecation")
public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEntityProvider
{
protected final DDProperties properties;
@@ -429,4 +428,11 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
int direction = MathHelper.floor_double((entity.rotationYaw + 90) * 4.0F / 360.0F + 0.5D) & 3;
return ((metadata & 3) == direction);
}
@Override
public void initDoorTE(World world, int x, int y, int z)
{
TileEntity te = this.createNewTileEntity(world);
world.setBlockTileEntity(x, y, z, te);
}
}

View File

@@ -10,4 +10,6 @@ public interface IDimDoor
public void placeLink(World world, int x, int y, int z);
public int getDrops();
public void initDoorTE(World world, int x, int y, int z);
}

View File

@@ -118,4 +118,11 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
{
return (metadata & 8) == 0;
}
@Override
public void initDoorTE(World world, int x, int y, int z)
{
TileEntity te = this.createNewTileEntity(world);
world.setBlockTileEntity(x, y, z, te);
}
}

View File

@@ -300,7 +300,6 @@ public class PocketManager
PocketManager.dimensionData.put(dimData.id, dimData);
dimWatcher.onCreated(new ClientDimData(dimData));
return true;
}
public static boolean deletePocket(NewDimData target, boolean deleteFolder)
@@ -403,7 +402,7 @@ public class PocketManager
*/
private static void loadInternal()
{
System.out.println(!FMLCommonHandler.instance().getSide().isClient());
//System.out.println(!FMLCommonHandler.instance().getSide().isClient());
File saveDir = DimensionManager.getCurrentSaveRootDirectory();
if (saveDir != null)
@@ -507,14 +506,24 @@ public class PocketManager
DimensionManager.registerDimension(dimensionID, properties.PocketProviderID);
return registerDimension(dimensionID, (InnerDimData) parent, true, isDungeon);
}
/**
* Registers a dimension with DD but NOT with forge.
* @param dimensionID
* @param parent
* @param isPocket
* @param isDungeon
* @return
*/
private static NewDimData registerDimension(int dimensionID, InnerDimData parent, boolean isPocket, boolean isDungeon)
{
if (dimensionData.containsKey(dimensionID))
{
if(PocketManager.dimensionIDBlackList.contains(dimensionID))
{
throw new IllegalArgumentException("Cannot register a dimension with ID = " + dimensionID + " because it has been blacklisted.");
}
throw new IllegalArgumentException("Cannot register a dimension with ID = " + dimensionID + " because it has already been registered.");
}
//TODO blacklist stuff probably should happen here
InnerDimData dimension = new InnerDimData(dimensionID, parent, isPocket, isDungeon, linkWatcher);
dimensionData.put(dimensionID, dimension);
if (!dimension.isPocketDimension())
@@ -529,6 +538,7 @@ public class PocketManager
@SideOnly(Side.CLIENT)
private static NewDimData registerClientDimension(int dimensionID, int rootID)
{
System.out.println("Registered dim "+dimensionID+" on the client.");
// No need to raise events heres since this code should only run on the client side
// getDimensionData() always handles root dimensions properly, even if the weren't defined before
@@ -560,7 +570,7 @@ public class PocketManager
//Steven
DimensionManager.registerDimension(dimensionID, mod_pocketDim.properties.PocketProviderID);
}
return dimension;
return dimension;
}
public static NewDimData getDimensionData(World world)
@@ -579,6 +589,7 @@ public class PocketManager
if(PocketManager.dimensionData == null)
{
System.out.println("Something odd happend during shutdown");
return null;
}
NewDimData dimension = PocketManager.dimensionData.get(dimensionID);
if (dimension == null)

View File

@@ -17,10 +17,13 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.Point3D;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.IDimDoor;
import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
import StevenDimDoors.mod_pocketDim.schematic.CompoundFilter;
import StevenDimDoors.mod_pocketDim.schematic.InvalidSchematicException;
@@ -293,6 +296,8 @@ public class DungeonSchematic extends Schematic {
Point4D destination = entryLink.source();
NewDimData prevDim = PocketManager.getDimensionData(destination.getDimension());
prevDim.setDestination(reverseLink, destination.getX(), destination.getY(), destination.getZ());
initDoorTileEntity(world, pocketCenter);
}
private static void createExitDoorLink(World world, NewDimData dimension, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter)
@@ -313,6 +318,8 @@ public class DungeonSchematic extends Schematic {
int metadata = world.getBlockMetadata(x, y, z);
setBlockDirectly(world, x, y + 1, z, blockID, metadata);
}
initDoorTileEntity(world, location);
}
private static void createDimensionalDoorLink(NewDimData dimension, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter,World world)
@@ -323,6 +330,9 @@ public class DungeonSchematic extends Schematic {
int orientation = world.getBlockMetadata(location.getX(), location.getY()-1, location.getZ());
dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON, orientation);
initDoorTileEntity(world, location);
}
private static void spawnMonolith(World world, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter, boolean canSpawn)
@@ -340,4 +350,21 @@ public class DungeonSchematic extends Schematic {
world.spawnEntityInWorld(mob);
}
}
private static void initDoorTileEntity(World world, Point3D point)
{
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())];
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()-1, point.getZ());
}
else
{
throw new IllegalArgumentException("Tried to init a dim door TE on a block that isnt a Dim Door!!");
}
}
}

View File

@@ -19,15 +19,14 @@ public class TileEntityDimDoor extends TileEntity
@Override
public boolean canUpdate()
{
return false;
return true;
}
@Override
public void updateEntity()
{
}
@Override
public Packet getDescriptionPacket()
{
if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null)

View File

@@ -472,7 +472,7 @@ public class PocketBuilder
Point3D door = new Point3D(x, y, z);
BlockRotator.transformPoint(center, door, orientation - BlockRotator.EAST_DOOR_METADATA, door);
/*
//Build the outer layer of Eternal Fabric
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), properties.PermaFabricBlockID, false, 0);
@@ -482,9 +482,9 @@ public class PocketBuilder
buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, properties.FabricBlockID,
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
int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, properties.DimensionalDoorID);