Overhauled configuration properties

Moved all configuration variables from mod_pocketDim to DDProperties
(formerly DimDoorsConfig). Changed property names to be clearer in
config file, modified some comments, and generally cleaned up the config
file. Fixed some missing properties and variables that were reading from
the wrong properties. Modified the order in which mod_pocketDim
instantiated some of its static fields so that they would load after
properties are read. Almost all classes load after properties are read.
Fixed indentation across various files and replaced references to
properties in mod_pocketDim with references to DDProperties.
This commit is contained in:
SenseiKiwi
2013-06-13 19:01:54 -04:00
parent 9c3067ed35
commit b11354767d
36 changed files with 3517 additions and 3691 deletions

View File

@@ -1,4 +1,5 @@
package StevenDimDoors.mod_pocketDim;
import java.util.EnumSet;
import java.util.Random;
@@ -11,17 +12,19 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.relauncher.Side;
public class CommonTickHandler implements ITickHandler
{
Random rand= new Random();
private Random rand = new Random();
public int tickCount=0;
public int tickCount2=0;
private static DDProperties properties = null;
public CommonTickHandler()
{
if (properties == null)
properties = DDProperties.instance();
}
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
@@ -82,14 +85,14 @@ public class CommonTickHandler implements ITickHandler
int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))//makes sure the rift doesnt replace a door or something
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))//makes sure the rift doesn't replace a door or something
{
if(dimHelper.instance.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID)==null)
{
}
else
{
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID);
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
TileEntityRift.class.cast(dimHelper.getWorld(link.locDimID).getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord)).hasGrownRifts=true;
}
}
@@ -111,7 +114,7 @@ public class CommonTickHandler implements ITickHandler
if(tickCount2>10&&dimHelper.blocksToDecay!=null)
{
tickCount2=0;
if(!dimHelper.blocksToDecay.isEmpty()&&dimHelper.getWorld(mod_pocketDim.limboDimID)!=null)
if(!dimHelper.blocksToDecay.isEmpty()&&dimHelper.getWorld(properties.LimboDimensionID)!=null)
{
@@ -120,10 +123,10 @@ public class CommonTickHandler implements ITickHandler
int index = rand.nextInt(dimHelper.blocksToDecay.size());
Point3D point = (Point3D) dimHelper.blocksToDecay.get(index);
int blockID = dimHelper.getWorld(mod_pocketDim.limboDimID).getBlockId(point.getX(), point.getY(), point.getZ());
int blockID = dimHelper.getWorld(properties.LimboDimensionID).getBlockId(point.getX(), point.getY(), point.getZ());
int idToSet=Block.stone.blockID;
if(blockID==0||blockID==mod_pocketDim.blockLimboID)
if(blockID==0||blockID==properties.LimboBlockID)
{
dimHelper.blocksToDecay.remove(index);
}
@@ -146,10 +149,10 @@ public class CommonTickHandler implements ITickHandler
idToSet=Block.cobblestone.blockID;
}
if(blockID==Block.gravel.blockID&&!dimHelper.getWorld(mod_pocketDim.limboDimID).isAirBlock(point.getX(), point.getY()-1, point.getZ()))
if(blockID==Block.gravel.blockID&&!dimHelper.getWorld(properties.LimboDimensionID).isAirBlock(point.getX(), point.getY()-1, point.getZ()))
{
idToSet=mod_pocketDim.blockLimboID;
dimHelper.getWorld(mod_pocketDim.limboDimID).scheduleBlockUpdate(point.getX(), point.getY(), point.getZ(),10, idToSet);
idToSet=properties.LimboBlockID;
dimHelper.getWorld(properties.LimboDimensionID).scheduleBlockUpdate(point.getX(), point.getY(), point.getZ(),10, idToSet);
}
else if(blockID==Block.gravel.blockID)
@@ -162,7 +165,7 @@ public class CommonTickHandler implements ITickHandler
if(idToSet!=-1)
{
dimHelper.getWorld(mod_pocketDim.limboDimID).setBlock(point.getX(), point.getY(), point.getZ(), idToSet);
dimHelper.getWorld(properties.LimboDimensionID).setBlock(point.getX(), point.getY(), point.getZ(), idToSet);
}
}

View File

@@ -16,15 +16,19 @@ import cpw.mods.fml.common.network.Player;
public class ConnectionHandler implements IConnectionHandler
{
private static boolean connected = false;
private static DDProperties properties = null;
//sends a packet to clients containing all the information about the dims and links. Lots of packets, actually.
@Override
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
{
if (properties == null)
properties = DDProperties.instance();
Collection set = new ArrayList();
set.addAll(dimHelper.dimList.keySet());
PacketHandler.onClientJoinPacket(manager, dimHelper.dimList);
PacketHandler.onDimCreatedPacket(new DimData(mod_pocketDim.limboDimID, false, 0, 0, 0, 0, 0));
PacketHandler.onDimCreatedPacket(new DimData(properties.LimboDimensionID, false, 0, 0, 0, 0, 0));
return null;
}

View File

@@ -3,7 +3,6 @@ package StevenDimDoors.mod_pocketDim;
import java.io.File;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
public class DDProperties
{
@@ -11,214 +10,195 @@ public class DDProperties
* Block IDs
*/
public static Property UnstableDoorID;
public static Property DimensionalDoorID;
public static Property WarpDoorID;
public static Property TransTrapdoorID;
public static Property TransientDoorID;
public static Property FabricBlockID;
public static Property RiftBlockID;
public final int UnstableDoorID;
public final int DimensionalDoorID;
public final int WarpDoorID;
public final int TransTrapdoorID;
public final int TransientDoorID;
public final int FabricBlockID;
public final int RiftBlockID;
/**
* WorldGenBlockIDs
* World Generation Block IDs
*/
public static Property LimboBlockID;
public static Property PermaFabricBlockID;
public final int LimboBlockID;
public final int PermaFabricBlockID;
/**
* Item IDs
*/
public static Property RiftBladeItemID;
public static Property RiftSignatureItemID;
public static Property RiftRemoverItemID;
public static Property StableFabricItemID;
public static Property StabilizedRiftSignatureItemID;
public static Property DimensionalDoorItemID;
public static Property UnstableDoorItemID;
public static Property WarpDoorItemID;
public final int RiftBladeItemID;
public final int RiftSignatureItemID;
public final int RiftRemoverItemID;
public final int StableFabricItemID;
public final int StabilizedRiftSignatureItemID;
public final int DimensionalDoorItemID;
public final int UnstableDoorItemID;
public final int WarpDoorItemID;
/**
* Other IDs
*/
public static Property LimboBiomeID;
public static Property PocketBiomeID;
public static Property LimboDimensionID;
public static Property limboProviderID;
public static Property PocketProviderID;
public static Property DoorRenderEntityID;
public static Property MonolithEntityID;
public final int LimboBiomeID;
public final int PocketBiomeID;
public final int LimboDimensionID;
public final int LimboProviderID;
public final int PocketProviderID;
public final int DoorRenderEntityID;
public final int MonolithEntityID;
/**
* Crafting Flags
*/
public static Property CraftingDimensionaDoorAllowed;
public static Property CraftingWarpDoorAllowed;
public static Property CraftingRiftSignatureAllowed;
public static Property CraftingRiftRemoverAllowed;
public static Property CraftingUnstableDoorAllowed;
public static Property CraftingRiftBladeAllowed;
public static Property CraftingTransTrapdoorAllowed;
public static Property CraftingStabilizedRiftSignatureAllowed;
public final boolean CraftingDimensionaDoorAllowed;
public final boolean CraftingWarpDoorAllowed;
public final boolean CraftingRiftSignatureAllowed;
public final boolean CraftingRiftRemoverAllowed;
public final boolean CraftingUnstableDoorAllowed;
public final boolean CraftingRiftBladeAllowed;
public final boolean CraftingTransTrapdoorAllowed;
public final boolean CraftingStabilizedRiftSignatureAllowed;
public final boolean CraftingStableFabricAllowed;
/**
* Other Flags
*/
public static Property WorldRiftGenerationEnabled;
public static Property RiftSpreadEnabled;
public static Property RiftGriefingEnabled;
public static Property RiftsSpawnEndermenEnabled;
public static Property LimboEnabled;
public static Property LimboRespawningEnabled;
public static Property LimboReturnsInventoryEnabled;
public static Property DoorRenderingEnabled;
public static Property TNFREAKINGT_Enabled;
public final boolean WorldRiftGenerationEnabled;
public final boolean RiftSpreadEnabled;
public final boolean RiftGriefingEnabled;
public final boolean RiftsSpawnEndermenEnabled;
public final boolean LimboEnabled;
public final boolean HardcoreLimboEnabled;
public final boolean LimboReturnsInventoryEnabled;
public final boolean DoorRenderingEnabled;
public final boolean TNFREAKINGT_Enabled;
/**
* Other
*/
public static Property NonTntWeight;
public static Property RiftSpreadModifier;
public static Property LimboReturnRange;
public final int NonTntWeight;
public final int RiftSpreadModifier;
public final int LimboReturnRange;
public final String CustomSchematicDirectory;
public static void loadConfig(File configFile)
//Singleton instance
private static DDProperties instance = null;
//Path for custom dungeons within configuration directory
private final String CUSTOM_SCHEMATIC_SUBDIRECTORY = "/DimDoors_Custom_schematics";
//Names of categories
private final String CATEGORY_CRAFTING = "crafting";
private final String CATEGORY_ENTITY = "entity";
private final String CATEGORY_DIMENSION = "dimension";
private final String CATEGORY_PROVIDER = "provider";
private final String CATEGORY_BIOME = "biome";
private DDProperties(File configFile)
{
Configuration config = new Configuration(configFile);
//Load the configuration. This must be done in the constructor, even though I'd rather have a separate
//function, because "blank final" variables must be initialized within the constructor.
CustomSchematicDirectory = configFile.getParent() + CUSTOM_SCHEMATIC_SUBDIRECTORY;
Configuration config = new Configuration(configFile);
config.load();
CraftingDimensionaDoorAllowed = config.get("Crafting control", "bCraftDimDoor", true);
CraftingWarpDoorAllowed = config.get("Crafting control", "bCraftExitDoor", true);
CraftingUnstableDoorAllowed = config.get("Crafting control", "bCraftChaosDoor", true);
CraftingTransTrapdoorAllowed = config.get("Crafting control", "bCraftDimHatch", true);
CraftingRiftSignatureAllowed = config.get("Crafting control", "bCraftRiftSig", true);
CraftingRiftRemoverAllowed = config.get("Crafting control", "bCraftRiftRemover", true);
CraftingStabilizedRiftSignatureAllowed = config.get("Crafting control", "bCraftStabilizedRiftSig", true);
CraftingRiftBladeAllowed = config.get("Crafting control", "bCraftRiftBlade", true);
CraftingDimensionaDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Dimesional Door", true).getBoolean(true);
CraftingWarpDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Warp Door", true).getBoolean(true);
CraftingUnstableDoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crating Unstable Door", true).getBoolean(true);
CraftingTransTrapdoorAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Transdimensional Trapdoor", true).getBoolean(true);
CraftingRiftSignatureAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Rift Signature", true).getBoolean(true);
CraftingRiftRemoverAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Rift Remover", true).getBoolean(true);
CraftingStabilizedRiftSignatureAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Stabilized Rift Signature", true).getBoolean(true);
CraftingRiftBladeAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Rift Blade", true).getBoolean(true);
CraftingStableFabricAllowed = config.get(CATEGORY_CRAFTING, "Allow Crafting Stable Fabric", true).getBoolean(true);
LimboRespawningEnabled = config.get(Configuration.CATEGORY_GENERAL, "bHardcoreLimbo", false);
LimboRespawningEnabled.comment = "True causes the player to respawn in limbo if they die in limbo";
RiftGriefingEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Rift Griefing", true,
"Sets whether rifts destroy blocks around them or not").getBoolean(true);
RiftSpreadEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Rift Spread", true,
"Sets whether rifts create more rifts when they are near other rifts").getBoolean(true);
RiftsSpawnEndermenEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Endermen Spawning from Rifts", true,
"Sets whether groups of connected rifts will spawn Endermen").getBoolean(true);
TNFREAKINGT_Enabled = config.get("Configuration.CATEGORY_GENERAL", "EXPLOSIONS!!???!!!?!?!!", false);
LimboEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Limbo", true,
"Sets whether the Limbo dimension is activated").getBoolean(true);
LimboReturnsInventoryEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Limbo Returns Inventory", true,
"Sets whether players keep their inventories upon dying and respawning in Limbo").getBoolean(true);
HardcoreLimboEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Hardcore Limbo", false,
"Sets whether players that die in Limbo will respawn there").getBoolean(false);
LimboReturnRange = config.get(Configuration.CATEGORY_GENERAL, "Limbo Return Range", 500,
"Sets the farthest distance that Limbo can send you upon returning to the Overworld").getInt();
DoorRenderingEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Door Rendering", true).getBoolean(true);
RiftGriefingEnabled = config.get(Configuration.CATEGORY_GENERAL, "bRiftGreif", true);
RiftGriefingEnabled.comment = "toggles whether rifts eat blocks around them or not";
TNFREAKINGT_Enabled = config.get(Configuration.CATEGORY_GENERAL, "EXPLOSIONS!!???!!!?!?!!", false).getBoolean(false);
NonTntWeight = config.get(Configuration.CATEGORY_GENERAL, "HOWMUCHTNT", 25,
"Weighs the chance that a block will not be TNT. Must be greater than or equal to 0. " +
"EXPLOSIONS must be set to true for this to have any effect.").getInt();
DoorRenderingEnabled = config.get(Configuration.CATEGORY_GENERAL, "bEnableDoorRender", true);
DoorRenderEntityID=config.get(CATEGORY_ENTITY, "Door Render Entity ID", 89).getInt();
MonolithEntityID = config.get(CATEGORY_ENTITY, "Monolith Entity ID", 125).getInt();
LimboReturnsInventoryEnabled = config.get(Configuration.CATEGORY_GENERAL, "bLimboReturnInventory", true);
LimboReturnsInventoryEnabled.comment="Toggles whether or not your inventory is returned upon dying and respawning in limbo";
DimensionalDoorID = config.getBlock("Dimensional Door Block ID", 1970).getInt();
TransTrapdoorID = config.getBlock("Transdimensional Trapdoor Block ID", 1971).getInt();
FabricBlockID =config.getBlock("Fabric Of Reality Block ID", 1973).getInt();
WarpDoorID = config.getBlock("Warp Door Block ID", 1975).getInt();
RiftBlockID = config.getBlock("Rift Block ID", 1977).getInt();
UnstableDoorID = config.getBlock("Unstable Door Block ID", 1978).getInt();
TransientDoorID = config.getBlock("Transient Door Block ID", 1979).getInt();
NonTntWeight=config.get(Configuration.CATEGORY_GENERAL, "HOWMUCHTNT", 25);
NonTntWeight.comment="Chance that a block will not be TNT. must be greater than or equal to 0. Explosions!?!?? must be set to true, and you figure out what it does. ";
WarpDoorItemID = config.getItem("Warp Door Item ID", 5670).getInt();
RiftRemoverItemID = config.getItem("Rift Remover Item ID", 5671).getInt();
StableFabricItemID = config.getItem("Stable Fabric Item ID", 5672).getInt();
UnstableDoorItemID = config.getItem("Unstable Door Item ID", 5673).getInt();
DimensionalDoorItemID = config.getItem("Dimensional Door Item ID", 5674).getInt();
RiftSignatureItemID = config.getItem("Rift Signature Item ID", 5675).getInt();
RiftBladeItemID = config.getItem("Rift Blade Item ID", 5676).getInt();
StabilizedRiftSignatureItemID = config.getItem("Stabilized Rift Signature Item ID", 5677).getInt();
MonolithEntityID=config.get(Configuration.CATEGORY_GENERAL, "monolithID", 125);
LimboBlockID = config.getTerrainBlock("World Generation Block IDs - must be less than 256", "Limbo Block ID", 217,
"Blocks used for the terrain in Limbo").getInt();
PermaFabricBlockID = config.getTerrainBlock("World Generation Block IDs - must be less than 256",
"Perma Fabric Block ID", 220, "Blocks used for enclosing pocket dimensions").getInt();
DimensionalDoorID = config.getBlock("DimensionalDoorID", 1970);
WarpDoorID = config.getBlock("WarpDoorID", 1975);
UnstableDoorID = config.getBlock("UnstableDoorID", 1978);
TransTrapdoorID = config.getBlock("TransdimensionalTrapdoorID", 1971);
TransientDoorID = config.getBlock("TransientDoorID", 1979);
FabricBlockID =config.getBlock("FabricOfRealityBlockID", 1973);
RiftBlockID = config.getBlock("RiftBlockID", 1977);
LimboDimensionID = config.get(CATEGORY_DIMENSION, "Limbo Dimension ID", -23).getInt();
PocketProviderID = config.get(CATEGORY_PROVIDER, "Pocket Provider ID", 24).getInt();
LimboProviderID = config.get(CATEGORY_PROVIDER, "Limbo Provider ID", 13).getInt();
StabilizedRiftSignatureItemID=config.getItem("Stabilized Rift Signature", 5677);
RiftBladeItemID=config.getItem("Rift Blade", 5676);
UnstableDoorItemID=config.getItem("Chaos Door", 5673);
RiftRemoverItemID=config.getItem("Rift Remover", 5671);
StableFabricItemID=config.getItem("Stable Fabric", 5672);
WarpDoorItemID=config.getItem("Warp Door Item", 5673);
DimensionalDoorItemID=config.getItem("Dimensional Door Item", 5674);
RiftSignatureItemID=config.getItem("Rift Signature Item", 5675);
WorldRiftGenerationEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Rift World Generation", true,
"Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true);
LimboEnabled=config.get(Configuration.CATEGORY_GENERAL, "bLimboActive", true);
LimboBlockID=config.get("Worldgen Block IDs - must be less than 256", "blockLimbo", 217);
PermaFabricBlockID=config.get("Worldgen Block IDs - must be less than 256", "blockFabricPerm", 220);
LimboDimensionID=config.get(Configuration.CATEGORY_GENERAL, "limboDimID", -23);
DoorRenderEntityID=config.get(Configuration.CATEGORY_GENERAL, "doorRenderID", 89);
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", 24);
limboProviderID=config.get(Configuration.CATEGORY_GENERAL, "limboProvider ID", 13);
WorldRiftGenerationEnabled = config.get(Configuration.CATEGORY_GENERAL, "bWorldGenRifts", true);
WorldRiftGenerationEnabled.comment = "Toggles the natrual generation of dungeon rifts in other dimensions";
LimboEnabled = config.get(Configuration.CATEGORY_GENERAL, "bLimboActive", true);
LimboEnabled.comment="Toggles if dying in a pocket dim respawns the player in limbo";
RiftSpreadModifier = config.get(Configuration.CATEGORY_GENERAL, "riftSpreadModifier", 3);
RiftSpreadModifier.comment = "How many times a rift can spread- 0 prevents rifts from spreading at all. I dont recommend putting it highter than 5, because its rather exponential. ";
LimboBiomeID=config.get(Configuration.CATEGORY_GENERAL, "limboBiomeID", 251);
PocketBiomeID=config.get(Configuration.CATEGORY_GENERAL, "pocketBiomeID", 250);
RiftSpreadModifier = config.get(Configuration.CATEGORY_GENERAL, "Rift Spread Modifier", 3,
"Sets the number of times a rift can spread. 0 prevents rifts from spreading at all. " +
"A value greater than 5 is not recommended as the growth is exponential.").getInt();
LimboBiomeID = config.get(CATEGORY_BIOME, "Limbo Biome ID", 251).getInt();
PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 250).getInt();
config.save();
mod_pocketDim.blockDimWallID=FabricBlockID.getInt();
mod_pocketDim.blockDimWallPermID=PermaFabricBlockID.getInt();
mod_pocketDim.blockLimboID=LimboBlockID.getInt();
mod_pocketDim.blockRiftID=LimboBlockID.getInt();
mod_pocketDim.dimDoorID=DimensionalDoorID.getInt();
mod_pocketDim.chaosDoorID=UnstableDoorID.getInt();
mod_pocketDim.transientDoorID=TransientDoorID.getInt();
mod_pocketDim.dimHatchID=TransTrapdoorID.getInt();
mod_pocketDim.ExitDoorID=WarpDoorID.getInt();
mod_pocketDim.blockRiftID=RiftBlockID.getInt();
mod_pocketDim.DoorRenderID=DoorRenderEntityID.getInt();
mod_pocketDim.hardcoreLimbo=LimboRespawningEnabled.getBoolean(false);
mod_pocketDim.enableDimTrapDoor=CraftingTransTrapdoorAllowed.getBoolean(true);
mod_pocketDim.enableDoorOpenGL=DoorRenderingEnabled.getBoolean(true);
mod_pocketDim.enableIronDimDoor=CraftingDimensionaDoorAllowed.getBoolean(true);
mod_pocketDim.enableRiftBlade=CraftingRiftBladeAllowed.getBoolean(true);
mod_pocketDim.enableRiftRemover=CraftingRiftBladeAllowed.getBoolean(true);
mod_pocketDim.enableRiftSignature=CraftingRiftSignatureAllowed.getBoolean(true);
mod_pocketDim.enableUnstableDoor=CraftingUnstableDoorAllowed.getBoolean(true);
mod_pocketDim.enableWoodenDimDoor=CraftingWarpDoorAllowed.getBoolean(true);
mod_pocketDim.enableStabilizedRiftSignature=CraftingStabilizedRiftSignatureAllowed.getBoolean(true);
mod_pocketDim.itemChaosDoorID=UnstableDoorItemID.getInt();
mod_pocketDim.itemDimDoorID=DimensionalDoorItemID.getInt();
mod_pocketDim.itemExitDoorID=WarpDoorItemID.getInt();
mod_pocketDim.itemLinkSignatureID=RiftSignatureItemID.getInt();
mod_pocketDim.itemRiftBladeID=RiftBladeItemID.getInt();
mod_pocketDim.itemRiftRemoverID=RiftRemoverItemID.getInt();
mod_pocketDim.itemStabilizedLinkSignatureID=StabilizedRiftSignatureItemID.getInt();
mod_pocketDim.itemStableFabricID=StableFabricItemID.getInt();
mod_pocketDim.obeliskID=MonolithEntityID.getInt();
mod_pocketDim.limboBiomeID=LimboBiomeID.getInt();
mod_pocketDim.pocketBiomeID=PocketBiomeID.getInt();
mod_pocketDim.providerID=PocketProviderID.getInt();
mod_pocketDim.limboProviderID=limboProviderID.getInt();
mod_pocketDim.limboExitRange=LimboReturnRange.getInt();
mod_pocketDim.TNFREAKINGT=TNFREAKINGT_Enabled.getBoolean(false);
mod_pocketDim.riftsInWorldGen=WorldRiftGenerationEnabled.getBoolean(true);
mod_pocketDim.riftSpreadFactor=RiftSpreadModifier.getInt();
mod_pocketDim.returnInventory=LimboReturnsInventoryEnabled.getBoolean(true);
mod_pocketDim.HOW_MUCH_TNT=NonTntWeight.getInt() + 1; //workaround so the generator code doesn't have to be changed
mod_pocketDim.limboDimID = LimboDimensionID.getInt();
mod_pocketDim.isLimboActive= LimboEnabled.getBoolean(true);
}
public static DDProperties create(File configFile)
{
if (instance == null)
instance = new DDProperties(configFile);
else
throw new IllegalStateException("Cannot create DDProperties twice");
return instance;
}
public static DDProperties instance()
{
if (instance == null)
{
//This is to prevent some frustrating bugs that could arise when classes
//are loaded in the wrong order. Trust me, I had to squash a few...
throw new IllegalStateException("Instance of DDProperties requested before properties have been loaded");
}
return instance;
}
}

View File

@@ -33,6 +33,8 @@ public class DimData implements Serializable
static final long serialVersionUID = 454342L;
private static DDProperties properties = null;
public DimData(int dimID, boolean isPocket, int depth, LinkData exitLinkData)
{
this.dimID=dimID;
@@ -41,16 +43,13 @@ public class DimData implements Serializable
this.exitDimLink= exitLinkData;
if (properties == null)
properties = DDProperties.instance();
}
public DimData(int dimID, boolean isPocket, int depth, int exitLinkDimID, int exitX, int exitY, int exitZ)
{
this.dimID=dimID;
this.depth=depth;
this.isPocket=isPocket;
this.exitDimLink= new LinkData(exitLinkDimID, exitX, exitY, exitZ);
this(dimID, isPocket, depth, new LinkData(exitLinkDimID, exitX, exitY, exitZ));
}
public LinkData findNearestRift(World world, int range, int x, int y, int z)
@@ -67,7 +66,7 @@ public class DimData implements Serializable
{
while (k<range)
{
if(world.getBlockId(x+i, y+j, z+k)==mod_pocketDim.blockRiftID&&MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance)
if(world.getBlockId(x+i, y+j, z+k)==properties.RiftBlockID&&MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance)
{
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0)
{
@@ -106,7 +105,7 @@ public class DimData implements Serializable
{
while (k<range)
{
if(world.getBlockId(x+i, y+j, z+k)==mod_pocketDim.blockRiftID)
if(world.getBlockId(x+i, y+j, z+k)==properties.RiftBlockID)
{
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0)
{
@@ -187,7 +186,7 @@ public class DimData implements Serializable
public boolean isLimbo()
{
if(this.dimID==mod_pocketDim.limboDimID)
if(this.dimID==properties.LimboDimensionID)
{
return true;

View File

@@ -1,4 +1,5 @@
package StevenDimDoors.mod_pocketDim;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
@@ -32,9 +33,17 @@ import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.WorldEvent;
public class EventHookContainer
{
Random rand= new Random();
private static Random rand = new Random();
private static DDProperties properties = null;
public EventHookContainer()
{
if (properties == null)
properties = DDProperties.instance();
}
@SideOnly(Side.CLIENT)
@@ -46,14 +55,8 @@ public class EventHookContainer
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/monk.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/monk.ogg")));
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/crack.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/crack.ogg")));
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/tearing.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/tearing.ogg")));
}
@ForgeSubscribe
public void onWorldLoad(WorldEvent.Load event)
{
@@ -87,7 +90,7 @@ public class EventHookContainer
int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))
{
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID);
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
}
@@ -120,7 +123,7 @@ public class EventHookContainer
public void onPlayerFall(LivingFallEvent event)
{
event.setCanceled(event.entity.worldObj.provider.dimensionId==mod_pocketDim.limboDimID);
event.setCanceled(event.entity.worldObj.provider.dimensionId==properties.LimboDimensionID);
}
@@ -132,7 +135,7 @@ public class EventHookContainer
/**
if(event.entityPlayer.worldObj.provider.dimensionId==mod_pocketDim.limboDimID&&event.action==PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
if(event.entityPlayer.worldObj.provider.dimensionId==properties.LimboDimensionID&&event.action==PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
{

View File

@@ -32,11 +32,8 @@ public class PacketHandler implements IPacketHandler
public static int removeLinkPacketID = 5;
public static int linkKeyPacketID = 7;
public static int dimPacketID = 6;
public static int dimUpdatePacketID = 1;
private static DDProperties properties = null;
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
@@ -45,7 +42,6 @@ public class PacketHandler implements IPacketHandler
if (packet.channel.equals("DimDoorPackets"))
{
handleRandom(packet,player);
}
@@ -78,7 +74,10 @@ public class PacketHandler implements IPacketHandler
}
if(dimDataToAdd.isPocket)
{
dimHelper.registerDimension(dimId, mod_pocketDim.providerID);
if (properties == null)
properties = DDProperties.instance();
dimHelper.registerDimension(dimId, properties.PocketProviderID);
//System.out.println("regsitered dim ID" + dimId);
}

View File

@@ -12,7 +12,13 @@ import cpw.mods.fml.common.IPlayerTracker;
public class PlayerRespawnTracker implements IPlayerTracker
{
public PlayerRespawnTracker()
{
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
@Override
public void onPlayerLogin(EntityPlayer player) {
@@ -35,10 +41,10 @@ public class PlayerRespawnTracker implements IPlayerTracker
@Override
public void onPlayerRespawn(EntityPlayer player)
{
if(player.worldObj.provider.dimensionId==mod_pocketDim.limboDimID)
if(player.worldObj.provider.dimensionId==properties.LimboDimensionID)
{
if(!player.worldObj.isRemote&&mod_pocketDim.returnInventory)
if(!player.worldObj.isRemote && properties.LimboReturnsInventoryEnabled)
{
if(player.username!=null)

View File

@@ -23,17 +23,23 @@ public class RiftGenerator implements IWorldGenerator
Random rand = new Random();
boolean shouldGenHere=true;
LinkData link;
DimData dimData;
private static DDProperties properties = null;
public RiftGenerator()
{
if (properties == null)
properties = DDProperties.instance();
}
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
//Long ntime = System.nanoTime();
shouldGenHere=true;
if(world.provider.getDimensionName()=="PocketDim"||!mod_pocketDim.riftsInWorldGen ||world.isRemote)
if (world.provider.getDimensionName()=="PocketDim"|| !properties.WorldRiftGenerationEnabled || world.isRemote)
{
this.shouldGenHere=false;
@@ -144,13 +150,13 @@ public class RiftGenerator implements IWorldGenerator
}
if(random.nextInt(250)==0&&world.provider.getDimensionName()!="PocketDim"&&!world.isRemote&&mod_pocketDim.riftsInWorldGen)
if(random.nextInt(250)==0&&world.provider.getDimensionName()!="PocketDim"&&!world.isRemote && properties.WorldRiftGenerationEnabled)
{
// System.out.println("tryingToGen");
int blockID=Block.stoneBrick.blockID;
if(world.provider.dimensionId==mod_pocketDim.limboDimID)
if(world.provider.dimensionId==properties.LimboDimensionID)
{
blockID= mod_pocketDim.blockLimboID;
blockID= properties.LimboBlockID;
}
i=chunkX*16-random.nextInt(16);
k=chunkZ*16-random.nextInt(16);

View File

@@ -62,18 +62,12 @@ public class SchematicLoader
public int cZ;
public int cY;
public boolean didRead = false;
public String schematic;
public SchematicLoader()
{
}
private DDProperties properties = DDProperties.instance();
public SchematicLoader() { }
public void init(LinkData link)
{
@@ -944,12 +938,12 @@ public class SchematicLoader
if(blockToReplace==Block.doorIron.blockID)
{
setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,mod_pocketDim.dimDoorID, transMeta );
setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,properties.DimensionalDoorID, transMeta );
}
else
if(blockToReplace==Block.doorWood.blockID)
{
setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,mod_pocketDim.ExitDoorID, transMeta );
setBlockDirectly(world,i+xCooe,j+yCooe,k+zCooe,properties.WarpDoorID, transMeta );
}
else
{
@@ -1029,7 +1023,7 @@ public class SchematicLoader
for(Point3D point : this.sideLinks)
{
if(world.getBlockId(point.getX(), point.getY(), point.getZ())==mod_pocketDim.dimDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==mod_pocketDim.dimDoorID)
if(world.getBlockId(point.getX(), point.getY(), point.getZ())==properties.DimensionalDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==properties.DimensionalDoorID)
{
int depth = dimHelper.instance.getDimDepth(link.locDimID);
@@ -1080,14 +1074,14 @@ public class SchematicLoader
try
{
if(world.getBlockId(point.getX(), point.getY(), point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-2, point.getZ())==Block.sandStone.blockID)
if(world.getBlockId(point.getX(), point.getY(), point.getZ())==properties.WarpDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==properties.WarpDoorID&&world.getBlockId(point.getX(), point.getY()-2, point.getZ())==Block.sandStone.blockID)
{
LinkData randomLink=dimHelper.instance.getRandomLinkData(false);
LinkData sideLink = new LinkData(link.destDimID,dimHelper.dimList.get(link.locDimID).exitDimLink.destDimID,point.getX(), point.getY(), point.getZ(),point.getX(), 0, point.getZ(),true,world.getBlockMetadata(point.getX(), point.getY()-1, point.getZ()));
if(sideLink.destDimID==mod_pocketDim.limboDimID)
if(sideLink.destDimID==properties.LimboDimensionID)
{
sideLink.destDimID=0;
}
@@ -1110,7 +1104,7 @@ public class SchematicLoader
dimHelper.instance.createLink(sideLink);
dimHelper.instance.createLink(sideLink.destDimID , sideLink.locDimID, sideLink.destXCoord, sideLink.destYCoord, sideLink.destZCoord, sideLink.locXCoord, sideLink.locYCoord, sideLink.locZCoord, dimHelper.instance.flipDoorMetadata(sideLink.linkOrientation));
if(world.getBlockId(point.getX(), point.getY()-3, point.getZ())==mod_pocketDim.blockDimWallID)
if(world.getBlockId(point.getX(), point.getY()-3, point.getZ()) == properties.FabricBlockID)
{
setBlockDirectly(world,point.getX(), point.getY()-2, point.getZ(),Block.stoneBrick.blockID,0);
@@ -1121,7 +1115,7 @@ public class SchematicLoader
}
}
else if ((world.getBlockId(point.getX(), point.getY(), point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==mod_pocketDim.ExitDoorID&&world.getBlockId(point.getX(), point.getY()-2, point.getZ())!=Block.sandStone.blockID))
else if ((world.getBlockId(point.getX(), point.getY(), point.getZ()) == properties.WarpDoorID&&world.getBlockId(point.getX(), point.getY()-1, point.getZ())==properties.WarpDoorID&&world.getBlockId(point.getX(), point.getY()-2, point.getZ())!=Block.sandStone.blockID))
{
this.incomingLink = point;
}
@@ -1168,7 +1162,6 @@ public class SchematicLoader
this.cY=y >>4;
int chunkX=(x % 16)< 0 ? ((x) % 16)+16 : ((x) % 16);
int chunkY=y;
int chunkZ=((z) % 16)< 0 ? ((z) % 16)+16 : ((z) % 16);
@@ -1189,8 +1182,5 @@ public class SchematicLoader
{
e.printStackTrace();
}
}
}

View File

@@ -33,9 +33,12 @@ public class TransientDoor extends ExitDoor
super(par1, Material.grass);
// this.blockIndexInTexture = 18;
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_top");
@@ -90,7 +93,7 @@ public class TransientDoor extends ExitDoor
{
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
par1World.setBlock(par2, par3-1, par4, 0);
par1World.setBlock(par2, par3, par4, mod_pocketDim.blockRiftID);
par1World.setBlock(par2, par3, par4, properties.RiftBlockID);
}
}
@@ -104,7 +107,7 @@ public class TransientDoor extends ExitDoor
{
dimHelper.instance.teleportToPocket(par1World, linkData, par5Entity);
par1World.setBlock(par2, par3, par4, 0);
par1World.setBlock(par2, par3+1, par4, mod_pocketDim.blockRiftID);
par1World.setBlock(par2, par3+1, par4, properties.RiftBlockID);
}
}

View File

@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
@@ -16,30 +17,27 @@ import net.minecraft.world.World;
public class BlockDimWallPerm extends Block
{
private static DDProperties properties = null;
public BlockDimWallPerm(int i, int j, Material par2Material)
{
super(i, Material.ground);
setTickRandomly(true);
// this.setCreativeTab(CreativeTabs.tabBlock);
if (properties == null)
properties = DDProperties.instance();
}
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2().replace("perm", ""));
}
public int quantityDropped(Random par1Random)
{
return 0;
}
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
/**
@@ -47,7 +45,7 @@ public class BlockDimWallPerm extends Block
*/
public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if(!par1World.isRemote&&par1World.provider.dimensionId==mod_pocketDim.limboDimID)
if(!par1World.isRemote&&par1World.provider.dimensionId==properties.LimboDimensionID)
{
Random rand = new Random();
@@ -68,14 +66,13 @@ public class BlockDimWallPerm extends Block
{
int x = (link.destXCoord + rand.nextInt(mod_pocketDim.limboExitRange)-mod_pocketDim.limboExitRange/2);
int z = (link.destZCoord + rand.nextInt(mod_pocketDim.limboExitRange)-mod_pocketDim.limboExitRange/2);
int x = (link.destXCoord + rand.nextInt(properties.LimboReturnRange)-properties.LimboReturnRange/2);
int z = (link.destZCoord + rand.nextInt(properties.LimboReturnRange)-properties.LimboReturnRange/2);
x=x+(x>> 4); //make sure I am in the middle of a chunk, andnot on a boundry, so it doesnt load the chunk next to me
//make sure I am in the middle of a chunk, and not on a boundary, so it doesn't load the chunk next to me
x = x + (x >> 4);
z = z + (z >> 4);
int y = yCoordHelper.getFirstUncovered(0, x, 63, z);
//this complicated chunk teleports the player back to the overworld at some random location. Looks funky becaue it has to load the chunk
@@ -103,12 +100,12 @@ public class BlockDimWallPerm extends Block
if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+2)
{
dimHelper.getWorld(0).setBlock(i+xc, j-1+yc, k+zc, mod_pocketDim.blockLimboID);
dimHelper.getWorld(0).setBlock(i+xc, j-1+yc, k+zc, properties.LimboBlockID);
}
else if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+3)
{
dimHelper.getWorld(0).setBlock(i+xc, j-1+yc, k+zc, mod_pocketDim.blockLimboID,2,0);
dimHelper.getWorld(0).setBlock(i+xc, j-1+yc, k+zc, properties.LimboBlockID,2,0);
}
}

View File

@@ -11,6 +11,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.PacketHandler;
import StevenDimDoors.mod_pocketDim.TileEntityRift;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -24,6 +25,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockRift extends BlockContainer
{
private static DDProperties properties = null;
public BlockRift(int i, int j, Material par2Material)
{
@@ -31,16 +33,15 @@ public class BlockRift extends BlockContainer
setTickRandomly(true);
// this.setCreativeTab(CreativeTabs.tabBlock);
this.setLightOpacity(14);
if (properties == null)
properties = DDProperties.instance();
}
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
}
//sends a packet informing the client that there is a link present so it renders properly. (when placed)
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
@@ -118,7 +119,7 @@ public class BlockRift extends BlockContainer
//function that regulates how many blocks it eats/ how fast it eates them.
public void updateTick(World world, int x, int y, int z, Random random)
{
if(!world.isRemote&&dimHelper.instance.getLinkDataFromCoords(x, y, z, world.provider.dimensionId)!=null&&mod_pocketDim.enableRiftGrief)
if(!world.isRemote&&dimHelper.instance.getLinkDataFromCoords(x, y, z, world.provider.dimensionId)!=null && properties.RiftGriefingEnabled)
{
TileEntityRift rift = (TileEntityRift) world.getBlockTileEntity(x, y, z);
if(rift.isNearRift)

View File

@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
@@ -28,12 +29,13 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ChaosDoor extends dimDoor
{
private Icon blockIconBottom;
private static DDProperties properties = null;
public ChaosDoor(int par1, Material material)
{
super(par1, Material.iron);
// this.blockIndexInTexture = 18;
if (properties == null)
properties = DDProperties.instance();
}
public void registerIcons(IconRegister par1IconRegister)
@@ -74,7 +76,7 @@ public class ChaosDoor extends dimDoor
if(newDim)
{
LinkData link = new LinkData(par1World.provider.dimensionId, mod_pocketDim.limboDimID, par2, par3, par4, par2, par3+500, par4, false,0);
LinkData link = new LinkData(par1World.provider.dimensionId, properties.LimboDimensionID, par2, par3, par4, par2, par3+500, par4, false,0);
link.linkOrientation= par1World.getBlockMetadata(par2, par3-1, par4);
dimHelper.instance.createLink(link);
// System.out.println(link.linkOrientation);
@@ -101,9 +103,8 @@ public class ChaosDoor extends dimDoor
int var12 = (int) (MathHelper.floor_double((double)((par5Entity.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3);
int num = par1World.getBlockMetadata(par2, par3-1, par4);
if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==mod_pocketDim.chaosDoorID)
if(!par1World.isRemote&&(num==5||num==4||num==6||num==7)&&(num-4)==var12&&par1World.getBlockId(par2, par3-1, par4)==properties.UnstableDoorID)
{
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
boolean foundRandomDest=false;
@@ -122,7 +123,7 @@ public class ChaosDoor extends dimDoor
if(link!=null)
{
if(!link.isLocPocket&&link.linkOrientation!=-10&&link.destDimID!=mod_pocketDim.limboDimID)
if(!link.isLocPocket&&link.linkOrientation!=-10&&link.destDimID!=properties.LimboDimensionID)
{
foundRandomDest=true;
@@ -132,7 +133,7 @@ public class ChaosDoor extends dimDoor
{
if(dimHelper.getWorld(link.locDimID).isAirBlock(link.locXCoord,link.locYCoord,link.locZCoord))
{
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord,link.locYCoord,link.locZCoord, mod_pocketDim.blockRiftID);
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord,link.locYCoord,link.locZCoord, properties.RiftBlockID);
}
}
}

View File

@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -34,9 +35,11 @@ public class dimDoor extends BlockContainer
super(par1, Material.iron);
// this.blockIndexInTexture = 18;
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
public void registerIcons(IconRegister par1IconRegister)
@@ -56,19 +59,19 @@ public class dimDoor extends BlockContainer
if(dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World)!=null)
{
LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World);
par1World.setBlock(par2, par3, par4, mod_pocketDim.blockRiftID);
par1World.setBlock(par2, par3, par4, properties.RiftBlockID);
}
if(dimHelper.instance.getLinkDataFromCoords(par2, par3-1, par4, par1World)!=null)
{
LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3-1, par4, par1World);
par1World.setBlock(par2, par3-1, par4, mod_pocketDim.blockRiftID);
par1World.setBlock(par2, par3-1, par4, properties.RiftBlockID);
}
if(dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World)!=null)
{
LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World);
par1World.setBlock(par2, par3+1, par4, mod_pocketDim.blockRiftID);
par1World.setBlock(par2, par3+1, par4, properties.RiftBlockID);
}
@@ -546,7 +549,7 @@ public class dimDoor extends BlockContainer
{
if (!par1World.isRemote)
{
this.dropBlockAsItem(par1World, par2, par3, par4, mod_pocketDim.dimDoorID, 0);
this.dropBlockAsItem(par1World, par2, par3, par4, properties.DimensionalDoorID, 0);
}
}
else

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import cpw.mods.fml.common.FMLCommonHandler;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.DimData;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -14,14 +15,19 @@ import net.minecraft.world.World;
public class CommandDeleteRifts extends CommandBase
{
public CommandDeleteRifts()
{
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
public String getCommandName()//the name of our command
{
return "dimdoors-cleanupRifts";
}
@Override
public void processCommand(ICommandSender var1, String[] var2)
@@ -79,7 +85,7 @@ public class CommandDeleteRifts extends CommandBase
}
targetWorld = dimHelper.getWorld(targetDim);
if(targetWorld.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord)==mod_pocketDim.blockRiftID)
if(targetWorld.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord)==properties.RiftBlockID)
{
dim.removeLinkAtCoords(link);

View File

@@ -1,5 +1,6 @@
package StevenDimDoors.mod_pocketDim.commands;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.DungeonGenerator;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
@@ -10,14 +11,19 @@ import net.minecraft.entity.player.EntityPlayer;
public class CommandEndDungeonCreation extends CommandBase
{
private static DDProperties properties = null;
public CommandEndDungeonCreation()
{
if (properties == null)
properties = DDProperties.instance();
}
public String getCommandName()//the name of our command
{
return "dimdoors-endDungeonCreation";
}
@Override
public void processCommand(ICommandSender var1, String[] var2)
@@ -53,8 +59,8 @@ public class CommandEndDungeonCreation extends CommandBase
}
else if(!player.worldObj.isRemote)
{
DungeonGenerator newDungeon = mod_pocketDim.dungeonHelper.exportDungeon(player.worldObj, x, y, z, mod_pocketDim.schematicContainer+"/"+var2[0]+".schematic");
player.sendChatToPlayer("created dungeon schematic in " +mod_pocketDim.schematicContainer+"/"+var2[0]+".schematic");
DungeonGenerator newDungeon = mod_pocketDim.dungeonHelper.exportDungeon(player.worldObj, x, y, z, properties.CustomSchematicDirectory + "/" + var2[0] + ".schematic");
player.sendChatToPlayer("created dungeon schematic in " + properties.CustomSchematicDirectory +"/"+var2[0]+".schematic");
mod_pocketDim.dungeonHelper.customDungeons.add(newDungeon);
if(mod_pocketDim.dungeonHelper.customDungeonStatus.containsKey(player.worldObj.provider.dimensionId)&&!player.worldObj.isRemote)

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import cpw.mods.fml.common.FMLCommonHandler;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.DimData;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -18,6 +19,14 @@ import net.minecraft.world.World;
public class CommandStartDungeonCreation extends CommandBase
{
public CommandStartDungeonCreation()
{
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
public String getCommandName()//the name of our command
{
return "dimdoors-startDungeonCreation";
@@ -40,7 +49,7 @@ public class CommandStartDungeonCreation extends CommandBase
link = dimHelper.instance.createPocket(link,true, false);
itemDimDoor.placeDoorBlock(player.worldObj, x, y, z, 3, Block.blocksList[mod_pocketDim.ExitDoorID]);
itemDimDoor.placeDoorBlock(player.worldObj, x, y, z, 3, Block.blocksList[properties.WarpDoorID]);
// dimHelper.instance.teleportToPocket(player.worldObj, link, player);

View File

@@ -13,6 +13,7 @@ import net.minecraft.block.BlockContainer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.DungeonGenerator;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -37,9 +38,12 @@ public class DungeonHelper
public DungeonHelper()
{
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
private Random rand = new Random();
public HashMap<Integer, LinkData> customDungeonStatus = new HashMap<Integer, LinkData>();
@@ -361,27 +365,27 @@ public class DungeonHelper
for(int count=0;count<50;count++)
{
if(world.getBlockId(xMin, yI, zI)!=mod_pocketDim.blockDimWallPermID)
if(world.getBlockId(xMin, yI, zI)!=properties.PermaFabricBlockID)
{
xMin--;
}
if(world.getBlockId(xI, yMin, zI)!=mod_pocketDim.blockDimWallPermID)
if(world.getBlockId(xI, yMin, zI)!=properties.PermaFabricBlockID)
{
yMin--;
}
if(world.getBlockId(xI, yI, zMin)!=mod_pocketDim.blockDimWallPermID)
if(world.getBlockId(xI, yI, zMin)!=properties.PermaFabricBlockID)
{
zMin--;
}
if(world.getBlockId(xMax, yI, zI)!=mod_pocketDim.blockDimWallPermID)
if(world.getBlockId(xMax, yI, zI)!=properties.PermaFabricBlockID)
{
xMax++;
}
if(world.getBlockId(xI, yMax, zI)!=mod_pocketDim.blockDimWallPermID)
if(world.getBlockId(xI, yMax, zI)!=properties.PermaFabricBlockID)
{
yMax++;
}
if(world.getBlockId(xI, yI, zMax)!=mod_pocketDim.blockDimWallPermID)
if(world.getBlockId(xI, yI, zMax)!=properties.PermaFabricBlockID)
{
zMax++;
}
@@ -409,11 +413,11 @@ public class DungeonHelper
int blockID = world.getBlockId(x+xMin, y+yMin, z+zMin);
int meta= world.getBlockMetadata(x+xMin, y+yMin, z+zMin);
if(blockID==mod_pocketDim.dimDoorID)
if(blockID==properties.DimensionalDoorID)
{
blockID=Block.doorIron.blockID;
}
if(blockID==mod_pocketDim.ExitDoorID)
if(blockID==properties.WarpDoorID)
{
blockID=Block.doorWood.blockID;

View File

@@ -10,12 +10,30 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet41EntityEffect;
import net.minecraft.network.packet.Packet43Experience;
import net.minecraft.network.packet.Packet9Respawn;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.common.DimensionManager;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.DimData;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.ObjectSaveInputStream;
@@ -24,32 +42,7 @@ import StevenDimDoors.mod_pocketDim.TileEntityRift;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
import StevenDimDoors.mod_pocketDim.world.pocketProvider;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet10Flying;
import net.minecraft.network.packet.Packet39AttachEntity;
import net.minecraft.network.packet.Packet41EntityEffect;
import net.minecraft.network.packet.Packet43Experience;
import net.minecraft.network.packet.Packet9Respawn;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.Teleporter;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -80,20 +73,20 @@ public class dimHelper extends DimensionManager
public static dimHelper instance = new dimHelper();
/**
* HashMap for temporary storage of Link Singnature damage hash values. See itemLinkSignature for more details
* HashMap for temporary storage of Link Signature damage hash values. See itemLinkSignature for more details
* @Return
*/
public HashMap<Integer, LinkData> interDimLinkList= new HashMap<Integer,LinkData>();
/**
* ArrayList containing all link data not sorted for easy random access, used for random doors and for recreating rifts if they have a block placed over them.
* See the common tick manager and the Chaos door for details on useage
* See the common tick manager and the Chaos door for details on usage
* @Return
*/
//public ArrayList<LinkData> linksForRendering =new ArrayList<LinkData>();
Random rand= new Random();
//Stupid function I use because I dont understand bitwise operations yet. Used in door orientation
//Stupid function I use because I don't understand bitwise operations yet. Used in door orientation
//TODO get rid of this
public int flipDoorMetadata(int data)
{
@@ -113,9 +106,6 @@ public class dimHelper extends DimensionManager
{
return 1;
}
if(data==4)
{
return 6;
@@ -160,16 +150,8 @@ public class dimHelper extends DimensionManager
{
entity.mountEntity(null);
cart = teleportEntity(oldWorld, cart, link);
}
WorldServer newWorld;
if(this.getWorld(link.destDimID)==null)
@@ -297,15 +279,10 @@ public class dimHelper extends DimensionManager
}
mod_pocketDim.teleporter.placeInPortal(entity, newWorld, link);
return entity;
}
/**
* Primary function used to teleport the player using doors. Performes numerous null checks, and also generates the destination door/pocket if it has not done so already.
* Primary function used to teleport the player using doors. Performs numerous null checks, and also generates the destination door/pocket if it has not done so already.
* Also ensures correct orientation relative to the door using the pocketTeleporter.
* @param world- world the player is currently in
* @param linkData- the link the player is using to teleport, sends the player to its dest information.
@@ -315,25 +292,20 @@ public class dimHelper extends DimensionManager
*/
public void teleportToPocket(World world,LinkData linkData, Entity entity)
{
DDProperties properties = DDProperties.instance();
if (world.isRemote)
{
return;
}
if (linkData != null)
{
int destinationID=linkData.destDimID;
int x=linkData.destXCoord;
int y=linkData.destYCoord;
int z=linkData.destZCoord;
int depth= this.getDimDepth(world.provider.dimensionId);
if(this.dimList.containsKey(destinationID) && this.dimList.containsKey(world.provider.dimensionId))
@@ -384,14 +356,14 @@ public class dimHelper extends DimensionManager
}
if(count==19)
{
entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, mod_pocketDim.blockDimWallID);
entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, properties.FabricBlockID);
}
}
}
if(entity.worldObj.getBlockId(playerXCoord, playerYCoord-1,playerZCoord )==Block.lavaStill.blockID)
{
entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, mod_pocketDim.blockDimWallID);
entity.worldObj.setBlock(playerXCoord, playerYCoord-1, playerZCoord, properties.FabricBlockID);
}
this.generateDoor(world,linkData);
@@ -470,20 +442,14 @@ public class dimHelper extends DimensionManager
*/
public LinkData createLink( int locationDimID, int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord,int linkOrientation)
{
LinkData linkData =new LinkData( locationDimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord ,destinationZCoord,false,linkOrientation);
return this.createLink(linkData);
}
public LinkData createLink(LinkData link)
{
DDProperties properties = DDProperties.instance();
if(!this.dimList.containsKey(link.locDimID))
{
@@ -514,7 +480,7 @@ public class dimHelper extends DimensionManager
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))
{
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID);
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
}
@@ -620,6 +586,8 @@ public class dimHelper extends DimensionManager
int destY = incLink.destYCoord;
int destZ = incLink.destZCoord;
DDProperties properties = DDProperties.instance();
if(!incLink.hasGennedDoor)
{
@@ -629,7 +597,7 @@ public class dimHelper extends DimensionManager
DimData data = this.dimList.get(destinationID);
int id =world.getBlockId(locX, locY, locZ);
if(id==mod_pocketDim.ExitDoorID||id==mod_pocketDim.dimDoorID||id==mod_pocketDim.transientDoorID)
if(id==properties.WarpDoorID||id==properties.DimensionalDoorID||id==properties.TransientDoorID)
{
int doorTypeToPlace=id;
@@ -653,7 +621,7 @@ public class dimHelper extends DimensionManager
int blockToReplace= this.getWorld(destinationID).getBlockId(destX, destY, destZ);
if(blockToReplace!=mod_pocketDim.dimDoorID&&blockToReplace!=mod_pocketDim.ExitDoorID&&blockToReplace!=mod_pocketDim.transientDoorID)
if(blockToReplace!=properties.DimensionalDoorID&&blockToReplace!=properties.WarpDoorID&&blockToReplace != properties.TransientDoorID)
{
this.getWorld(destinationID).setBlock(destX, destY-1, destZ, doorTypeToPlace,destOrientation,2);
this.getWorld(destinationID).setBlock(destX, destY, destZ, doorTypeToPlace,8,2);
@@ -683,6 +651,8 @@ public class dimHelper extends DimensionManager
*/
public void generatePocket(LinkData incomingLink)
{
DDProperties properties = DDProperties.instance();
try
{
@@ -764,15 +734,15 @@ public class dimHelper extends DimensionManager
{
if(Math.abs(xCount)>=19||Math.abs(yCount)>=19||Math.abs(zCount)>=19)
{
this.setBlockDirectly(this.getWorld(incomingLink.destDimID), x+xCount, y+yCount, z+zCount,mod_pocketDim.blockDimWallPermID,0);
this.setBlockDirectly(this.getWorld(incomingLink.destDimID), x+xCount, y+yCount, z+zCount,properties.PermaFabricBlockID,0);
}
else
{
this.setBlockDirectly(this.getWorld(incomingLink.destDimID), x+xCount, y+yCount, z+zCount,mod_pocketDim.blockDimWallID,0);
if(mod_pocketDim.TNFREAKINGT)
this.setBlockDirectly(this.getWorld(incomingLink.destDimID), x+xCount, y+yCount, z+zCount,properties.FabricBlockID,0);
if(properties.TNFREAKINGT_Enabled)
{
if((Math.abs(xCount)>=16||Math.abs(yCount)>=16||Math.abs(zCount)>=16)&&rand.nextInt(mod_pocketDim.HOW_MUCH_TNT)==1)
if((Math.abs(xCount)>=16||Math.abs(yCount)>=16||Math.abs(zCount)>=16) && rand.nextInt(properties.NonTntWeight + 1) == 0)
{
this.getWorld(incomingLink.destDimID).setBlock( x+xCount, y+yCount, z+zCount,Block.tnt.blockID);
}
@@ -807,6 +777,8 @@ public class dimHelper extends DimensionManager
*/
public void initPockets()
{
DDProperties properties = DDProperties.instance();
mod_pocketDim.hasInitDims=true;
this.load();
if(!this.dimList.isEmpty())
@@ -826,7 +798,7 @@ public class dimHelper extends DimensionManager
try
{
this.getNextFreeDimId();
registerDimension(dimData.dimID,mod_pocketDim.providerID);
registerDimension(dimData.dimID,properties.PocketProviderID);
}
catch (Exception e)
{
@@ -911,9 +883,11 @@ public class dimHelper extends DimensionManager
*/
public LinkData createPocket(LinkData link , boolean isGoingDown, boolean isRandomRift)
{
if(this.getWorld(link.locDimID)==null)
DDProperties properties = DDProperties.instance();
if (dimHelper.getWorld(link.locDimID) == null)
{
this.initDimension(link.locDimID);
dimHelper.initDimension(link.locDimID);
}
int dimensionID;
@@ -921,11 +895,7 @@ public class dimHelper extends DimensionManager
// World world = this.getWorld(link.locDimID);
dimensionID = getNextFreeDimId();
registerDimension(dimensionID,mod_pocketDim.providerID);
registerDimension(dimensionID, properties.PocketProviderID);
DimData locationDimData;
DimData destDimData;
@@ -1324,6 +1294,7 @@ public class dimHelper extends DimensionManager
*/
public static boolean removeRift(World world, int x, int y, int z, int range, EntityPlayer player, ItemStack item)
{
DDProperties properties = DDProperties.instance();
LinkData nearest=null;
float distance=range+1;
@@ -1337,7 +1308,7 @@ public class dimHelper extends DimensionManager
{
while (k<range)
{
if(world.getBlockId(x+i, y+j, z+k)==mod_pocketDim.blockRiftID&&MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance)
if(world.getBlockId(x+i, y+j, z+k)==properties.RiftBlockID&&MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance)
{
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0||range==1)
{

View File

@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
@@ -29,26 +30,23 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemRiftBlade extends itemDimDoor
{
private int weaponDamage;
private final EnumToolMaterial toolMaterial= EnumToolMaterial.GOLD;
private Material doorMaterial;
Random rand = new Random();
public ItemRiftBlade(int par1, Material par2Material)
{
super(par1, par2Material);
// this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(CreativeTabs.tabTransport);
this.weaponDamage =8;
this.setMaxStackSize(1);
// this.itemIcon=5;
this.setMaxDamage(500);
this.hasSubtypes=false;
//TODO move to proxy
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
@SideOnly(Side.CLIENT)
@@ -70,8 +68,6 @@ public class ItemRiftBlade extends itemDimDoor
}
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack par1ItemStack)
@@ -226,7 +222,7 @@ public class ItemRiftBlade extends itemDimDoor
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
if(hit!=null&&!par2World.isRemote)
{
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.blockRiftID)
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==properties.RiftBlockID)
{
LinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World);
if(link!=null)
@@ -262,7 +258,7 @@ public class ItemRiftBlade extends itemDimDoor
}
}
}
else if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.transientDoorID)
else if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.TransientDoorID)
{
didFindThing=true;
}
@@ -385,17 +381,11 @@ public class ItemRiftBlade extends itemDimDoor
*/
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Opens a temporary doors,");
par3List.add ("special teleport attack,");
par3List.add ("and rotates existing doors");
}
@Override
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{

View File

@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
@@ -20,7 +21,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemStabilizedRiftSignature extends itemLinkSignature
{
private Material doorMaterial;
private static DDProperties properties = null;
public ItemStabilizedRiftSignature(int par)
{
@@ -33,6 +34,9 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
this.setMaxDamage(0);
this.hasSubtypes=true;
//TODO move to proxy
if (properties == null)
properties = DDProperties.instance();
}
@SideOnly(Side.CLIENT)
@@ -85,9 +89,9 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
boolean hasEnder = false;
// checks to see if the item has a link stored, if so, it creates it
if(par2EntityPlayer.inventory.hasItem(Item.enderPearl.itemID)||par2EntityPlayer.inventory.hasItem(mod_pocketDim.itemStableFabricID))
if(par2EntityPlayer.inventory.hasItem(Item.enderPearl.itemID)||par2EntityPlayer.inventory.hasItem(properties.StableFabricItemID))
{
if(!par2EntityPlayer.inventory.consumeInventoryItem(mod_pocketDim.itemStableFabricID))
if(!par2EntityPlayer.inventory.consumeInventoryItem(properties.StableFabricItemID))
{
par2EntityPlayer.inventory.consumeInventoryItem(Item.enderPearl.itemID);

View File

@@ -106,7 +106,7 @@ public class ItemStableFabric extends Item
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
if(hit!=null&&!par2World.isRemote)
{
//if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.blockRiftID)
//if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==properties.RiftBlockID)
{
LinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World);
if(link!=null)

View File

@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
@@ -24,34 +25,31 @@ import net.minecraft.world.World;
public class itemDimDoor extends ItemDoor
{
private Material doorMaterial;
private static DDProperties properties = null;
public itemDimDoor(int par1, Material par2Material)
{
super(par1, par2Material);
this.setMaxStackSize(64);
this.doorMaterial = par2Material;
this.setCreativeTab(CreativeTabs.tabTransport);
if (properties == null)
properties = DDProperties.instance();
}
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Place on the block under a rift");
par3List.add ("to activate that rift,");
par3List.add("or place anywhere else");
par3List.add("to create a pocket dim");
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
@@ -79,9 +77,6 @@ public class itemDimDoor extends ItemDoor
var11 = mod_pocketDim.dimDoor;
}
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)&&!par3World.isRemote)
{
int var12 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
@@ -105,8 +100,6 @@ public class itemDimDoor extends ItemDoor
placeDoorBlock(par3World, par4, par5-offset, par6, var12, var11);
--par1ItemStack.stackSize;
return true;
}
@@ -144,13 +137,11 @@ public class itemDimDoor extends ItemDoor
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
Boolean didFindThing=false;
boolean didFindThing = false;
MovingObjectPosition hit = this.getMovingObjectPositionFromPlayer(par3EntityPlayer.worldObj, par3EntityPlayer, false );
if(hit!=null&&!par2World.isRemote)
{
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==mod_pocketDim.blockRiftID)
if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID)
{
LinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World);
if(link!=null)
@@ -212,25 +203,15 @@ public class itemDimDoor extends ItemDoor
int id = world.getBlockId(i, j, k);
boolean flag = true;
if(id==mod_pocketDim.blockDimWallID||id==mod_pocketDim.blockRiftID||id==mod_pocketDim.blockDimWallPermID||id==0)
if (id==properties.FabricBlockID || id==properties.RiftBlockID || id==properties.PermaFabricBlockID || id == 0)
{
return true;
}
if(id!=0)
if (id != 0 && !Block.blocksList[id].blockMaterial.isReplaceable())
{
if(!Block.blocksList[id].blockMaterial.isReplaceable())
{
flag = false;
}
}
return flag;
}
}

View File

@@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.DimData;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
@@ -22,7 +23,6 @@ import cpw.mods.fml.relauncher.SideOnly;
public class itemLinkSignature extends Item
{
private Material doorMaterial;
public itemLinkSignature(int par1)
{
@@ -35,8 +35,12 @@ public class itemLinkSignature extends Item
this.setMaxDamage(0);
this.hasSubtypes=true;
//TODO move to proxy
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack par1ItemStack)
@@ -90,22 +94,22 @@ public class itemLinkSignature extends Item
offset = 1;
}
}
if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.dimDoorID&&par3World.getBlockId(par4, par5+1, par6)==mod_pocketDim.dimDoorID)
if(par3World.getBlockId(par4, par5, par6) == properties.DimensionalDoorID && par3World.getBlockId(par4, par5 + 1, par6) == properties.DimensionalDoorID)
{
offset = 1;
}
else
if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.ExitDoorID&&par3World.getBlockId(par4, par5+1, par6)==mod_pocketDim.ExitDoorID)
if(par3World.getBlockId(par4, par5, par6)==properties.WarpDoorID&&par3World.getBlockId(par4, par5+1, par6)==properties.WarpDoorID)
{
offset = 1;
}
else
if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.dimDoorID&&par3World.getBlockId(par4, par5-1, par6)==mod_pocketDim.dimDoorID)
if (par3World.getBlockId(par4, par5, par6)==properties.DimensionalDoorID&&par3World.getBlockId(par4, par5-1, par6)==properties.DimensionalDoorID)
{
offset = 0;
}
else
if(par3World.getBlockId(par4, par5, par6)==mod_pocketDim.ExitDoorID&&par3World.getBlockId(par4, par5-1, par6)==mod_pocketDim.ExitDoorID)
if (par3World.getBlockId(par4, par5, par6) == properties.WarpDoorID && par3World.getBlockId(par4, par5-1, par6)==properties.WarpDoorID)
{
offset = 0;
}
@@ -118,7 +122,7 @@ public class itemLinkSignature extends Item
{
int id= (par3World.getBlockId(par4, par5+count, par6));
if(id == mod_pocketDim.dimDoorID||id==mod_pocketDim.ExitDoorID||id==mod_pocketDim.chaosDoorID)
if(id == properties.DimensionalDoorID||id==properties.WarpDoorID||id== properties.UnstableDoorID)
{
orientation = dimHelper.instance.getLinkDataFromCoords(par4, par5+count, par6,par3World).linkOrientation;
}

View File

@@ -2,7 +2,6 @@ package StevenDimDoors.mod_pocketDim;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
@@ -15,7 +14,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.MinecraftForge;
import StevenDimDoors.mod_pocketDim.blocks.BlockDimWall;
@@ -95,74 +93,31 @@ public class mod_pocketDim
@Instance("PocketDimensions")
public static mod_pocketDim instance = new mod_pocketDim();
public static SchematicLoader loader = new SchematicLoader();
public static pocketTeleporter teleporter = new pocketTeleporter();
public static DungeonHelper dungeonHelper= new DungeonHelper();
public static SchematicLoader loader;
public static pocketTeleporter teleporter;
public static DungeonHelper dungeonHelper;
public static ICommand printDimData;
public static ICommand removeRiftsCommand;
public static ICommand pruneDimsCommand;
public static ICommand removeAllLinksCommand;
public static ICommand deleteDimDataCommand;
public static ICommand addDungeonRift;
public static ICommand endDungeonCreation;
public static ICommand startDungeonCreation;
public static final ICommand printDimData = new CommandPrintDimData();
public static final ICommand removeRiftsCommand = new CommandDeleteRifts();
public static final ICommand pruneDimsCommand = new CommandPruneDims();
public static final ICommand removeAllLinksCommand = new CommandDeleteAllLinks();
public static final ICommand deleteDimDataCommand = new CommandDeleteDimData();
public static final ICommand addDungeonRift = new CommandAddDungeonRift();
public static final ICommand endDungeonCreation = new CommandEndDungeonCreation();
public static final ICommand startDungeonCreation = new CommandStartDungeonCreation();
public static int providerID;
public static int dimDoorID;
public static int ExitDoorID;
// public static int linkExitDoorID;
public static int itemLinkSignatureID;
public static int blockRiftID;
public static int transientDoorID;
public static int itemRiftBladeID;
public static int limboExitRange;
// public static int railRenderID;
public static String schematicContainer;
public static int itemStableFabricID;
public static int itemStabilizedLinkSignatureID;
public static int itemExitDoorID;
public static int limboDimID;
public static int limboProviderID;
public static int itemChaosDoorID;
public static int chaosDoorID;
public static int blockLimboID;
public static int dimHatchID;
// public static int dimRailID;
public static int riftSpreadFactor;
public static int DoorRenderID=55;
public static int HOW_MUCH_TNT;
public static int itemDimDoorID;
///public static int linkDimDoorID;
public static int blockDimWallID;
public static int itemRiftRemoverID;
public static int blockDimWallPermID;
public static int obeliskID;
//public static Block linkDimDoor;
public static Block transientDoor;
public static Block ExitDoor;
public static Block chaosDoor;
// public static Block linkExitDoor;
public static Block blockRift;
public static Block blockLimbo;
public static Block dimDoor;
// public static Block dimRail;
public static Block blockDimWall;
public static Block dimHatch;
public static Block blockDimWallPerm;
public static Item itemRiftBlade;
public static Item itemRiftBlade;
public static Item itemDimDoor;
public static Item itemExitDoor;
public static Item itemRiftRemover;
@@ -171,97 +126,52 @@ public class mod_pocketDim
public static Item itemChaosDoor;
public static Item itemStabilizedLinkSignature;
public static BiomeGenBase limboBiome;
public static BiomeGenBase pocketBiome;
public static int limboBiomeID;
public static int pocketBiomeID;
public static PlayerRespawnTracker tracker= new PlayerRespawnTracker();
public static PlayerRespawnTracker tracker;
public static HashMap<String,ArrayList<EntityItem>> limboSpawnInventory = new HashMap<String,ArrayList<EntityItem>>();
public static ArrayList<Integer> blocksImmuneToRift = new ArrayList<Integer>();
public static boolean riftsInWorldGen;
public static boolean isLimboActive;
public static boolean enableIronDimDoor;
public static boolean enableWoodenDimDoor;
public static boolean enableRiftSignature;
public static boolean enableRiftRemover;
public static boolean enableUnstableDoor;
public static boolean enableRiftBlade;
// public static boolean enableDimRail;
public static boolean enableDimTrapDoor;
public static boolean enableStabilizedRiftSignature;
public static boolean enableDoorOpenGL;
public static boolean hardcoreLimbo;
public static boolean returnInventory;
public static boolean hasInitDims = false;
public static boolean TNFREAKINGT;
public static boolean isPlayerWearingGoogles = false;
public static RiftGenerator riftGen = new RiftGenerator();
// public static World limbo= null;
private static DDProperties properties;
public static RiftGenerator riftGen;
public static long genTime;
public static boolean enableRiftGrief;
//public Spells spells = null;
public static int teleTimer = 0;
@PreInit
public void PreInit(FMLPreInitializationEvent event)
{
//This should be the FIRST thing that gets done.
properties = DDProperties.create(event.getSuggestedConfigurationFile());
//Now do other stuff
MinecraftForge.EVENT_BUS.register(new EventHookContainer());
File configFile = event.getSuggestedConfigurationFile();
Configuration config = new Configuration(configFile);
//These fields MUST be initialized after properties are loaded to prevent
//instances from holding onto null references to the properties.
loader = new SchematicLoader();
teleporter = new pocketTeleporter();
dungeonHelper= new DungeonHelper();
DDProperties.loadConfig(configFile);
printDimData = new CommandPrintDimData();
removeRiftsCommand = new CommandDeleteRifts();
pruneDimsCommand = new CommandPruneDims();
removeAllLinksCommand = new CommandDeleteAllLinks();
deleteDimDataCommand = new CommandDeleteDimData();
addDungeonRift = new CommandAddDungeonRift();
endDungeonCreation = new CommandEndDungeonCreation();
startDungeonCreation = new CommandStartDungeonCreation();
tracker = new PlayerRespawnTracker();
riftGen = new RiftGenerator();
String schematicDir = configFile.getParent()+"/DimDoors_Custom_schematics";
this.schematicContainer=schematicDir;
File file= new File(schematicDir);
File file= new File(properties.CustomSchematicDirectory);
file.mkdir();
String helpFile = "/mods/DimDoors/How_to_add_dungeons.txt";
@@ -270,70 +180,44 @@ public class mod_pocketDim
copyfile.copyFile(helpFile, file+"/How_to_add_dungeons.txt");
}
dungeonHelper.importCustomDungeons(schematicDir);
dungeonHelper.importCustomDungeons(properties.CustomSchematicDirectory);
dungeonHelper.registerBaseDungeons();
dungeonHelper.registerDungeonTypeTags();
}
@Init
public void Init(FMLInitializationEvent event)
{
transientDoor = (new TransientDoor(properties.TransientDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("transientDoor");
transientDoor = (new TransientDoor(transientDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("transientDoor");
// linkDimDoor = (new linkDimDoor(linkDimDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimDoorLink");
blockDimWall = (new BlockDimWall(blockDimWallID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall");
blockDimWallPerm = (new BlockDimWallPerm(blockDimWallPermID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setHardness(100000.0F).setUnlocalizedName("blockDimWallPerm");
ExitDoor = (new ExitDoor(ExitDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp");
// linkExitDoor = (new linkExitDoor(linkExitDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorexitlink");
blockRift = (new BlockRift(blockRiftID, 0, Material.air).setHardness(1.0F) .setUnlocalizedName("rift"));
blockLimbo = (new BlockLimbo(blockLimboID, 15, Material.iron).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));
chaosDoor = (new ChaosDoor(chaosDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) );
dimDoor = (new dimDoor(dimDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor");
dimHatch = (new dimHatch(dimHatchID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch");
blockDimWall = (new BlockDimWall(properties.FabricBlockID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall");
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setHardness(100000.0F).setUnlocalizedName("blockDimWallPerm");
ExitDoor = (new ExitDoor(properties.WarpDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp");
blockRift = (new BlockRift(properties.RiftBlockID, 0, Material.air).setHardness(1.0F) .setUnlocalizedName("rift"));
blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));
chaosDoor = (new ChaosDoor(properties.UnstableDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) );
dimDoor = (new dimDoor(properties.DimensionalDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor");
dimHatch = (new dimHatch(properties.TransTrapdoorID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch");
// dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F) .setUnlocalizedName("dimRail");
itemDimDoor = (new itemDimDoor(itemDimDoorID, Material.iron)).setUnlocalizedName("itemDimDoor");
itemExitDoor = (new itemExitDoor(itemExitDoorID, Material.wood)).setUnlocalizedName("itemDimDoorWarp");
itemLinkSignature = (new itemLinkSignature(itemLinkSignatureID )).setUnlocalizedName("itemLinkSignature");
itemRiftRemover = (new itemRiftRemover(itemRiftRemoverID, Material.wood)).setUnlocalizedName("itemRiftRemover");
itemStableFabric = (new ItemStableFabric(itemStableFabricID, 0)).setUnlocalizedName("itemStableFabric");
itemChaosDoor = (new ItemChaosDoor(itemChaosDoorID, Material.iron)).setUnlocalizedName("itemChaosDoor");
itemRiftBlade = (new ItemRiftBlade(itemRiftBladeID, Material.iron)).setUnlocalizedName("ItemRiftBlade");
itemStabilizedLinkSignature = (new ItemStabilizedRiftSignature(itemStabilizedLinkSignatureID)).setUnlocalizedName("itemStabilizedRiftSig");
itemDimDoor = (new itemDimDoor(properties.DimensionalDoorItemID, Material.iron)).setUnlocalizedName("itemDimDoor");
itemExitDoor = (new itemExitDoor(properties.WarpDoorItemID, Material.wood)).setUnlocalizedName("itemDimDoorWarp");
itemLinkSignature = (new itemLinkSignature(properties.RiftSignatureItemID)).setUnlocalizedName("itemLinkSignature");
itemRiftRemover = (new itemRiftRemover(properties.RiftRemoverItemID, Material.wood)).setUnlocalizedName("itemRiftRemover");
itemStableFabric = (new ItemStableFabric(properties.StableFabricItemID, 0)).setUnlocalizedName("itemStableFabric");
itemChaosDoor = (new ItemChaosDoor(properties.UnstableDoorItemID, Material.iron)).setUnlocalizedName("itemChaosDoor");
itemRiftBlade = (new ItemRiftBlade(properties.RiftBladeItemID, Material.iron)).setUnlocalizedName("ItemRiftBlade");
itemStabilizedLinkSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig");
this.limboBiome= (new BiomeGenLimbo(this.limboBiomeID) );
this.pocketBiome= (new BiomeGenPocket(this.pocketBiomeID));
mod_pocketDim.limboBiome= (new BiomeGenLimbo(properties.LimboBiomeID));
mod_pocketDim.pocketBiome= (new BiomeGenPocket(properties.PocketBiomeID));
GameRegistry.registerWorldGenerator(mod_pocketDim.riftGen);
GameRegistry.registerWorldGenerator(this.riftGen);
//GameRegistry.registerBlock(dimRail, "Dimensional Rail");
GameRegistry.registerBlock(chaosDoor, "Unstable Door");
GameRegistry.registerBlock(ExitDoor, "Warp Door");
//GameRegistry.registerBlock(linkExitDoor, "Warp Door link");
GameRegistry.registerBlock(blockRift, "Rift");
GameRegistry.registerBlock(blockLimbo, "Unraveled Fabric");
//GameRegistry.registerBlock(linkDimDoor, "Dimensional Door link");
GameRegistry.registerBlock(dimDoor, "Dimensional Door");
GameRegistry.registerBlock(dimHatch,"Transdimensional Trapdoor");
GameRegistry.registerBlock(blockDimWall, "Fabric of Reality");
@@ -342,22 +226,15 @@ public class mod_pocketDim
GameRegistry.registerPlayerTracker(tracker);
DimensionManager.registerProviderType(this.providerID, pocketProvider.class, false);
DimensionManager.registerProviderType(this.limboProviderID, LimboProvider.class, false);
DimensionManager.registerDimension(this.limboDimID , this.limboProviderID);
DimensionManager.registerProviderType(properties.PocketProviderID, pocketProvider.class, false);
DimensionManager.registerProviderType(properties.LimboProviderID, LimboProvider.class, false);
DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID);
LanguageRegistry.addName(transientDoor , "transientDoor");
LanguageRegistry.addName(blockRift , "Rift");
LanguageRegistry.addName(blockLimbo , "Unraveled Fabric");
LanguageRegistry.addName(ExitDoor , "Warp Door");
LanguageRegistry.addName(chaosDoor , "Unstable Door");
//LanguageRegistry.addName(linkDimDoor, "Dimensional Door");
LanguageRegistry.addName(blockDimWall , "Fabric of Reality");
LanguageRegistry.addName(blockDimWallPerm , "Fabric of Reality");
LanguageRegistry.addName(dimDoor, "Dimensional Door");
@@ -381,17 +258,15 @@ public class mod_pocketDim
GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor");
GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift");
EntityRegistry.registerModEntity(MobObelisk.class, "Obelisk", this.obeliskID, this,70, 1, true);
EntityList.IDtoClassMapping.put(this.obeliskID, MobObelisk.class);
EntityList.entityEggs.put(this.obeliskID, new EntityEggInfo(this.obeliskID, 0, 0xffffff));
EntityRegistry.registerModEntity(MobObelisk.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true);
EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobObelisk.class);
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
LanguageRegistry.instance().addStringLocalization("entity.DimDoors.Obelisk.name", "Monolith");
//GameRegistry.addBiome(this.limboBiome);
//GameRegistry.addBiome(this.pocketBiome);
if(this.enableIronDimDoor)
if (properties.CraftingDimensionaDoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(itemDimDoor, 1), new Object[]
{
@@ -400,7 +275,7 @@ public class mod_pocketDim
GameRegistry.addRecipe(new ItemStack(itemDimDoor, 1), new Object[]
{
" ", "yxy", " ", 'x', this.itemStableFabric, 'y', Item.doorIron
" ", "yxy", " ", 'x', mod_pocketDim.itemStableFabric, 'y', Item.doorIron
});
}
@@ -419,14 +294,14 @@ public class mod_pocketDim
}
**/
if(this.enableUnstableDoor)
if(properties.CraftingUnstableDoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(itemChaosDoor, 1), new Object[]
{
" ", "yxy", " ", 'x', Item.eyeOfEnder, 'y', this.itemDimDoor
" ", "yxy", " ", 'x', Item.eyeOfEnder, 'y', mod_pocketDim.itemDimDoor
});
}
if(this.enableWoodenDimDoor)
if(properties.CraftingWarpDoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(itemExitDoor, 1), new Object[]
{
@@ -435,10 +310,10 @@ public class mod_pocketDim
GameRegistry.addRecipe(new ItemStack(itemExitDoor, 1), new Object[]
{
" ", "yxy", " ", 'x', this.itemStableFabric, 'y', Item.doorWood
" ", "yxy", " ", 'x', mod_pocketDim.itemStableFabric, 'y', Item.doorWood
});
}
if(this.enableDimTrapDoor)
if(properties.CraftingTransTrapdoorAllowed)
{
GameRegistry.addRecipe(new ItemStack(dimHatch, 1), new Object[]
{
@@ -447,10 +322,10 @@ public class mod_pocketDim
GameRegistry.addRecipe(new ItemStack(dimHatch, 1), new Object[]
{
" y ", " x ", " y ", 'x', this.itemStableFabric, 'y', Block.trapdoor
" y ", " x ", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Block.trapdoor
});
}
if(this.enableRiftSignature)
if(properties.CraftingRiftSignatureAllowed)
{
GameRegistry.addRecipe(new ItemStack(itemLinkSignature, 1), new Object[]
{
@@ -459,10 +334,11 @@ public class mod_pocketDim
GameRegistry.addRecipe(new ItemStack(itemLinkSignature, 1), new Object[]
{
" y ", "yxy", " y ", 'x', this.itemStableFabric, 'y', Item.ingotIron
" y ", "yxy", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Item.ingotIron
});
}
if(this.enableRiftRemover)
if(properties.CraftingRiftRemoverAllowed)
{
GameRegistry.addRecipe(new ItemStack(itemRiftRemover, 1), new Object[]
{
@@ -470,78 +346,54 @@ public class mod_pocketDim
});
GameRegistry.addRecipe(new ItemStack(itemRiftRemover, 1), new Object[]
{
"yyy", "yxy", "yyy", 'x', this.itemStableFabric, 'y', Item.ingotGold
"yyy", "yxy", "yyy", 'x', mod_pocketDim.itemStableFabric, 'y', Item.ingotGold
});
}
if(this.enableRiftBlade)
if (properties.CraftingRiftBladeAllowed)
{
GameRegistry.addRecipe(new ItemStack(itemRiftBlade, 1), new Object[]
{
" x ", " x ", " y ", 'x', Item.enderPearl, 'y',this.itemRiftRemover
" x ", " x ", " y ", 'x', Item.enderPearl, 'y',mod_pocketDim.itemRiftRemover
});
}
if (properties.CraftingStableFabricAllowed)
{
GameRegistry.addRecipe(new ItemStack(itemStableFabric, 4), new Object[]
{
" y ", "yxy", " y ", 'x', Item.enderPearl, 'y', this.blockDimWall
});
GameRegistry.addRecipe(new ItemStack(itemStableFabric, 4), new Object[]
{
" y ", "yxy", " y ", 'x', Item.enderPearl, 'y', this.blockLimbo
});
if (this.enableStabilizedRiftSignature)
{
GameRegistry.addRecipe(new ItemStack(this.itemStabilizedLinkSignature,1), new Object[]
{
" y ", "yxy", " y ", 'x', this.itemLinkSignature, 'y', this.itemStableFabric
" y ", "yxy", " y ", 'x', Item.enderPearl, 'y', mod_pocketDim.blockDimWall
});
}
this.blocksImmuneToRift.add(this.blockDimWallID);
this.blocksImmuneToRift.add(this.blockDimWallPermID);
this.blocksImmuneToRift.add(this.dimDoorID);
this.blocksImmuneToRift.add(this.ExitDoorID);
// this.blocksImmuneToRift.add(this.linkDimDoorID);
// this.blocksImmuneToRift.add(this.linkExitDoorID);
this.blocksImmuneToRift.add(this.dimHatchID);
this.blocksImmuneToRift.add(this.chaosDoorID);
this.blocksImmuneToRift.add(this.blockRiftID);
this.blocksImmuneToRift.add(this.transientDoorID);
this.blocksImmuneToRift.add(Block.blockIron.blockID);
this.blocksImmuneToRift.add(Block.blockDiamond.blockID);
this.blocksImmuneToRift.add(Block.blockEmerald.blockID);
this.blocksImmuneToRift.add(Block.blockGold.blockID);
this.blocksImmuneToRift.add(Block.blockLapis.blockID);
this.blocksImmuneToRift.add(Block.bedrock.blockID);
if (properties.CraftingStabilizedRiftSignatureAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStabilizedLinkSignature,1), new Object[]
{
" y ", "yxy", " y ", 'x', mod_pocketDim.itemLinkSignature, 'y', mod_pocketDim.itemStableFabric
});
}
mod_pocketDim.blocksImmuneToRift.add(properties.FabricBlockID);
mod_pocketDim.blocksImmuneToRift.add(properties.PermaFabricBlockID);
mod_pocketDim.blocksImmuneToRift.add(properties.DimensionalDoorID);
mod_pocketDim.blocksImmuneToRift.add(properties.WarpDoorID);
mod_pocketDim.blocksImmuneToRift.add(properties.TransTrapdoorID);
mod_pocketDim.blocksImmuneToRift.add(properties.UnstableDoorID);
mod_pocketDim.blocksImmuneToRift.add(properties.RiftBlockID);
mod_pocketDim.blocksImmuneToRift.add(properties.TransientDoorID);
mod_pocketDim.blocksImmuneToRift.add(Block.blockIron.blockID);
mod_pocketDim.blocksImmuneToRift.add(Block.blockDiamond.blockID);
mod_pocketDim.blocksImmuneToRift.add(Block.blockEmerald.blockID);
mod_pocketDim.blocksImmuneToRift.add(Block.blockGold.blockID);
mod_pocketDim.blocksImmuneToRift.add(Block.blockLapis.blockID);
mod_pocketDim.blocksImmuneToRift.add(Block.bedrock.blockID);
dungeonHelper.registerFlipBlocks();
/**
**/
proxy.loadTextures();
proxy.registerRenderers();
}
@@ -555,13 +407,12 @@ public class mod_pocketDim
{
try
{
dimHelper.instance.save();
dimHelper.instance.unregsisterDims();
dimHelper.dimList.clear();
dimHelper.blocksToDecay.clear();
dimHelper.instance.interDimLinkList.clear();
this.hasInitDims=false;
mod_pocketDim.hasInitDims=false;
}
catch(Exception e)
{
@@ -573,27 +424,21 @@ public class mod_pocketDim
@ServerStarting
public void serverStarting(FMLServerStartingEvent event)
{
event.registerServerCommand(removeRiftsCommand);
event.registerServerCommand(pruneDimsCommand);
event.registerServerCommand(removeAllLinksCommand);
event.registerServerCommand(deleteDimDataCommand);
event.registerServerCommand(addDungeonRift);
event.registerServerCommand(this.startDungeonCreation);
event.registerServerCommand(this.printDimData);
event.registerServerCommand(this.endDungeonCreation);
event.registerServerCommand(mod_pocketDim.startDungeonCreation);
event.registerServerCommand(mod_pocketDim.printDimData);
event.registerServerCommand(mod_pocketDim.endDungeonCreation);
dimHelper.instance.load();
if(!dimHelper.dimList.containsKey(this.limboDimID))
if(!dimHelper.dimList.containsKey(properties.LimboDimensionID))
{
dimHelper.instance.dimList.put(mod_pocketDim.limboDimID, new DimData( mod_pocketDim.limboDimID, false, 0, new LinkData()));
dimHelper.dimList.put(properties.LimboDimensionID, new DimData( properties.LimboDimensionID, false, 0, new LinkData()));
}
}
public static int teleTimer=0;
}

View File

@@ -13,6 +13,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
@@ -36,9 +37,9 @@ public class MobObelisk extends EntityFlying implements IMob
int destX=0;
int destY=0;
int destZ=0;
public MobObelisk(World par1World)
{
super(par1World);
this.texture="/mods/DimDoors/textures/mobs/Monolith0.png";
this.setSize(3F, 9.0F);
@@ -46,11 +47,12 @@ public class MobObelisk extends EntityFlying implements IMob
this.scaleFactor= (float) ((rand.nextDouble()/2)+1);
this.aggroMax=rand.nextInt(245)+200;
// TODO Auto-generated constructor stub
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
@Override
public boolean canDespawn()
{
@@ -86,15 +88,8 @@ public class MobObelisk extends EntityFlying implements IMob
{
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
@Override
public void onEntityUpdate()
{
@@ -196,7 +191,7 @@ public class MobObelisk extends EntityFlying implements IMob
LinkData link = new LinkData(this.worldObj.provider.dimensionId, mod_pocketDim.limboDimID, (int)this.posX, (int)this.posY, (int)this.posZ, (int)this.posX+rand.nextInt(500)-250, (int)this.posY+500, (int)this.posZ+rand.nextInt(500)-250, false,0);
LinkData link = new LinkData(this.worldObj.provider.dimensionId, properties.LimboDimensionID, (int)this.posX, (int)this.posY, (int)this.posZ, (int)this.posX+rand.nextInt(500)-250, (int)this.posY+500, (int)this.posZ+rand.nextInt(500)-250, false,0);
dimHelper.instance.teleportToPocket(worldObj, link, entityPlayer);
this.aggro=0;
@@ -306,7 +301,7 @@ public class MobObelisk extends EntityFlying implements IMob
{
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this,AxisAlignedBB.getBoundingBox( this.posX-15, posY-4, this.posZ-15, this.posX+15, this.posY+15, this.posZ+15));
if(list.size()>0&&this.worldObj.provider.dimensionId==mod_pocketDim.limboDimID)
if(list.size()>0&&this.worldObj.provider.dimensionId==properties.LimboDimensionID)
{
return false;
}

View File

@@ -2,15 +2,22 @@ package StevenDimDoors.mod_pocketDim.world;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.block.Block;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.MapGenBase;
import StevenDimDoors.mod_pocketDim.DDProperties;
public class CustomCaveGen extends MapGenBase
{
private static DDProperties properties = null;
public CustomCaveGen()
{
if (properties == null)
properties = DDProperties.instance();
}
/**
* Generates a larger initial cave node than usual. Called 25% of the time.
*/
@@ -185,7 +192,7 @@ public class CustomCaveGen extends MapGenBase
var49 = true;
}
if (var53 == mod_pocketDim.blockLimboID|| var53 == Block.dirt.blockID || var53 == Block.grass.blockID)
if (var53 == properties.LimboBlockID || var53 == Block.dirt.blockID || var53 == Block.grass.blockID)
{
if (var50 < 10)
{

View File

@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.world;
import java.util.List;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.block.Block;
@@ -28,7 +29,7 @@ import net.minecraftforge.event.terraingen.ChunkProviderEvent;
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
{
private Random rand;
private static Random rand;
/** A NoiseGeneratorOctaves used in generating terrain */
private NoiseGeneratorOctaves noiseGen1;
@@ -102,15 +103,12 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
int[][] field_73219_j = new int[32][32];
{
// caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
}
private static DDProperties properties = null;
public LimboGenerator(World par1World, long par2)
{
super(par1World, par2, false);
//par2 = 90899090;
this.rand = new Random(par2);
@@ -133,6 +131,9 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
this.mobSpawnerNoise = noiseGens[6];
// TODO Auto-generated constructor stub
this.worldObj=par1World;
if (properties == null)
properties = DDProperties.instance();
}
@Override
@@ -376,11 +377,11 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
{
if ((var47 += var49) > 0.0D)
{
par3ArrayOfByte[var43 += var44] = (byte)mod_pocketDim.blockLimboID;
par3ArrayOfByte[var43 += var44] = (byte)properties.LimboBlockID;
}
else if (var12 * 8 + var31 < var6)
{
par3ArrayOfByte[var43 += var44] = (byte)mod_pocketDim.blockDimWallPermID;
par3ArrayOfByte[var43 += var44] = (byte)properties.PermaFabricBlockID;
}
else

View File

@@ -1,7 +1,5 @@
package StevenDimDoors.mod_pocketDim.world;
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChunkCoordinates;
@@ -10,31 +8,29 @@ import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.client.IRenderHandler;
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LimboProvider extends WorldProvider
{
@Override
public String getDimensionName() {
// TODO Auto-generated method stub
return "Limbo";
}
private IRenderHandler skyRenderer;
private DDProperties properties = null;
public LimboProvider()
{
this.hasNoSky = false;
this.skyRenderer = new limboSkyProvider();
if (properties == null)
properties = DDProperties.instance();
}
@SideOnly(Side.CLIENT)
@@ -59,9 +55,9 @@ public class LimboProvider extends WorldProvider
public boolean canRespawnHere()
{
return mod_pocketDim.hardcoreLimbo&&mod_pocketDim.isLimboActive;
return properties.HardcoreLimboEnabled && properties.LimboEnabled;
}
public boolean isBlockHighHumidity(int x, int y, int z)
{
return false;
@@ -73,6 +69,7 @@ public class LimboProvider extends WorldProvider
{
return false;
}
@Override
protected void generateLightBrightnessTable()
{
@@ -129,7 +126,7 @@ public class LimboProvider extends WorldProvider
public boolean canCoordinateBeSpawn(int par1, int par2)
{
int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2);
return var3 == mod_pocketDim.blockLimboID;
return var3 == properties.LimboBlockID;
}
@Override
public double getHorizon()
@@ -159,6 +156,7 @@ public class LimboProvider extends WorldProvider
{
return new LimboGenerator(worldObj, 45);
}
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
{
return false;
@@ -180,12 +178,5 @@ public class LimboProvider extends WorldProvider
}
return var5;
}
}

View File

@@ -1,6 +1,7 @@
package StevenDimDoors.mod_pocketDim.world;
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
import net.minecraft.entity.Entity;
@@ -24,11 +25,13 @@ public class pocketProvider extends WorldProvider
public boolean isSavingSchematic= false;
public int dimToSave;
private static DDProperties properties = null;
public pocketProvider()
{
this.hasNoSky=true;
if (properties == null)
properties = DDProperties.instance();
}
@Override
@@ -89,7 +92,6 @@ public class pocketProvider extends WorldProvider
@Override
public String getDimensionName()
{
// TODO Auto-generated method stub
return "PocketDim " + this.dimensionId;
}
@@ -98,9 +100,9 @@ public class pocketProvider extends WorldProvider
{
int respawnDim;
if(mod_pocketDim.isLimboActive)
if (properties.LimboEnabled)
{
respawnDim= mod_pocketDim.limboDimID;
respawnDim = properties.LimboDimensionID;
}
else
{

View File

@@ -14,9 +14,6 @@ import cpw.mods.fml.common.network.Player;
// This just handles the data packets in the server
public class ClientPacketHandler implements IPacketHandler{
@Override
public void onPacketData(INetworkManager manager,
Packet250CustomPayload packet, Player player) {

View File

@@ -13,6 +13,7 @@ import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.dimDoor;
@@ -24,6 +25,14 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
{
FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16);
public RenderDimDoor()
{
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
/**
* Renders the dimdoor.
*/
@@ -31,7 +40,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
{
try
{
dimDoor.class.cast(Block.blocksList[mod_pocketDim.dimDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
dimDoor.class.cast(Block.blocksList[properties.DimensionalDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
}
catch(Exception e)
@@ -268,7 +277,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
{
if(mod_pocketDim.enableDoorOpenGL)
if (properties.DoorRenderingEnabled)
{
this.renderDimDoorTileEntity((TileEntityDimDoor)par1TileEntity, par2, par4, par6, par8);
}

View File

@@ -13,6 +13,7 @@ import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.blocks.dimDoor;
@@ -24,6 +25,14 @@ public class RenderDimRail extends TileEntitySpecialRenderer
{
FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16);
public RenderDimRail()
{
if (properties == null)
properties = DDProperties.instance();
}
private static DDProperties properties = null;
/**
* Renders the dimdoor.
*/
@@ -31,7 +40,7 @@ public class RenderDimRail extends TileEntitySpecialRenderer
{
try
{
dimDoor.class.cast(Block.blocksList[mod_pocketDim.dimDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
dimDoor.class.cast(Block.blocksList[properties.DimensionalDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
}
catch(Exception e)
@@ -266,7 +275,7 @@ public class RenderDimRail extends TileEntitySpecialRenderer
public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
{
if(mod_pocketDim.enableDoorOpenGL)
if (properties.DoorRenderingEnabled)
{
this.renderDimDoorTileEntity((TileEntityDimDoor)par1TileEntity, par2, par4, par6, par8);
}

Binary file not shown.

Binary file not shown.