rebuilt how rifts get dungeon data assigned to them
This commit is contained in:
parent
2e2184f033
commit
b97eab46b5
13 changed files with 141 additions and 27 deletions
|
@ -173,7 +173,7 @@ public class DimDoorsConfig
|
|||
limboReturnRange=config.get(Configuration.CATEGORY_GENERAL, "limboReturnRange", 500);
|
||||
limboReturnRange.comment = "The farthest possible distance that limbo can send you upon return to the overworld.";
|
||||
|
||||
pocketProviderID=config.get(Configuration.CATEGORY_GENERAL, "pocketProviderID", 12);
|
||||
pocketProviderID=config.get(Configuration.CATEGORY_GENERAL, "pocketProviderID", 14);
|
||||
|
||||
limboProviderID=config.get(Configuration.CATEGORY_GENERAL, "limboProvider ID", 13);
|
||||
|
||||
|
|
|
@ -51,6 +51,13 @@ public class DungeonGenerator implements Serializable
|
|||
int count=10;
|
||||
try
|
||||
{
|
||||
|
||||
if(dimHelper.dimList.get(incoming.destDimID)!=null&&dimHelper.dimList.get(incoming.destDimID).dungeonGenerator!=null)
|
||||
{
|
||||
mod_pocketDim.loader.init(incoming);
|
||||
dimHelper.dimList.get(incoming.destDimID).dungeonGenerator=dimHelper.dimList.get(incoming.destDimID).dungeonGenerator;
|
||||
return;
|
||||
}
|
||||
if(incoming.destYCoord>15)
|
||||
{
|
||||
do
|
||||
|
@ -194,7 +201,7 @@ public class DungeonGenerator implements Serializable
|
|||
}
|
||||
|
||||
|
||||
mod_pocketDim.loader.init(dungeon.schematicPath, incoming);
|
||||
|
||||
dimHelper.dimList.get(incoming.destDimID).dungeonGenerator=dungeon;
|
||||
//mod_pocketDim.loader.generateSchematic(incoming,0,0,0);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ public class LinkData implements Serializable
|
|||
|
||||
|
||||
|
||||
|
||||
public int destDimID;
|
||||
public int locDimID;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class RiftGenerator implements IWorldGenerator
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
if(random.nextInt(540)==0)
|
||||
{
|
||||
i=chunkX*16-random.nextInt(16);
|
||||
|
@ -139,9 +139,11 @@ public class RiftGenerator implements IWorldGenerator
|
|||
|
||||
}
|
||||
}
|
||||
**/
|
||||
|
||||
}
|
||||
if(random.nextInt(220)==0&&world.provider.getDimensionName()!="PocketDim"&&!world.isRemote&&mod_pocketDim.riftsInWorldGen)
|
||||
|
||||
if(random.nextInt(250)==0&&world.provider.getDimensionName()!="PocketDim"&&!world.isRemote&&mod_pocketDim.riftsInWorldGen)
|
||||
{
|
||||
// System.out.println("tryingToGen");
|
||||
int blockID=Block.stoneBrick.blockID;
|
||||
|
|
|
@ -66,8 +66,9 @@ public class SchematicLoader
|
|||
}
|
||||
|
||||
|
||||
public void init(String filePath, LinkData link)
|
||||
public void init(LinkData link)
|
||||
{
|
||||
String filePath = dimHelper.dimList.get(link.destDimID).dungeonGenerator.schematicPath;
|
||||
|
||||
this.schematic=filePath;
|
||||
try
|
||||
|
@ -968,6 +969,8 @@ public class SchematicLoader
|
|||
link.destXCoord=this.incomingLink.getX();
|
||||
link.destYCoord=this.incomingLink.getY();
|
||||
link.destZCoord=this.incomingLink.getZ();
|
||||
dimHelper.instance.createLink(link);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@ public class ExitDoor extends dimDoor
|
|||
|
||||
//System.out.println("RiftPresent at "+String.valueOf(par1World.provider.dimensionId));
|
||||
dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World).linkOrientation=par1World.getBlockMetadata(par2, par3-1, par4);
|
||||
dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World).hasGennedDoor=false;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ public class dimDoor extends BlockContainer
|
|||
if(dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World)!=null)
|
||||
{
|
||||
dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World).linkOrientation=par1World.getBlockMetadata(par2, par3-1, par4);
|
||||
|
||||
dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World).hasGennedDoor=false;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@ import java.util.ArrayList;
|
|||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.DimData;
|
||||
import StevenDimDoors.mod_pocketDim.DungeonGenerator;
|
||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.dimHelper;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.MinecraftException;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CommandAddDungeonRift extends CommandBase
|
||||
|
@ -27,7 +29,10 @@ public class CommandAddDungeonRift extends CommandBase
|
|||
public void processCommand(ICommandSender var1, String[] var2)
|
||||
|
||||
{
|
||||
|
||||
if(var2==null||this.getCommandSenderAsPlayer(var1).worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LinkData link = new LinkData(this.getCommandSenderAsPlayer(var1).worldObj.provider.dimensionId, 0,
|
||||
MathHelper.floor_double(this.getCommandSenderAsPlayer(var1).posX),
|
||||
|
@ -37,13 +42,78 @@ public class CommandAddDungeonRift extends CommandBase
|
|||
MathHelper.floor_double(this.getCommandSenderAsPlayer(var1).posY)+1,
|
||||
MathHelper.floor_double(this.getCommandSenderAsPlayer(var1).posZ),true,3);
|
||||
|
||||
link = dimHelper.instance.createPocket(link,true, true);
|
||||
|
||||
|
||||
|
||||
if(var2.length!=0&&var2[0].equals("random"))
|
||||
{
|
||||
this.getCommandSenderAsPlayer(var1).sendChatToPlayer("Created dungeon rift");
|
||||
dimHelper.instance.createLink(link);
|
||||
link = dimHelper.instance.createPocket(link,true, true);
|
||||
|
||||
}
|
||||
else if(var2.length!=0&&var2[0].equals("list"))
|
||||
{
|
||||
for(DungeonGenerator dungeonGen : mod_pocketDim.registeredDungeons)
|
||||
{
|
||||
String dungeonName =dungeonGen.schematicPath;
|
||||
if(dungeonName.contains("DimDoors_Custom_schematics"))
|
||||
{
|
||||
dungeonName= dungeonName.substring(dungeonName.indexOf("DimDoors_Custom_schematics")+26);
|
||||
}
|
||||
|
||||
dungeonName =dungeonName.replace("/", "").replace(".", "").replace("schematics", "").replace("schematic", "");
|
||||
|
||||
|
||||
this.getCommandSenderAsPlayer(var1).sendChatToPlayer(dungeonName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else if(var2.length!=0)
|
||||
{
|
||||
for(DungeonGenerator dungeonGen : mod_pocketDim.registeredDungeons)
|
||||
|
||||
{
|
||||
String dungeonName =dungeonGen.schematicPath.toLowerCase();
|
||||
|
||||
|
||||
|
||||
if(dungeonName.contains(var2[0].toLowerCase()))
|
||||
{
|
||||
|
||||
link = dimHelper.instance.createPocket(link,true, true);
|
||||
|
||||
dimHelper.dimList.get(link.destDimID).dungeonGenerator=dungeonGen;
|
||||
|
||||
this.getCommandSenderAsPlayer(var1).sendChatToPlayer("Genned dungeon " +dungeonName);
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if(var2!=null&&!var2[0].equals("random"))
|
||||
{
|
||||
this.getCommandSenderAsPlayer(var1).sendChatToPlayer("could not find dungeon, 'list' for list of dungeons");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.getCommandSenderAsPlayer(var1).sendChatToPlayer("invalid arguments- 'random' for random dungeon, or 'list' for dungeon names");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.getCommandSenderAsPlayer(var1).sendChatToPlayer("Created dungeon rift");
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -702,6 +702,7 @@ public class dimHelper extends DimensionManager
|
|||
{
|
||||
try
|
||||
{
|
||||
|
||||
if(this.getWorld(incomingLink.destDimID)==null)
|
||||
{
|
||||
this.initDimension(incomingLink.destDimID);
|
||||
|
@ -810,7 +811,8 @@ public class dimHelper extends DimensionManager
|
|||
{
|
||||
//System.out.println("genning dungeon pocket");
|
||||
|
||||
DungeonGenerator.generateDungeonlink(incomingLink);
|
||||
|
||||
mod_pocketDim.loader.init(incomingLink);
|
||||
data.hasBeenFilled=true;
|
||||
|
||||
}
|
||||
|
@ -1006,6 +1008,7 @@ public class dimHelper extends DimensionManager
|
|||
|
||||
destDimData.isDimRandomRift=isRandomRift;
|
||||
|
||||
|
||||
this.dimList.put(this.getWorld(link.locDimID).provider.dimensionId, locationDimData);
|
||||
this.dimList.put(dimensionID, destDimData);
|
||||
|
||||
|
@ -1017,16 +1020,20 @@ public class dimHelper extends DimensionManager
|
|||
PacketHandler.onDimCreatedPacket(destDimData);
|
||||
}
|
||||
|
||||
LinkData linkData = this.createLink(this.getWorld(link.locDimID).provider.dimensionId,dimensionID,link.locXCoord,link.locYCoord,link.locZCoord, link.destXCoord,link.destYCoord,link.destZCoord,link.linkOrientation); //creates and registers the two rifts that link the parent and pocket dim.
|
||||
link = this.createLink(this.getWorld(link.locDimID).provider.dimensionId,dimensionID,link.locXCoord,link.locYCoord,link.locZCoord, link.destXCoord,link.destYCoord,link.destZCoord,link.linkOrientation); //creates and registers the two rifts that link the parent and pocket dim.
|
||||
this.createLink(dimensionID,this.getWorld(link.locDimID).provider.dimensionId, link.destXCoord,link.destYCoord,link.destZCoord, link.locXCoord,link.locYCoord,link.locZCoord, this.flipDoorMetadata(link.linkOrientation));
|
||||
|
||||
if(isRandomRift)
|
||||
{
|
||||
DungeonGenerator.generateDungeonlink(link);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return linkData;
|
||||
return link;
|
||||
|
||||
|
||||
}
|
||||
|
@ -1040,7 +1047,7 @@ public class dimHelper extends DimensionManager
|
|||
//TODO change from saving serialized objects to just saving data for compatabilies sake.
|
||||
public void save()
|
||||
{
|
||||
if(!this.isSaving)
|
||||
if(!this.isSaving&&!DimensionManager.getWorld(0).isRemote&&this.getCurrentSaveRootDirectory()!=null)
|
||||
{
|
||||
// System.out.println("saving");
|
||||
|
||||
|
@ -1097,6 +1104,8 @@ public class dimHelper extends DimensionManager
|
|||
System.out.println("Loading DimDoors data");
|
||||
FileInputStream saveFile = null;
|
||||
|
||||
if(!DimensionManager.getWorld(0).isRemote&&this.getCurrentSaveRootDirectory()!=null)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1224,7 +1233,7 @@ public class dimHelper extends DimensionManager
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class copyfile
|
|||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
//e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -92,8 +92,19 @@ public class itemDimDoor extends ItemDoor
|
|||
}
|
||||
else
|
||||
{
|
||||
int offset = 0;
|
||||
int idBlock = par3World.getBlockId(par4, par5-1, par6);
|
||||
|
||||
if(Block.blocksList.length>idBlock&&idBlock!=0)
|
||||
{
|
||||
if(Block.blocksList[idBlock].isBlockReplaceable(par3World, par4, par5-1, par6))
|
||||
{
|
||||
offset = 1;
|
||||
}
|
||||
}
|
||||
|
||||
placeDoorBlock(par3World, par4, par5-offset, par6, var12, var11);
|
||||
|
||||
placeDoorBlock(par3World, par4, par5, par6, var12, var11);
|
||||
|
||||
|
||||
--par1ItemStack.stackSize;
|
||||
|
@ -178,6 +189,8 @@ public class itemDimDoor extends ItemDoor
|
|||
else
|
||||
{
|
||||
|
||||
|
||||
|
||||
placeDoorBlock(par2World, par4, par5-1, par6, var12, var11);
|
||||
|
||||
|
||||
|
|
|
@ -81,11 +81,15 @@ public class itemLinkSignature extends Item
|
|||
|
||||
//System.out.println(key);
|
||||
int offset = 2;
|
||||
int idBlock = par3World.getBlockId(par4, par5, par6);
|
||||
|
||||
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
|
||||
{
|
||||
offset = 1;
|
||||
}
|
||||
if(Block.blocksList.length>idBlock&&idBlock!=0)
|
||||
{
|
||||
if(Block.blocksList[idBlock].isBlockReplaceable(par3World, par4, par5, par6))
|
||||
{
|
||||
offset = 1;
|
||||
}
|
||||
}
|
||||
if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.dimDoorID&&par3World.getBlockId(par4, par5+1, par6)==mod_pocketDim.dimDoorID)
|
||||
{
|
||||
offset = 1;
|
||||
|
|
|
@ -115,6 +115,7 @@ public class mod_pocketDim
|
|||
public static final ICommand startDungeonCreation = new CommandStartDungeonCreation();
|
||||
|
||||
|
||||
|
||||
public static int providerID;
|
||||
public static int dimDoorID;
|
||||
public static int ExitDoorID;
|
||||
|
@ -252,6 +253,7 @@ public class mod_pocketDim
|
|||
|
||||
|
||||
|
||||
|
||||
public static RiftGenerator riftGen = new RiftGenerator();
|
||||
|
||||
|
||||
|
@ -287,7 +289,10 @@ public class mod_pocketDim
|
|||
file.mkdir();
|
||||
|
||||
String helpFile = "/mods/DimDoors/How_to_add_dungeons.txt";
|
||||
copyfile.copyFile(helpFile, file+"/How_to_add_dungeons.txt");
|
||||
if(new File(helpFile).exists())
|
||||
{
|
||||
copyfile.copyFile(helpFile, file+"/How_to_add_dungeons.txt");
|
||||
}
|
||||
|
||||
|
||||
File[] schematicNames=file.listFiles();
|
||||
|
@ -348,7 +353,6 @@ public class mod_pocketDim
|
|||
|
||||
}
|
||||
|
||||
this.registeredDungeons.add(new DungeonGenerator(weight,path,open));
|
||||
|
||||
System.out.println("Imported "+schematicFile.getName());
|
||||
}
|
||||
|
@ -656,7 +660,7 @@ public class mod_pocketDim
|
|||
this.deadEnds.add(new DungeonGenerator(0, "/schematics/smallPond.schematic", true));
|
||||
|
||||
|
||||
// this.pistonTraps.add(new DungeonGenerator(0, "/schematics/fakeTNTTrap.schematic", false));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/fakeTNTTrap.schematic", false));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/hallwayPitFallTrap.schematic", false));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/hallwayPitFallTrap.schematic", false));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/pistonFallRuins.schematic", false));
|
||||
|
@ -664,7 +668,7 @@ public class mod_pocketDim
|
|||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/pistonFloorHall.schematic", false));
|
||||
// this.pistonTraps.add(new DungeonGenerator(0, "/schematics/pistonHallway.schematic", null));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/pistonSmasherHall.schematic", false));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/raceTheTNTHall.schematic", false));
|
||||
// this.pistonTraps.add(new DungeonGenerator(0, "/schematics/raceTheTNTHall.schematic", false));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/simpleDropHall.schematic", false));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/wallFallcomboPistonHall.schematic", false));
|
||||
this.pistonTraps.add(new DungeonGenerator(0, "/schematics/wallFallcomboPistonHall.schematic", false));
|
||||
|
|
Loading…
Reference in a new issue