Merging changes

This commit is contained in:
StevenRS11
2013-06-14 01:53:30 -04:00
35 changed files with 3558 additions and 3752 deletions

View File

@@ -1,4 +1,5 @@
package StevenDimDoors.mod_pocketDim;
import java.util.EnumSet;
import java.util.Random;
@@ -11,177 +12,179 @@ 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();
public int tickCount=0;
public int tickCount2=0;
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)
{
if (type.equals(EnumSet.of(TickType.SERVER)))
{
onTickInGame();
}
}
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
if (type.equals(EnumSet.of(TickType.SERVER)))
{
onTickInGame();
}
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
if (type.equals(EnumSet.of(TickType.SERVER)))
{
}
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
if (type.equals(EnumSet.of(TickType.SERVER)))
{
}
}
public EnumSet ticks()
{
return EnumSet.of(TickType.SERVER);
}
public EnumSet ticks()
{
return EnumSet.of(TickType.SERVER);
}
public String getLabel()
{
return null;
}
public String getLabel()
{
return null;
}
//replaces rifts in game that have been destroyed/have blocks placed over them.
private void onTickInGame()
{
try
{
if(tickCount>100)
{
tickCount=0;
int i=0;
while (i<15&&FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER)
{
i++;
LinkData link;
//actually gets the random rift based on the size of the list
link = (LinkData) dimHelper.instance.getRandomLinkData(true);
//replaces rifts in game that have been destroyed/have blocks placed over them.
private void onTickInGame()
{
if(link!=null)
{
if(dimHelper.getWorld(link.locDimID)!=null)
{
World world=dimHelper.getWorld(link.locDimID);
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(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);
TileEntityRift.class.cast(dimHelper.getWorld(link.locDimID).getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord)).hasGrownRifts=true;
}
}
}
}
}
}
}
catch (Exception e)
{
tickCount++;
System.out.println("something on tick went wrong");
}
tickCount++;
//this section regulates decay in Limbo- it records any blocks placed by the player and later progresss them through the decay cycle
if(tickCount2>10&&dimHelper.blocksToDecay!=null)
{
tickCount2=0;
if(!dimHelper.blocksToDecay.isEmpty()&&dimHelper.getWorld(mod_pocketDim.limboDimID)!=null)
{
if(dimHelper.blocksToDecay.size()>rand.nextInt(400))
{
int index = rand.nextInt(dimHelper.blocksToDecay.size());
Point3D point = (Point3D) dimHelper.blocksToDecay.get(index);
try
{
int blockID = dimHelper.getWorld(mod_pocketDim.limboDimID).getBlockId(point.getX(), point.getY(), point.getZ());
int idToSet=Block.stone.blockID;
if(blockID==0||blockID==mod_pocketDim.blockLimboID)
{
dimHelper.blocksToDecay.remove(index);
}
else
{
if(Block.blocksList[idToSet] instanceof BlockContainer)
{
idToSet=-1;
dimHelper.blocksToDecay.remove(index);
}
if(blockID==Block.cobblestone.blockID)
{
idToSet=Block.gravel.blockID;
}
if(blockID==Block.stone.blockID)
{
idToSet=Block.cobblestone.blockID;
if(tickCount>100)
{
tickCount=0;
int i=0;
}
if(blockID==Block.gravel.blockID&&!dimHelper.getWorld(mod_pocketDim.limboDimID).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);
}
else if(blockID==Block.gravel.blockID)
{
dimHelper.blocksToDecay.remove(index);
idToSet=-1;
}
if(idToSet!=-1)
{
dimHelper.getWorld(mod_pocketDim.limboDimID).setBlock(point.getX(), point.getY(), point.getZ(), idToSet);
while (i<15&&FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER)
{
i++;
LinkData link;
//actually gets the random rift based on the size of the list
link = (LinkData) dimHelper.instance.getRandomLinkData(true);
if(link!=null)
{
if(dimHelper.getWorld(link.locDimID)!=null)
{
World world=dimHelper.getWorld(link.locDimID);
int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
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, properties.RiftBlockID);
TileEntityRift.class.cast(dimHelper.getWorld(link.locDimID).getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord)).hasGrownRifts=true;
}
}
}
}
}
}
}
catch (Exception e)
{
tickCount++;
System.out.println("something on tick went wrong");
}
tickCount++;
//this section regulates decay in Limbo- it records any blocks placed by the player and later progresss them through the decay cycle
if(tickCount2>10&&dimHelper.blocksToDecay!=null)
{
tickCount2=0;
if(!dimHelper.blocksToDecay.isEmpty()&&dimHelper.getWorld(properties.LimboDimensionID)!=null)
{
if(dimHelper.blocksToDecay.size()>rand.nextInt(400))
{
int index = rand.nextInt(dimHelper.blocksToDecay.size());
Point3D point = (Point3D) dimHelper.blocksToDecay.get(index);
int blockID = dimHelper.getWorld(properties.LimboDimensionID).getBlockId(point.getX(), point.getY(), point.getZ());
int idToSet=Block.stone.blockID;
if(blockID==0||blockID==properties.LimboBlockID)
{
dimHelper.blocksToDecay.remove(index);
}
else
{
if(Block.blocksList[idToSet] instanceof BlockContainer)
{
idToSet=-1;
dimHelper.blocksToDecay.remove(index);
}
if(blockID==Block.cobblestone.blockID)
{
idToSet=Block.gravel.blockID;
}
if(blockID==Block.stone.blockID)
{
idToSet=Block.cobblestone.blockID;
}
if(blockID==Block.gravel.blockID&&!dimHelper.getWorld(properties.LimboDimensionID).isAirBlock(point.getX(), point.getY()-1, point.getZ()))
{
idToSet=properties.LimboBlockID;
dimHelper.getWorld(properties.LimboDimensionID).scheduleBlockUpdate(point.getX(), point.getY(), point.getZ(),10, idToSet);
}
else if(blockID==Block.gravel.blockID)
{
dimHelper.blocksToDecay.remove(index);
idToSet=-1;
}
if(idToSet!=-1)
{
dimHelper.getWorld(properties.LimboDimensionID).setBlock(point.getX(), point.getY(), point.getZ(), idToSet);
}
}
}
}
}
tickCount2++;
if(mod_pocketDim.teleTimer>0)
{
mod_pocketDim.teleTimer--;
}
}
}
}
}
}
}
tickCount2++;
if(mod_pocketDim.teleTimer>0)
{
mod_pocketDim.teleTimer--;
}
}
}

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

@@ -0,0 +1,204 @@
package StevenDimDoors.mod_pocketDim;
import java.io.File;
import net.minecraftforge.common.Configuration;
public class DDProperties
{
/**
* Block IDs
*/
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;
/**
* World Generation Block IDs
*/
public final int LimboBlockID;
public final int PermaFabricBlockID;
/**
* Item IDs
*/
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 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 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 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 final int NonTntWeight;
public final int RiftSpreadModifier;
public final int LimboReturnRange;
public final String CustomSchematicDirectory;
//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)
{
//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(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);
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);
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);
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();
DoorRenderEntityID=config.get(CATEGORY_ENTITY, "Door Render Entity ID", 89).getInt();
MonolithEntityID = config.get(CATEGORY_ENTITY, "Monolith Entity ID", 125).getInt();
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();
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();
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();
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();
WorldRiftGenerationEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Rift World Generation", true,
"Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true);
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();
}
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;
@@ -40,17 +42,14 @@ public class DimData implements Serializable
this.isPocket=isPocket;
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,224 +0,0 @@
package StevenDimDoors.mod_pocketDim;
import java.io.File;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
public class DimDoorsConfig
{
/**
* BlockIDs
*/
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;
/**
* WorldGenBlockIDs
*/
public static Property LimboBlockID;
public static Property PermaFabricBlockID;
/**
* ItemIDs
*/
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;
/**
* 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;
/**
* CraftingFlags
*/
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;
/**
* OtherFlags
*/
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;
/**
* Other
*/
public static Property NonTntWeight;
public static Property RiftSpreadModifier;
public static Property LimboReturnRange;
public static void loadConfig(File configFile)
{
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);
LimboRespawningEnabled = config.get(Configuration.CATEGORY_GENERAL, "bHardcoreLimbo", false);
LimboRespawningEnabled.comment = "True causes the player to respawn in limbo if they die in limbo";
TNFREAKINGT_Enabled = config.get("Configuration.CATEGORY_GENERAL", "EXPLOSIONS!!???!!!?!?!!", false);
RiftGriefingEnabled = config.get(Configuration.CATEGORY_GENERAL, "bRiftGreif", true);
RiftGriefingEnabled.comment = "toggles whether rifts eat blocks around them or not";
DoorRenderingEnabled = config.get(Configuration.CATEGORY_GENERAL, "bEnableDoorRender", true);
LimboReturnsInventoryEnabled = config.get(Configuration.CATEGORY_GENERAL, "bLimboReturnInventory", true);
LimboReturnsInventoryEnabled.comment="Toggles whether or not your inventory is returned upon dying and respawning in limbo";
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. ";
MonolithEntityID=config.get(Configuration.CATEGORY_GENERAL, "monolithID", 125);
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);
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);
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);
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);
}
}

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,341 +32,340 @@ 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)
{
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
if (packet.channel.equals("DimDoorPackets"))
{
handleRandom(packet,player);
}
}
private void handleRandom(Packet250CustomPayload packet, Player player)
{
ByteArrayDataInput data = ByteStreams.newDataInput(packet.data);
int id=data.readByte();
if(id==regsiterDimPacketID)
{
int dimId = data.readInt();
// System.out.println("regsitered dim ID" + dimId);
try
{
DimData dimDataToAdd = new DimData(dimId, data.readBoolean(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt());
if (packet.channel.equals("DimDoorPackets"))
{
handleRandom(packet,player);
}
if(!dimHelper.dimList.containsKey(dimId))
{
dimHelper.dimList.put(dimId, dimDataToAdd);
}
if(dimDataToAdd.isPocket)
{
dimHelper.registerDimension(dimId, mod_pocketDim.providerID);
//System.out.println("regsitered dim ID" + dimId);
}
}
catch (Exception e)
{
// e.printStackTrace();
if(dimId!=0)
{
// System.out.println(String.valueOf(dimId)+"dimID already registered");
}
}
}
if(id==registerLinkPacketID)
{
int dimId = data.readInt();
try
{
DimData dimDataToAddLink= dimHelper.dimList.get(dimId);
}
LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt());
linkToAdd.hasGennedDoor=data.readBoolean();
dimHelper.instance.createLink(linkToAdd);
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Tried to update client link data & failed!");
}
}
if(id==removeLinkPacketID)
{
int dimId = data.readInt();
try
{
DimData dimDataToRemoveFrom= dimHelper.dimList.get(dimId);
private void handleRandom(Packet250CustomPayload packet, Player player)
{
ByteArrayDataInput data = ByteStreams.newDataInput(packet.data);
LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt());
dimDataToRemoveFrom.removeLinkAtCoords(linkToAdd.locDimID, linkToAdd.locXCoord,linkToAdd.locYCoord, linkToAdd.locZCoord);
}
catch (Exception e)
{
//e.printStackTrace();
System.out.println("Tried to update client link data & failed!");
}
}
if(id==this.linkKeyPacketID)
{
LinkData link = new LinkData(data.readInt(), data.readInt(), data.readInt(), data.readInt());
dimHelper.instance.interDimLinkList.put(data.readInt(), link);
}
}
public static void onClientJoinPacket(INetworkManager manager, HashMap<Integer, DimData> dimList)
int id=data.readByte();
if(id==regsiterDimPacketID)
{
Collection<Integer> dimIDs= dimList.keySet();
Collection<DimData> dimDataSet= dimList.values();
Collection<Packet250CustomPayload> packetsToSend = new HashSet();
for(DimData data : dimDataSet)
int dimId = data.readInt();
// System.out.println("regsitered dim ID" + dimId);
try
{
manager.addToSendQueue(PacketHandler.onDimCreatedPacket(data));
Collection <HashMap<Integer, HashMap<Integer, LinkData>>> linkList = data.linksInThisDim.values();
for(HashMap map : linkList )
{
Collection <HashMap<Integer, LinkData>> linkList2 = map.values();
for(HashMap map2 : linkList2)
{
Collection <LinkData> linkList3 = map2.values();
for(LinkData link : linkList3)
{
packetsToSend.add(( PacketHandler.onLinkCreatedPacket(link)));
DimData dimDataToAdd = new DimData(dimId, data.readBoolean(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt());
}
if(!dimHelper.dimList.containsKey(dimId))
{
dimHelper.dimList.put(dimId, dimDataToAdd);
}
if(dimDataToAdd.isPocket)
{
if (properties == null)
properties = DDProperties.instance();
dimHelper.registerDimension(dimId, properties.PocketProviderID);
//System.out.println("regsitered dim ID" + dimId);
}
}
}
}
for (Packet250CustomPayload packet : packetsToSend)
catch (Exception e)
{
manager.addToSendQueue(packet);
// e.printStackTrace();
if(dimId!=0)
{
// System.out.println(String.valueOf(dimId)+"dimID already registered");
}
}
}
public static Packet250CustomPayload onLinkCreatedPacket(LinkData link)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(bos);
try
{
dataOut.writeByte(PacketHandler.registerLinkPacketID);
dataOut.writeInt(link.locDimID);
dataOut.writeInt(link.destDimID);
dataOut.writeInt(link.locXCoord);
dataOut.writeInt(link.locYCoord);
dataOut.writeInt(link.locZCoord);
dataOut.writeInt(link.destXCoord);
dataOut.writeInt(link.destYCoord);
dataOut.writeInt(link.destZCoord);
dataOut.writeBoolean(link.isLocPocket);
dataOut.writeInt(link.linkOrientation);
dataOut.writeBoolean(link.hasGennedDoor);
}
catch (IOException e)
{
e.printStackTrace();
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
return packet;
}
public static Packet250CustomPayload linkKeyPacket(LinkData link, int key)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(bos);
try
{
dataOut.writeByte(PacketHandler.linkKeyPacketID);
dataOut.writeInt(link.destDimID);
dataOut.writeInt(link.destXCoord);
dataOut.writeInt(link.destYCoord);
dataOut.writeInt(link.destZCoord);
dataOut.writeInt(key);
}
catch (IOException e)
{
e.printStackTrace();
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
return packet;
}
public static void onLinkRemovedPacket(LinkData link)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(bos);
try
{
dataOut.writeByte(PacketHandler.removeLinkPacketID);
dataOut.writeInt(link.locDimID);
dataOut.writeInt(link.destDimID);
dataOut.writeInt(link.locXCoord);
dataOut.writeInt(link.locYCoord);
dataOut.writeInt(link.locZCoord);
dataOut.writeInt(link.destXCoord);
dataOut.writeInt(link.destYCoord);
dataOut.writeInt(link.destZCoord);
dataOut.writeBoolean(link.isLocPocket);
}
catch (IOException e)
{
e.printStackTrace();
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
}
public static Packet250CustomPayload onDimCreatedPacket(DimData data)
if(id==registerLinkPacketID)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(bos);
try
{
dataOut.writeByte(PacketHandler.regsiterDimPacketID);
dataOut.writeInt(data.dimID);
dataOut.writeBoolean(data.isPocket);
dataOut.writeInt(data.depth);
dataOut.writeInt(data.exitDimLink.destDimID);
dataOut.writeInt(data.exitDimLink.destXCoord);
dataOut.writeInt(data.exitDimLink.destYCoord);
dataOut.writeInt(data.exitDimLink.destZCoord);
}
catch (IOException e)
{
e.printStackTrace();
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();
PacketDispatcher.sendPacketToAllPlayers(packet);
return packet;
int dimId = data.readInt();
try
{
DimData dimDataToAddLink= dimHelper.dimList.get(dimId);
LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt());
linkToAdd.hasGennedDoor=data.readBoolean();
dimHelper.instance.createLink(linkToAdd);
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Tried to update client link data & failed!");
}
}
/**
if(id==removeLinkPacketID)
{
int dimId = data.readInt();
try
{
DimData dimDataToRemoveFrom= dimHelper.dimList.get(dimId);
LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt());
dimDataToRemoveFrom.removeLinkAtCoords(linkToAdd.locDimID, linkToAdd.locXCoord,linkToAdd.locYCoord, linkToAdd.locZCoord);
}
catch (Exception e)
{
//e.printStackTrace();
System.out.println("Tried to update client link data & failed!");
}
}
if(id==this.linkKeyPacketID)
{
LinkData link = new LinkData(data.readInt(), data.readInt(), data.readInt(), data.readInt());
dimHelper.instance.interDimLinkList.put(data.readInt(), link);
}
}
public static void onClientJoinPacket(INetworkManager manager, HashMap<Integer, DimData> dimList)
{
Collection<Integer> dimIDs= dimList.keySet();
Collection<DimData> dimDataSet= dimList.values();
Collection<Packet250CustomPayload> packetsToSend = new HashSet();
for(DimData data : dimDataSet)
{
manager.addToSendQueue(PacketHandler.onDimCreatedPacket(data));
Collection <HashMap<Integer, HashMap<Integer, LinkData>>> linkList = data.linksInThisDim.values();
for(HashMap map : linkList )
{
Collection <HashMap<Integer, LinkData>> linkList2 = map.values();
for(HashMap map2 : linkList2)
{
Collection <LinkData> linkList3 = map2.values();
for(LinkData link : linkList3)
{
packetsToSend.add(( PacketHandler.onLinkCreatedPacket(link)));
}
}
}
}
for (Packet250CustomPayload packet : packetsToSend)
{
manager.addToSendQueue(packet);
}
}
public static Packet250CustomPayload onLinkCreatedPacket(LinkData link)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(bos);
try
{
dataOut.writeByte(PacketHandler.registerLinkPacketID);
dataOut.writeInt(link.locDimID);
dataOut.writeInt(link.destDimID);
dataOut.writeInt(link.locXCoord);
dataOut.writeInt(link.locYCoord);
dataOut.writeInt(link.locZCoord);
dataOut.writeInt(link.destXCoord);
dataOut.writeInt(link.destYCoord);
dataOut.writeInt(link.destZCoord);
dataOut.writeBoolean(link.isLocPocket);
dataOut.writeInt(link.linkOrientation);
dataOut.writeBoolean(link.hasGennedDoor);
}
catch (IOException e)
{
e.printStackTrace();
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
return packet;
}
public static Packet250CustomPayload linkKeyPacket(LinkData link, int key)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(bos);
try
{
dataOut.writeByte(PacketHandler.linkKeyPacketID);
dataOut.writeInt(link.destDimID);
dataOut.writeInt(link.destXCoord);
dataOut.writeInt(link.destYCoord);
dataOut.writeInt(link.destZCoord);
dataOut.writeInt(key);
}
catch (IOException e)
{
e.printStackTrace();
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
return packet;
}
public static void onLinkRemovedPacket(LinkData link)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(bos);
try
{
dataOut.writeByte(PacketHandler.removeLinkPacketID);
dataOut.writeInt(link.locDimID);
dataOut.writeInt(link.destDimID);
dataOut.writeInt(link.locXCoord);
dataOut.writeInt(link.locYCoord);
dataOut.writeInt(link.locZCoord);
dataOut.writeInt(link.destXCoord);
dataOut.writeInt(link.destYCoord);
dataOut.writeInt(link.destZCoord);
dataOut.writeBoolean(link.isLocPocket);
}
catch (IOException e)
{
e.printStackTrace();
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
}
public static Packet250CustomPayload onDimCreatedPacket(DimData data)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(bos);
try
{
dataOut.writeByte(PacketHandler.regsiterDimPacketID);
dataOut.writeInt(data.dimID);
dataOut.writeBoolean(data.isPocket);
dataOut.writeInt(data.depth);
dataOut.writeInt(data.exitDimLink.destDimID);
dataOut.writeInt(data.exitDimLink.destXCoord);
dataOut.writeInt(data.exitDimLink.destYCoord);
dataOut.writeInt(data.exitDimLink.destZCoord);
}
catch (IOException e)
{
e.printStackTrace();
}
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();
PacketDispatcher.sendPacketToAllPlayers(packet);
return packet;
}
/**
private void handleObjectPacket(Packet250CustomPayload packet, Player player)
{
ObjectInputStream data = new ObjectInputStream;
@@ -375,50 +374,50 @@ public class PacketHandler implements IPacketHandler
System.out.println(id);
if(id==dimPacketID)
{
try
{
DimData dimData = data.read
dimHelper.dimList.put(key, value)
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
**/
public static void sendDimObject(DimData dim)
**/
public static void sendDimObject(DimData dim)
{
try
{
try
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream dataOut = new ObjectOutputStream(bos);
dataOut.writeObject(dim);
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
}
catch (IOException e)
{
e.printStackTrace();
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream dataOut = new ObjectOutputStream(bos);
dataOut.writeObject(dim);
Packet250CustomPayload packet= new Packet250CustomPayload();
packet.channel="DimDoorPackets";
packet.data = bos.toByteArray();
packet.length = bos.size();;
PacketDispatcher.sendPacketToAllPlayers(packet);
}
catch (IOException e)
{
e.printStackTrace();
}
}
}

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

@@ -12,94 +12,100 @@ import cpw.mods.fml.common.IWorldGenerator;
public class RiftGenerator implements IWorldGenerator
{
private int minableBlockId;
private int numberOfBlocks;
int cycles=40;
boolean shouldSave = false;
int count = 0;
int i;
int k;
int j;
Random rand = new Random();
boolean shouldGenHere=true;
LinkData link;
DimData dimData;
private int minableBlockId;
private int numberOfBlocks;
int cycles=40;
boolean shouldSave = false;
int count = 0;
int i;
int k;
int j;
Random rand = new Random();
boolean shouldGenHere=true;
LinkData link;
DimData dimData;
@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)
{
this.shouldGenHere=false;
}
if(this.shouldGenHere)
{
if(random.nextInt(3500)==0)
{
i=chunkX*16-random.nextInt(16);
k=chunkZ*16-random.nextInt(16);
j= world.getHeightValue(i, k);
if(j>20&&world.getBlockId(i, j, k)==0)
{
// System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"Large gen");
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
link = dimHelper.instance.createPocket(link,true, true);
this.shouldSave=true;
// SchematicLoader loader = new SchematicLoader();
// loader.init(link);
// loader.generateSchematic(link);
count=0;
while(random.nextInt(4)!=1)
{
i=chunkX*16-random.nextInt(16);
k=chunkZ*16-random.nextInt(16);
j= world.getHeightValue(i, k);
if(world.isAirBlock(i, j+1, k))
{
link = dimHelper.instance.createLink(link.locDimID,link.destDimID, i, j+1, k,link.destXCoord,link.destYCoord,link.destZCoord);
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"|| !properties.WorldRiftGenerationEnabled || world.isRemote)
{
this.shouldGenHere=false;
}
if(this.shouldGenHere)
{
if(random.nextInt(3500)==0)
{
i=chunkX*16-random.nextInt(16);
k=chunkZ*16-random.nextInt(16);
j= world.getHeightValue(i, k);
if(j>20&&world.getBlockId(i, j, k)==0)
{
// System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"Large gen");
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
link = dimHelper.instance.createPocket(link,true, true);
this.shouldSave=true;
// SchematicLoader loader = new SchematicLoader();
// loader.init(link);
// loader.generateSchematic(link);
count=0;
while(random.nextInt(4)!=1)
{
i=chunkX*16-random.nextInt(16);
k=chunkZ*16-random.nextInt(16);
j= world.getHeightValue(i, k);
if(world.isAirBlock(i, j+1, k))
{
link = dimHelper.instance.createLink(link.locDimID,link.destDimID, i, j+1, k,link.destXCoord,link.destYCoord,link.destZCoord);
}
}
}
}
/**
if(random.nextInt(540)==0)
{
i=chunkX*16-random.nextInt(16);
k=chunkZ*16-random.nextInt(16);
j= world.getHeightValue(i, k);
if(j>20&&world.getBlockId(i, j, k)==0)
{
@@ -108,149 +114,149 @@ public class RiftGenerator implements IWorldGenerator
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
link = dimHelper.instance.createPocket(link,true, true);
this.shouldSave=true;
// SchematicLoader loader = new SchematicLoader();
// loader.init(link);
// loader.generateSchematic(link);
count=0;
while(random.nextInt(3)!=1)
{
i=chunkX*16-random.nextInt(16);
k=chunkZ*16-random.nextInt(16);
j= world.getHeightValue(i, k);
if(world.isAirBlock(i, j+1, k))
{
link = dimHelper.instance.createLink(link.locDimID,link.destDimID, i, j+1, k,link.destXCoord,link.destYCoord,link.destZCoord);
}
}
}
}
**/
}
if(random.nextInt(250)==0&&world.provider.getDimensionName()!="PocketDim"&&!world.isRemote&&mod_pocketDim.riftsInWorldGen)
{
// System.out.println("tryingToGen");
int blockID=Block.stoneBrick.blockID;
if(world.provider.dimensionId==mod_pocketDim.limboDimID)
{
blockID= mod_pocketDim.blockLimboID;
}
i=chunkX*16-random.nextInt(16);
k=chunkZ*16-random.nextInt(16);
j= world.getHeightValue(i, k);
if(j>20&&world.getBlockId(i, j, k)==0)
{
//System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"small gen");
**/
count=0;
if(world.isAirBlock(i, j+1, k))
{
if(world.isBlockOpaqueCube(i, j-2, k)||world.isBlockOpaqueCube(i, j-1, k))
{
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
link =dimHelper.instance.createPocket(link,true, true);
for(int xc=-3;xc<4;xc++)
{
for(int zc=-3;zc<4;zc++)
{
for(int yc=0;yc<200;yc++)
{
if(yc==0&&world.isBlockOpaqueCube(i+xc, j-2,k +zc))
{
if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+2)
{
world.setBlock(i+xc, j-1+yc, k+zc, blockID);
}
else if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+3)
}
{
world.setBlock(i+xc, j-1+yc, k+zc, blockID,2,1);
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==properties.LimboDimensionID)
{
blockID= properties.LimboBlockID;
}
i=chunkX*16-random.nextInt(16);
k=chunkZ*16-random.nextInt(16);
}
}
j= world.getHeightValue(i, k);
if(j>20&&world.getBlockId(i, j, k)==0)
{
//System.out.println(String.valueOf(i)+"x "+String.valueOf(j)+"y "+String.valueOf(k)+"z"+"small gen");
}
count=0;
}
}
ItemRiftBlade.placeDoorBlock(world, i, j+1, k, 0, mod_pocketDim.transientDoor);
{
if(world.isAirBlock(i, j+1, k))
{
if(world.isBlockOpaqueCube(i, j-2, k)||world.isBlockOpaqueCube(i, j-1, k))
{
link = new LinkData(world.provider.dimensionId, 0, i, j+1, k, i, j+1, k, true,rand.nextInt(4));
link =dimHelper.instance.createPocket(link,true, true);
for(int xc=-3;xc<4;xc++)
{
for(int zc=-3;zc<4;zc++)
{
for(int yc=0;yc<200;yc++)
{
if(yc==0&&world.isBlockOpaqueCube(i+xc, j-2,k +zc))
{
if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+2)
{
world.setBlock(i+xc, j-1+yc, k+zc, blockID);
}
else if(Math.abs(xc)+Math.abs(zc)<rand.nextInt(3)+3)
{
world.setBlock(i+xc, j-1+yc, k+zc, blockID,2,1);
}
}
}
}
}
ItemRiftBlade.placeDoorBlock(world, i, j+1, k, 0, mod_pocketDim.transientDoor);
{
world.setBlock(i, j+1, k-1, blockID,0,1);
world.setBlock(i, j+1, k+1, blockID,0,1);
world.setBlock(i, j, k-1, blockID,0,1);
world.setBlock(i, j, k+1, blockID,0,1);
world.setBlock(i, j+2, k+1, blockID,3,1);
world.setBlock(i, j+2, k-1, blockID,3,1);
}
}
this.shouldSave=true;
}
// dimData = dimHelper.instance.dimList.get(link.destDimID);
// SchematicLoader loader = new SchematicLoader();
// loader.init(link);
// loader.generateSchematic(link);
}
}
}
if(this.shouldSave)
{
// dimHelper.instance.save();
}
// mod_pocketDim.genTime=((System.nanoTime()-ntime)+mod_pocketDim.genTime);
// System.out.println( mod_pocketDim.genTime);
// System.out.println( (System.nanoTime()-ntime));
// ntime=0L;
}
this.shouldSave=true;
}
// dimData = dimHelper.instance.dimList.get(link.destDimID);
// SchematicLoader loader = new SchematicLoader();
// loader.init(link);
// loader.generateSchematic(link);
}
}
}
if(this.shouldSave)
{
// dimHelper.instance.save();
}
// mod_pocketDim.genTime=((System.nanoTime()-ntime)+mod_pocketDim.genTime);
// System.out.println( mod_pocketDim.genTime);
// System.out.println( (System.nanoTime()-ntime));
// ntime=0L;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -7,9 +7,9 @@ import cpw.mods.fml.common.network.Player;
public class ServerPacketHandler implements IPacketHandler
{
@Override
public void onPacketData(INetworkManager manager,
Packet250CustomPayload packet, Player player)
{
}
@Override
public void onPacketData(INetworkManager manager,
Packet250CustomPayload packet, Player player)
{
}
}

View File

@@ -32,10 +32,13 @@ 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,83 +17,79 @@ 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);
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) {}
/**
* Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0
*/
public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if(!par1World.isRemote&&par1World.provider.dimensionId==mod_pocketDim.limboDimID)
{
Random rand = new Random();
LinkData link=dimHelper.instance.getRandomLinkData(false);
if(link==null)
{
link =new LinkData(0,0,0,0);
}
{
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2().replace("perm", ""));
}
if(dimHelper.getWorld(0)==null)
{
dimHelper.initDimension(0);
}
if(dimHelper.getWorld(0)!=null&&par5Entity instanceof EntityPlayer)
{
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);
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
z=z+(z>> 4);
public int quantityDropped(Random par1Random)
{
return 0;
}
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
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
dimHelper.instance.teleportToPocket(par1World, new LinkData(par1World.provider.dimensionId,0,x,y,z,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket,0),
EntityPlayer.class.cast(par5Entity));
/**
* Only matters if the player is in limbo, acts to teleport the player from limbo back to dim 0
*/
public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if(!par1World.isRemote&&par1World.provider.dimensionId==properties.LimboDimensionID)
{
Random rand = new Random();
EntityPlayer.class.cast(par5Entity).setPositionAndUpdate( x, y, z );
LinkData link=dimHelper.instance.getRandomLinkData(false);
if(link==null)
{
link =new LinkData(0,0,0,0);
}
//makes sure they can breath when they teleport
dimHelper.getWorld(0).setBlock(x, y, z, 0);
int i=x;
int j=y-1;
int k=z;
for(int xc=-3;xc<4;xc++)
if(dimHelper.getWorld(0)==null)
{
dimHelper.initDimension(0);
}
if(dimHelper.getWorld(0)!=null&&par5Entity instanceof EntityPlayer)
{
int x = (link.destXCoord + rand.nextInt(properties.LimboReturnRange)-properties.LimboReturnRange/2);
int z = (link.destZCoord + rand.nextInt(properties.LimboReturnRange)-properties.LimboReturnRange/2);
//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
dimHelper.instance.teleportToPocket(par1World, new LinkData(par1World.provider.dimensionId,0,x,y,z,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket,0),
EntityPlayer.class.cast(par5Entity));
EntityPlayer.class.cast(par5Entity).setPositionAndUpdate( x, y, z );
//makes sure they can breath when they teleport
dimHelper.getWorld(0).setBlock(x, y, z, 0);
int i=x;
int j=y-1;
int k=z;
for(int xc=-3;xc<4;xc++)
{
for(int zc=-3;zc<4;zc++)
{
@@ -100,15 +97,15 @@ public class BlockDimWallPerm extends Block
{
if(yc==0)
{
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);
}
}
@@ -117,15 +114,15 @@ public class BlockDimWallPerm extends Block
}
}
{
}
}
}
}
}
}
}
}

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,23 +25,23 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockRift extends BlockContainer
{
private static DDProperties properties = null;
public BlockRift(int i, int j, Material par2Material)
{
super(i, Material.air);
setTickRandomly(true);
// this.setCreativeTab(CreativeTabs.tabBlock);
this.setLightOpacity(14);
super(i, Material.air);
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());
}
{
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)
{
@@ -52,250 +53,250 @@ public class BlockRift extends BlockContainer
{
e.printStackTrace();
}
// this.updateTick(par1World, par2, par3, par4, new Random());
// this.updateTick(par1World, par2, par3, par4, new Random());
}
public boolean isCollidable()
{
return false;
}
public boolean isCollidable()
{
return false;
}
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
public boolean isOpaqueCube()
{
return false;
}
/**
* Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
*/
public boolean canCollideCheck(int par1, boolean par2)
{
return par2;
}
/**
* Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the
* adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side
*/
public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
//this doesnt do anything yet.
public int getRenderType()
{
if(mod_pocketDim.isPlayerWearingGoogles)
{
return 0;
}
return 8;
}
@SideOnly(Side.CLIENT)
/**
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return null;
}
//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)
{
TileEntityRift rift = (TileEntityRift) world.getBlockTileEntity(x, y, z);
if(rift.isNearRift)
{
int range=4;
float distance=range+range/4;
int i=-range;
int j=-range;
int k=-range;
boolean flag=true;
while (i<range&&flag)
{
while (j<range&&flag)
{
while (k<range&&flag)
{
if(!mod_pocketDim.blocksImmuneToRift.contains(world.getBlockId(x+i, y+j, z+k))&&MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance&&!world.isAirBlock(x+i, y+j, z+k))
{
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0&&random.nextInt(2)==0)
{
world.setBlock(x+i, y+j, z+k,0);
flag=random.nextBoolean()||random.nextBoolean();
}
}
k++;
}
k=-range;
j++;
}
j=-range;
i++;
}
}
}
}
/**
* regulates the render effect, especially when multiple rifts start to link up. Has 3 main parts- Grows toward and away from nearest rft, bends toward it, and a randomization function
*/
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random rand)
{
int count;
//growth in the direction towards the nearby rift
float xGrowth=0;
float yGrowth=0;
float zGrowth=0;
//growth away from the nearby rift
float xGrowthn=0;
float yGrowthn=0;
float zGrowthn=0;
//how far the particles are away from original rift. Used to decrease noise the farther they are away.
float xChange = 0;
float yChange = 0;
float zChange = 0;
TileEntityRift tile = (TileEntityRift)par1World.getBlockTileEntity(par2, par3, par4);
//the noise, ie, how far the rift particles are away from the intended location.
float offset=0;
float Xoffset=0;
float Yoffset=0;
float Zoffset=0;
for (count = 0; count < 12 && tile!=null; ++count)
{
//TODO change to a switch statement for clarity
if(tile.xOffset>0)
{
if(rand.nextInt(tile.xOffset)==0)
{
xGrowth =xGrowth+.15F*tile.xOffset;
}
}
else if(tile.xOffset<0)
{
if(rand.nextInt(-tile.xOffset)==0)
{
xGrowthn =xGrowthn-.15F*-tile.xOffset;
}
}
if(tile.yOffset>0)
{
if(rand.nextInt(tile.yOffset)==0)
{
yGrowth =yGrowth+.15F*tile.yOffset;
}
}
else if(tile.yOffset<0)
{
if(rand.nextInt(-tile.yOffset)==0)
{
yGrowthn =yGrowthn-.15F*-tile.yOffset;
}
}
if(tile.zOffset>0)
{
if(rand.nextInt(tile.zOffset)==0)
{
zGrowth =zGrowth+.15F*tile.zOffset;
}
}
else if(tile.zOffset<0)
{
if(rand.nextInt(-tile.zOffset)==0)
{
zGrowthn =zGrowthn-.15F*-tile.zOffset;
}
}
xChange=(float) ((xGrowth+xGrowthn)+rand.nextGaussian()*.05F);
yChange=(float) ((yGrowth+yGrowthn)+rand.nextGaussian()*.05F);
zChange=(float) ((zGrowth+zGrowthn)+rand.nextGaussian()*.05F);
offset= (float) ((0.2F/(1+Math.abs(xChange)+Math.abs(yChange)+Math.abs(zChange))));
Xoffset= (float) ((0.25F/(1+Math.abs(xChange))));
Yoffset= (float) ((0.25F/(1+Math.abs(yChange))));
Zoffset= (float) ((0.25F/(1+Math.abs(zChange))));
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5+xChange+Xoffset*rand.nextGaussian(), par3+.5+yChange+Yoffset*rand.nextGaussian() , par4+.5+zChange+Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer));
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5-xChange-Xoffset*rand.nextGaussian(), par3+.5-yChange-Yoffset*rand.nextGaussian() , par4+.5-zChange-Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer));
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
if(rand.nextBoolean())
{
//renders an extra little blob on top of the actual rift location so its easier to find. Eventually will only render if the player has the goggles.
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer));
}
if(tile.shouldClose)
{
//renders an opposite color effect if it is being closed by the rift remover
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer));
}
}
}
public int idPicked(World par1World, int par2, int par3, int par4)
{
return 0;
}
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
public boolean isOpaqueCube()
{
return false;
}
/**
* Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
*/
public boolean canCollideCheck(int par1, boolean par2)
{
return par2;
}
/**
* Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the
* adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side
*/
public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
//this doesnt do anything yet.
public int getRenderType()
{
if(mod_pocketDim.isPlayerWearingGoogles)
{
return 0;
}
return 8;
}
@SideOnly(Side.CLIENT)
/**
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return null;
}
//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 && properties.RiftGriefingEnabled)
{
TileEntityRift rift = (TileEntityRift) world.getBlockTileEntity(x, y, z);
if(rift.isNearRift)
{
int range=4;
float distance=range+range/4;
int i=-range;
int j=-range;
int k=-range;
boolean flag=true;
while (i<range&&flag)
{
while (j<range&&flag)
{
while (k<range&&flag)
{
if(!mod_pocketDim.blocksImmuneToRift.contains(world.getBlockId(x+i, y+j, z+k))&&MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)<distance&&!world.isAirBlock(x+i, y+j, z+k))
{
if(MathHelper.abs(i)+MathHelper.abs(j)+MathHelper.abs(k)!=0&&random.nextInt(2)==0)
{
world.setBlock(x+i, y+j, z+k,0);
flag=random.nextBoolean()||random.nextBoolean();
}
}
k++;
}
k=-range;
j++;
}
j=-range;
i++;
}
}
}
}
/**
* regulates the render effect, especially when multiple rifts start to link up. Has 3 main parts- Grows toward and away from nearest rft, bends toward it, and a randomization function
*/
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random rand)
{
int count;
//growth in the direction towards the nearby rift
float xGrowth=0;
float yGrowth=0;
float zGrowth=0;
//growth away from the nearby rift
float xGrowthn=0;
float yGrowthn=0;
float zGrowthn=0;
//how far the particles are away from original rift. Used to decrease noise the farther they are away.
float xChange = 0;
float yChange = 0;
float zChange = 0;
TileEntityRift tile = (TileEntityRift)par1World.getBlockTileEntity(par2, par3, par4);
//the noise, ie, how far the rift particles are away from the intended location.
float offset=0;
float Xoffset=0;
float Yoffset=0;
float Zoffset=0;
for (count = 0; count < 12 && tile!=null; ++count)
{
//TODO change to a switch statement for clarity
if(tile.xOffset>0)
{
if(rand.nextInt(tile.xOffset)==0)
{
xGrowth =xGrowth+.15F*tile.xOffset;
}
}
else if(tile.xOffset<0)
{
if(rand.nextInt(-tile.xOffset)==0)
{
xGrowthn =xGrowthn-.15F*-tile.xOffset;
}
}
if(tile.yOffset>0)
{
if(rand.nextInt(tile.yOffset)==0)
{
yGrowth =yGrowth+.15F*tile.yOffset;
}
}
else if(tile.yOffset<0)
{
if(rand.nextInt(-tile.yOffset)==0)
{
yGrowthn =yGrowthn-.15F*-tile.yOffset;
}
}
if(tile.zOffset>0)
{
if(rand.nextInt(tile.zOffset)==0)
{
zGrowth =zGrowth+.15F*tile.zOffset;
}
}
else if(tile.zOffset<0)
{
if(rand.nextInt(-tile.zOffset)==0)
{
zGrowthn =zGrowthn-.15F*-tile.zOffset;
}
}
xChange=(float) ((xGrowth+xGrowthn)+rand.nextGaussian()*.05F);
yChange=(float) ((yGrowth+yGrowthn)+rand.nextGaussian()*.05F);
zChange=(float) ((zGrowth+zGrowthn)+rand.nextGaussian()*.05F);
offset= (float) ((0.2F/(1+Math.abs(xChange)+Math.abs(yChange)+Math.abs(zChange))));
Xoffset= (float) ((0.25F/(1+Math.abs(xChange))));
Yoffset= (float) ((0.25F/(1+Math.abs(yChange))));
Zoffset= (float) ((0.25F/(1+Math.abs(zChange))));
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5+xChange+Xoffset*rand.nextGaussian(), par3+.5+yChange+Yoffset*rand.nextGaussian() , par4+.5+zChange+Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer));
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new RiftFX(par1World,par2+.5-xChange-Xoffset*rand.nextGaussian(), par3+.5-yChange-Yoffset*rand.nextGaussian() , par4+.5-zChange-Zoffset*rand.nextGaussian(), rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, rand.nextGaussian() * 0.001D, FMLClientHandler.instance().getClient().effectRenderer));
if(rand.nextBoolean())
{
//renders an extra little blob on top of the actual rift location so its easier to find. Eventually will only render if the player has the goggles.
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer));
}
if(tile.shouldClose)
{
//renders an opposite color effect if it is being closed by the rift remover
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(par1World,par2+.5, par3+.5, par4+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer));
}
}
}
public int idPicked(World par1World, int par2, int par3, int par4)
{
return 0;
}
public int idDropped(int par1, Random par2Random, int par3)
{
return 0;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
// TODO Auto-generated method stub
return new TileEntityRift();
}
}

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>();
@@ -363,27 +367,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++;
}
@@ -411,11 +415,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)
@@ -296,16 +278,11 @@ public class dimHelper extends DimensionManager
WorldServer.class.cast(newWorld).getChunkProvider().loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
}
mod_pocketDim.teleporter.placeInPortal(entity, newWorld, link);
return entity;
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,28 +292,23 @@ public class dimHelper extends DimensionManager
*/
public void teleportToPocket(World world,LinkData linkData, Entity entity)
{
if(world.isRemote)
DDProperties properties = DDProperties.instance();
if (world.isRemote)
{
return;
}
if(linkData!=null)
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))
if(this.dimList.containsKey(destinationID) && this.dimList.containsKey(world.provider.dimensionId))
{
this.generatePocket(linkData);
@@ -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,21 +442,15 @@ 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))
{
DimData locationDimData= new DimData(link.locDimID, false, 0, link.locDimID,link.locXCoord,link.locYCoord,link.locZCoord);
@@ -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)
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,8 +21,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemStabilizedRiftSignature extends itemLinkSignature
{
private Material doorMaterial;
private static DDProperties properties = null;
public ItemStabilizedRiftSignature(int par)
{
super(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)
{
@@ -78,9 +76,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)
{
@@ -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;
}
flag = false;
}
return flag;
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,7 +35,11 @@ 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
@@ -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,173 +93,85 @@ 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 dimDoor;
public static Block blockDimWall;
public static Block dimHatch;
public static Block blockDimWallPerm;
public static Item itemRiftBlade;
public static Item itemDimDoor;
public static Item itemExitDoor;
public static Item itemRiftRemover;
public static Item itemLinkSignature;
public static Item itemStableFabric;
public static Item itemChaosDoor;
public static Item itemStabilizedLinkSignature;
public static Item itemRiftBlade;
public static Item itemDimDoor;
public static Item itemExitDoor;
public static Item itemRiftRemover;
public static Item itemLinkSignature;
public static Item itemStableFabric;
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;
public static PlayerRespawnTracker tracker= new PlayerRespawnTracker();
public static HashMap<String,ArrayList<EntityItem>> limboSpawnInventory = new HashMap<String,ArrayList<EntityItem>>();
public static HashMap<String,ArrayList<EntityItem>> limboSpawnInventory=new HashMap<String,ArrayList<EntityItem>>();
public static ArrayList<Integer> blocksImmuneToRift = new ArrayList<Integer>();
public static ArrayList<Integer> blocksImmuneToRift= new ArrayList<Integer>();
public static boolean hasInitDims = false;
public static boolean isPlayerWearingGoogles = false;
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();
//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();
Configuration config = new Configuration(configFile);
DimDoorsConfig.loadConfig(configFile);
String schematicDir = configFile.getParent()+"/DimDoors_Custom_schematics";
this.schematicContainer=schematicDir;
File file= new File(schematicDir);
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();
File file= new File(properties.CustomSchematicDirectory);
file.mkdir();
String helpFile = "/mods/DimDoors/How_to_add_dungeons.txt";
@@ -270,70 +180,45 @@ 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").setResistance(50F);
blockDimWallPerm = (new BlockDimWallPerm(blockDimWallPermID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(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,28 +227,21 @@ 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");
LanguageRegistry.addName(dimHatch, "Transdimensional Trapdoor");
LanguageRegistry.addName(itemExitDoor , "Warp Door");
LanguageRegistry.addName(itemExitDoor, "Warp Door");
LanguageRegistry.addName(itemLinkSignature , "Rift Signature");
LanguageRegistry.addName(itemStabilizedLinkSignature, "Stabilized Rift Signature");
LanguageRegistry.addName(itemRiftRemover , "Rift Remover");
@@ -381,17 +259,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 +276,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 +295,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 +311,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 +323,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 +335,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 +347,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
});
}
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)
if (properties.CraftingStableFabricAllowed)
{
GameRegistry.addRecipe(new ItemStack(this.itemStabilizedLinkSignature,1), new Object[]
GameRegistry.addRecipe(new ItemStack(itemStableFabric, 4), new Object[]
{
" y ", "yxy", " y ", 'x', this.itemLinkSignature, 'y', this.itemStableFabric
" y ", "yxy", " y ", 'x', Item.enderPearl, 'y', mod_pocketDim.blockDimWall
});
}
if (properties.CraftingStabilizedRiftSignatureAllowed)
{
GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStabilizedLinkSignature,1), new Object[]
{
" y ", "yxy", " y ", 'x', mod_pocketDim.itemLinkSignature, 'y', mod_pocketDim.itemStableFabric
});
}
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);
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 +408,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 +425,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,21 +37,22 @@ 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);
this.noClip=true;
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()
{
@@ -63,79 +65,72 @@ public class MobObelisk extends EntityFlying implements IMob
// TODO Auto-generated method stub
return 20;
}
public boolean canBePushed()
{
return false;
}
public float getRenderSizeModifier()
{
return this.scaleFactor;
}
public void setEntityPosition(Entity entity, double x, double y, double z)
{
entity.lastTickPosX = entity.prevPosX = entity.posX = x;
entity.lastTickPosY = entity.prevPosY = entity.posY = y + (double)entity.yOffset;
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z;
entity.setPosition(x, y, z);
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
public float getRenderSizeModifier()
{
return this.scaleFactor;
}
public void setEntityPosition(Entity entity, double x, double y, double z)
{
entity.lastTickPosX = entity.prevPosX = entity.posX = x;
entity.lastTickPosY = entity.prevPosY = entity.posY = y + (double)entity.yOffset;
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z;
entity.setPosition(x, y, z);
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
@Override
public void onEntityUpdate()
{
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
this.texture="/mods/DimDoors/textures/mobs/Monolith"+b0+".png";
if(!this.hasJumped&&!this.worldObj.isRemote)
{
int sanity=0;
double jumpHeight=0;
do
{
jumpHeight = this.posY+rand.nextInt(25);
if(this.worldObj.provider instanceof pocketProvider)
{
jumpHeight = jumpHeight- rand.nextInt(10);
}
sanity++;
}
while(!this.worldObj.isAirBlock((int)this.posX,(int)jumpHeight+6 , (int)this.posZ)&&sanity<20);
this.hasJumped=true;
this.setLocationAndAngles(this.posX,jumpHeight , this.posZ, this.rotationPitch, this.rotationYaw);
PacketDispatcher.sendPacketToAllInDimension(new Packet34EntityTeleport(this), this.worldObj.provider.dimensionId);
this.worldObj.updateEntity(this);
}
this.texture="/mods/DimDoors/textures/mobs/Monolith"+b0+".png";
if(!this.hasJumped&&!this.worldObj.isRemote)
{
int sanity=0;
double jumpHeight=0;
do
{
jumpHeight = this.posY+rand.nextInt(25);
if(this.worldObj.provider instanceof pocketProvider)
{
jumpHeight = jumpHeight- rand.nextInt(10);
}
sanity++;
}
while(!this.worldObj.isAirBlock((int)this.posX,(int)jumpHeight+6 , (int)this.posZ)&&sanity<20);
this.hasJumped=true;
this.setLocationAndAngles(this.posX,jumpHeight , this.posZ, this.rotationPitch, this.rotationYaw);
PacketDispatcher.sendPacketToAllInDimension(new Packet34EntityTeleport(this), this.worldObj.provider.dimensionId);
this.worldObj.updateEntity(this);
}
super.onEntityUpdate();
if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock())
{
this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D);
this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D);
this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D);
this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D);
}
if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock())
{
this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D);
this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D);
this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D);
this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D);
}
EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 35);
if(entityPlayer != null)
@@ -145,15 +140,15 @@ public class MobObelisk extends EntityFlying implements IMob
this.playSound("mods.DimDoors.sfx.monk", 1.5F, 1F);
this.soundTime=100;
}
this.faceEntity(entityPlayer, 1, 1);
if(shouldAttackPlayer(entityPlayer))
{
{
}
if(aggro<470)
{
@@ -161,19 +156,19 @@ public class MobObelisk extends EntityFlying implements IMob
{
aggro++;
}
if(this.worldObj.provider instanceof pocketProvider||this.worldObj.getClosestPlayerToEntity(this, 5)!=null)
{
aggro++;
aggro++;
if(rand.nextBoolean())
{
aggro++;
}
}
if(aggro>430)
{
@@ -185,18 +180,18 @@ public class MobObelisk extends EntityFlying implements IMob
this.worldObj.playSoundAtEntity(entityPlayer,"mods.DimDoors.sfx.tearing",5, 1);
}
}
else if(!this.worldObj.isRemote&&!entityPlayer.capabilities.isCreativeMode)
{
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;
@@ -207,20 +202,20 @@ public class MobObelisk extends EntityFlying implements IMob
this.setDead();
}
}
if(!(this.worldObj.provider instanceof LimboProvider || this.worldObj.getClosestPlayerToEntity(this, 5)!=null)||this.aggro>300)
{
for (int i = 0; i < -1+this.textureState/2; ++i)
{
entityPlayer.worldObj.spawnParticle("portal", entityPlayer.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, entityPlayer.posY + this.rand.nextDouble() * (double)entityPlayer.height - 0.75D, entityPlayer.posZ + (this.rand.nextDouble() - 0.5D) * (double)entityPlayer.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
}
for (int i = 0; i < -1+this.textureState/2; ++i)
{
entityPlayer.worldObj.spawnParticle("portal", entityPlayer.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, entityPlayer.posY + this.rand.nextDouble() * (double)entityPlayer.height - 0.75D, entityPlayer.posZ + (this.rand.nextDouble() - 0.5D) * (double)entityPlayer.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
}
}
}
else
{
@@ -230,19 +225,19 @@ public class MobObelisk extends EntityFlying implements IMob
{
aggro--;
}
}
}
}
else
{
if(aggro>0)
{
aggro--;
if(rand.nextBoolean())
{
aggro--;
@@ -253,7 +248,7 @@ public class MobObelisk extends EntityFlying implements IMob
{
soundTime--;
}
if(this.prevPosX==this.posX||this.prevPosY==this.posY||this.prevPosZ==this.posZ)
{
do
@@ -261,13 +256,13 @@ public class MobObelisk extends EntityFlying implements IMob
destX= rand.nextInt(40)-20;
destY= rand.nextInt(40)-20;
destZ= rand.nextInt(40)-20;
}
while(!this.isCourseTraversable(destX, destY, destZ, 1));
}
if(Math.abs(this.posX)-Math.abs(this.destX)+Math.abs(this.posY)-Math.abs(this.destY)+Math.abs(this.posZ)-Math.abs(this.destZ)<5)
{
do
@@ -275,38 +270,138 @@ public class MobObelisk extends EntityFlying implements IMob
destX= rand.nextInt(40)-20;
destY= rand.nextInt(40)-20;
destZ= rand.nextInt(40)-20;
}
while(!this.isCourseTraversable(destX, destY, destZ, 1));
}
{
}
this.textureState= (byte) (this.aggro/25);
if(!this.worldObj.isRemote)
{
this.dataWatcher.updateObject(16, Byte.valueOf(this.textureState));
}
this.textureState= (byte) (this.aggro/25);
if(!this.worldObj.isRemote)
{
this.dataWatcher.updateObject(16, Byte.valueOf(this.textureState));
}
}
private boolean shouldAttackPlayer(EntityPlayer par1EntityPlayer)
{
return par1EntityPlayer.canEntityBeSeen(this);
}
private boolean isCourseTraversable(double par1, double par3, double par5, double par7)
{
double d4 = (par1 - this.posX) / par7;
double d5 = (par3 - this.posY) / par7;
double d6 = (par5 - this.posZ) / par7;
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
for (int i = 1; (double)i < par7; ++i)
{
axisalignedbb.offset(d4, d5, d6);
if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty())
{
return false;
}
}
return true;
}
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
if(!(par1DamageSource==DamageSource.inWall))
{
this.aggro=400;
}
return false;
}
public void faceEntity(Entity par1Entity, float par2, float par3)
{
double d0 = par1Entity.posX - this.posX;
double d1 = par1Entity.posZ - this.posZ;
double d2;
if (par1Entity instanceof EntityLiving)
{
EntityLiving entityliving = (EntityLiving)par1Entity;
d2 = entityliving.posY + (double)entityliving.getEyeHeight() - (this.posY + (double)this.getEyeHeight());
}
else
{
d2 = (par1Entity.boundingBox.minY + par1Entity.boundingBox.maxY) - (this.posY + (double)this.getEyeHeight());
}
double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d1 * d1);
float f2 = (float)(Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float)(-(Math.atan2(d2, d3) * 180.0D / Math.PI));
this.rotationPitch = f3;
this.rotationYaw = f2;
this.rotationYaw = f2;
this.rotationYawHead=f2;
this.renderYawOffset=this.rotationYaw;
}
private float updateRotation(float par1, float par2, float par3)
{
float f3 = MathHelper.wrapAngleTo180_float(par2 - par1);
if (f3 > par3)
{
f3 = par3;
}
if (f3 < -par3)
{
f3 = -par3;
}
return par1 + f3;
}
public float getRotationYawHead()
{
return 0.0F;
}
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setFloat("soundTime", this.soundTime);
par1NBTTagCompound.setInteger("aggro", this.aggro);
par1NBTTagCompound.setInteger("aggroMax", this.aggroMax);
par1NBTTagCompound.setByte("textureState", this.textureState);
par1NBTTagCompound.setBoolean("hasJumped", this.hasJumped);
par1NBTTagCompound.setFloat("scaleFactor", this.scaleFactor);
}
public boolean getCanSpawnHere()
{
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==DDProperties.instance().LimboDimensionID)
{
return false;
}
@@ -317,120 +412,7 @@ public class MobObelisk extends EntityFlying implements IMob
return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox);
}
private boolean shouldAttackPlayer(EntityPlayer par1EntityPlayer)
{
return par1EntityPlayer.canEntityBeSeen(this);
}
private boolean isCourseTraversable(double par1, double par3, double par5, double par7)
{
double d4 = (par1 - this.posX) / par7;
double d5 = (par3 - this.posY) / par7;
double d6 = (par5 - this.posZ) / par7;
AxisAlignedBB axisalignedbb = this.boundingBox.copy();
for (int i = 1; (double)i < par7; ++i)
{
axisalignedbb.offset(d4, d5, d6);
if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty())
{
return false;
}
}
return true;
}
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
if(!(par1DamageSource==DamageSource.inWall))
{
this.aggro=400;
}
return false;
}
public void faceEntity(Entity par1Entity, float par2, float par3)
{
double d0 = par1Entity.posX - this.posX;
double d1 = par1Entity.posZ - this.posZ;
double d2;
if (par1Entity instanceof EntityLiving)
{
EntityLiving entityliving = (EntityLiving)par1Entity;
d2 = entityliving.posY + (double)entityliving.getEyeHeight() - (this.posY + (double)this.getEyeHeight());
}
else
{
d2 = (par1Entity.boundingBox.minY + par1Entity.boundingBox.maxY) - (this.posY + (double)this.getEyeHeight());
}
double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d1 * d1);
float f2 = (float)(Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float)(-(Math.atan2(d2, d3) * 180.0D / Math.PI));
this.rotationPitch = f3;
this.rotationYaw = f2;
this.rotationYaw = f2;
this.rotationYawHead=f2;
this.renderYawOffset=this.rotationYaw;
}
private float updateRotation(float par1, float par2, float par3)
{
float f3 = MathHelper.wrapAngleTo180_float(par2 - par1);
if (f3 > par3)
{
f3 = par3;
}
if (f3 < -par3)
{
f3 = -par3;
}
return par1 + f3;
}
public float getRotationYawHead()
{
return 0.0F;
}
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setFloat("soundTime", this.soundTime);
par1NBTTagCompound.setInteger("aggro", this.aggro);
par1NBTTagCompound.setInteger("aggroMax", this.aggroMax);
par1NBTTagCompound.setByte("textureState", this.textureState);
par1NBTTagCompound.setBoolean("hasJumped", this.hasJumped);
par1NBTTagCompound.setFloat("scaleFactor", this.scaleFactor);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
this.soundTime=par1NBTTagCompound.getFloat("soundTime");
this.aggro=par1NBTTagCompound.getInteger("aggro");
this.aggroMax=par1NBTTagCompound.getInteger("aggroMax");
this.textureState=par1NBTTagCompound.getByte("textureState");
this.hasJumped=par1NBTTagCompound.getBoolean("hasJumped");
this.scaleFactor=par1NBTTagCompound.getFloat("scaleFactor");
}
}

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,111 +29,111 @@ 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;
/** A NoiseGeneratorOctaves used in generating terrain */
private NoiseGeneratorOctaves noiseGen1;
/** A NoiseGeneratorOctaves used in generating terrain */
private NoiseGeneratorOctaves noiseGen2;
/** A NoiseGeneratorOctaves used in generating terrain */
private NoiseGeneratorOctaves noiseGen2;
/** A NoiseGeneratorOctaves used in generating terrain */
private NoiseGeneratorOctaves noiseGen3;
/** A NoiseGeneratorOctaves used in generating terrain */
private NoiseGeneratorOctaves noiseGen3;
/** A NoiseGeneratorOctaves used in generating terrain */
private NoiseGeneratorOctaves noiseGen4;
/** A NoiseGeneratorOctaves used in generating terrain */
private NoiseGeneratorOctaves noiseGen4;
/** A NoiseGeneratorOctaves used in generating terrain */
public NoiseGeneratorOctaves noiseGen5;
public World world;
private final byte[] field_82700_c = new byte[256];
private final byte[] field_82698_d = new byte[256];
/** A NoiseGeneratorOctaves used in generating terrain */
public NoiseGeneratorOctaves noiseGen5;
/** A NoiseGeneratorOctaves used in generating terrain */
public NoiseGeneratorOctaves noiseGen6;
public NoiseGeneratorOctaves mobSpawnerNoise;
public World world;
private final byte[] field_82700_c = new byte[256];
private final byte[] field_82698_d = new byte[256];
/** Reference to the World object. */
private World worldObj;
/** A NoiseGeneratorOctaves used in generating terrain */
public NoiseGeneratorOctaves noiseGen6;
public NoiseGeneratorOctaves mobSpawnerNoise;
/** are map structures going to be generated (e.g. strongholds) */
private final boolean mapFeaturesEnabled = false;
/** Reference to the World object. */
private World worldObj;
/** Holds the overall noise array used in chunk generation */
private double[] noiseArray;
private double[] stoneNoise = new double[256];
private MapGenBase caveGenerator = new CustomCaveGen();
/** are map structures going to be generated (e.g. strongholds) */
private final boolean mapFeaturesEnabled = false;
/** Holds Stronghold Generator */
private MapGenStronghold strongholdGenerator = new MapGenStronghold();
/** Holds the overall noise array used in chunk generation */
private double[] noiseArray;
private double[] stoneNoise = new double[256];
private MapGenBase caveGenerator = new CustomCaveGen();
/** Holds Village Generator */
private MapGenVillage villageGenerator = new MapGenVillage();
/** Holds Stronghold Generator */
private MapGenStronghold strongholdGenerator = new MapGenStronghold();
/** Holds Mineshaft Generator */
private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
/** Holds Village Generator */
private MapGenVillage villageGenerator = new MapGenVillage();
/** Holds ravine generator */
private MapGenBase ravineGenerator = new MapGenRavine();
/** Holds Mineshaft Generator */
private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
/** The biomes that are used to generate the chunk */
private BiomeGenBase[] biomesForGeneration = new BiomeGenBase[1];
/** Holds ravine generator */
private MapGenBase ravineGenerator = new MapGenRavine();
/** A double array that hold terrain noise from noiseGen3 */
double[] noise3;
/** The biomes that are used to generate the chunk */
private BiomeGenBase[] biomesForGeneration = new BiomeGenBase[1];
/** A double array that hold terrain noise */
double[] noise1;
/** A double array that hold terrain noise from noiseGen3 */
double[] noise3;
/** A double array that hold terrain noise from noiseGen2 */
double[] noise2;
/** A double array that hold terrain noise */
double[] noise1;
/** A double array that hold terrain noise from noiseGen5 */
double[] noise5;
/** A double array that hold terrain noise from noiseGen2 */
double[] noise2;
/** A double array that holds terrain noise from noiseGen6 */
double[] noise6;
/** A double array that hold terrain noise from noiseGen5 */
double[] noise5;
/**
* Used to store the 5x5 parabolic field that is used during terrain generation.
*/
float[] parabolicField;
int[][] field_73219_j = new int[32][32];
{
// caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
}
/** A double array that holds terrain noise from noiseGen6 */
double[] noise6;
/**
* Used to store the 5x5 parabolic field that is used during terrain generation.
*/
float[] parabolicField;
int[][] field_73219_j = new int[32][32];
{
// caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
}
private static DDProperties properties = null;
public LimboGenerator(World par1World, long par2)
{
super(par1World, par2, false);
//par2 = 90899090;
this.rand = new Random(par2);
this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); //base terrain
this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); //hillyness
this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 80); //seems to adjust the size of features, how stretched things are -default 8
this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4);
this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
this.rand = new Random(par2);
this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); //base terrain
this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); //hillyness
this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 80); //seems to adjust the size of features, how stretched things are -default 8
this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4);
this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise};
// noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens);
this.noiseGen1 = noiseGens[0];
this.noiseGen2 = noiseGens[1];
this.noiseGen3 = noiseGens[2];
this.noiseGen4 = noiseGens[3];
this.noiseGen5 = noiseGens[4];
this.noiseGen6 = noiseGens[5];
this.mobSpawnerNoise = noiseGens[6];
NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise};
// noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens);
this.noiseGen1 = noiseGens[0];
this.noiseGen2 = noiseGens[1];
this.noiseGen3 = noiseGens[2];
this.noiseGen4 = noiseGens[3];
this.noiseGen5 = noiseGens[4];
this.noiseGen6 = noiseGens[5];
this.mobSpawnerNoise = noiseGens[6];
// TODO Auto-generated constructor stub
this.worldObj=par1World;
if (properties == null)
properties = DDProperties.instance();
}
@Override
@@ -142,27 +143,27 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
}
@Override
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
{
}
{
}
@Override
public Chunk provideChunk(int par1, int par2)
{
{
this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
byte[] var3 = new byte[32768];
this.generateTerrain(par1, par2, var3);
this.caveGenerator.generate(this, this.worldObj, par1, par2, var3);
byte[] var3 = new byte[32768];
this.generateTerrain(par1, par2, var3);
this.caveGenerator.generate(this, this.worldObj, par1, par2, var3);
Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);
var4.generateSkylightMap();
return var4;
}
Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);
var4.generateSkylightMap();
return var4;
}
@Override
public Chunk loadChunk(int var1, int var2) {
// TODO Auto-generated method stub
@@ -173,7 +174,7 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
public void populate(IChunkProvider var1, int var2, int var3)
{
// TODO Auto-generated method stub
}
@Override
@@ -181,229 +182,229 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
// TODO Auto-generated method stub
return super.saveChunks(var1, var2);
}
private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7)
{
ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7);
MinecraftForge.EVENT_BUS.post(event);
if (event.getResult() == Result.DENY) return event.noisefield;
private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7)
{
ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7);
MinecraftForge.EVENT_BUS.post(event);
if (event.getResult() == Result.DENY) return event.noisefield;
if (par1ArrayOfDouble == null)
{
par1ArrayOfDouble = new double[par5 * par6 * par7];
}
if (par1ArrayOfDouble == null)
{
par1ArrayOfDouble = new double[par5 * par6 * par7];
}
if (this.parabolicField == null)
{
this.parabolicField = new float[25];
if (this.parabolicField == null)
{
this.parabolicField = new float[25];
for (int var8 = -2; var8 <= 2; ++var8)
{
for (int var9 = -2; var9 <= 2; ++var9)
{
float var10 = 10.0F / MathHelper.sqrt_float((float)(var8 * var8 + var9 * var9) + 0.2F);
this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10;
}
}
}
for (int var8 = -2; var8 <= 2; ++var8)
{
for (int var9 = -2; var9 <= 2; ++var9)
{
float var10 = 10.0F / MathHelper.sqrt_float((float)(var8 * var8 + var9 * var9) + 0.2F);
this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10;
}
}
}
double var44 = 884.412D; //large values here create spiky land. add a 0, good -default 884
double var45 = 9840.412D; //large values here make sheets- default - 684
this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D);
this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D);
this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2, par3, par4, par5, par6, par7, var44 / 80.0D, var45 / 160.0D, var44 / 80.0D);
this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, var44, var45, var44);
this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, var44, var45, var44);
boolean var43 = false;
boolean var42 = false;
int var12 = 0;
int var13 = 0;
double var44 = 884.412D; //large values here create spiky land. add a 0, good -default 884
double var45 = 9840.412D; //large values here make sheets- default - 684
this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D);
this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D);
this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2, par3, par4, par5, par6, par7, var44 / 80.0D, var45 / 160.0D, var44 / 80.0D);
this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, var44, var45, var44);
this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, var44, var45, var44);
boolean var43 = false;
boolean var42 = false;
int var12 = 0;
int var13 = 0;
for (int var14 = 0; var14 < par5; ++var14)
{
for (int var15 = 0; var15 < par7; ++var15)
{
float var16 = 0.0F;
float var17 = 0.0F;
float var18 = 0.0F;
byte var19 = 2;
BiomeGenBase var20 = this.biomesForGeneration[var14 + 2 + (var15 + 2) * (par5 + 5)];
for (int var14 = 0; var14 < par5; ++var14)
{
for (int var15 = 0; var15 < par7; ++var15)
{
float var16 = 0.0F;
float var17 = 0.0F;
float var18 = 0.0F;
byte var19 = 2;
BiomeGenBase var20 = this.biomesForGeneration[var14 + 2 + (var15 + 2) * (par5 + 5)];
for (int var21 = -var19; var21 <= var19; ++var21)
{
for (int var22 = -var19; var22 <= var19; ++var22)
{
float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.minHeight + 9.0F);
for (int var21 = -var19; var21 <= var19; ++var21)
{
for (int var22 = -var19; var22 <= var19; ++var22)
{
float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.minHeight + 9.0F);
//this adjusts the height of the terrain
var16 += BiomeGenBase.plains.maxHeight * var24+4;
var17 += BiomeGenBase.plains.minHeight * var24-1;
var18 += var24;
}
}
var16 /= var18;
var17 /= var18;
var16 = (var16 * 0.9F + 0.1F);
var17 = (var17 * 4.0F - 1.0F) / 8.0F;
double var47 = this.noise6[var13] / 8000.0D;
//this adjusts the height of the terrain
if (var47 < 0.0D)
{
var47 = -var47 * 0.3D;
}
var16 += BiomeGenBase.plains.maxHeight * var24+4;
var17 += BiomeGenBase.plains.minHeight * var24-1;
var18 += var24;
}
}
var47 = var47 * 3.0D - 2.0D;
var16 /= var18;
var17 /= var18;
var16 = (var16 * 0.9F + 0.1F);
var17 = (var17 * 4.0F - 1.0F) / 8.0F;
double var47 = this.noise6[var13] / 8000.0D;
if (var47 < 0.0D)
{
var47 /= 2.0D;
if (var47 < 0.0D)
{
var47 = -var47 * 0.3D;
}
if (var47 < -1.0D)
{
var47 = -1.0D;
}
var47 = var47 * 3.0D - 2.0D;
var47 /= 1.4D;
var47 /= 2.0D;
}
else
{
if (var47 > 1.0D)
{
var47 = 1.0D;
}
if (var47 < 0.0D)
{
var47 /= 2.0D;
var47 /= 8.0D;
}
if (var47 < -1.0D)
{
var47 = -1.0D;
}
++var13;
var47 /= 1.4D;
var47 /= 2.0D;
}
else
{
if (var47 > 1.0D)
{
var47 = 1.0D;
}
for (int var46 = 0; var46 < par6; ++var46)
{
double var48 = (double)var17;
double var26 = (double)var16;
var48 += var47 * 0.2D;
var48 = var48 * (double)par6 / 16.0D;
double var28 = (double)par6 / 2.0D + var48 * 4.0D;
double var30 = 0.0D;
double var32 = ((double)var46 - var28) * 12.0D * 128.0D / 128.0D / var26;
var47 /= 8.0D;
}
if (var32 < 0.0D)
{
var32 *= 4.0D;
}
++var13;
double var34 = this.noise1[var12] / 512.0D;
double var36 = this.noise2[var12] / 512.0D;
double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D;
for (int var46 = 0; var46 < par6; ++var46)
{
double var48 = (double)var17;
double var26 = (double)var16;
var48 += var47 * 0.2D;
var48 = var48 * (double)par6 / 16.0D;
double var28 = (double)par6 / 2.0D + var48 * 4.0D;
double var30 = 0.0D;
double var32 = ((double)var46 - var28) * 12.0D * 128.0D / 128.0D / var26;
if (var38 < 0.0D)
{
var30 = var34;
}
else if (var38 > 1.0D)
{
var30 = var36;
}
else
{
var30 = var34 + (var36 - var34) * var38;
}
if (var32 < 0.0D)
{
var32 *= 4.0D;
}
var30 -= var32;
double var34 = this.noise1[var12] / 512.0D;
double var36 = this.noise2[var12] / 512.0D;
double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D;
if (var46 > par6 - 4)
{
double var40 = (double)((float)(var46 - (par6 - 4)) / 3.0F);
var30 = var30 * (1.0D - var40) + -10.0D * var40;
}
if (var38 < 0.0D)
{
var30 = var34;
}
else if (var38 > 1.0D)
{
var30 = var36;
}
else
{
var30 = var34 + (var36 - var34) * var38;
}
par1ArrayOfDouble[var12] = var30;
++var12;
}
}
}
var30 -= var32;
return par1ArrayOfDouble;
}
if (var46 > par6 - 4)
{
double var40 = (double)((float)(var46 - (par6 - 4)) / 3.0F);
var30 = var30 * (1.0D - var40) + -10.0D * var40;
}
par1ArrayOfDouble[var12] = var30;
++var12;
}
}
}
return par1ArrayOfDouble;
}
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte)
{
byte var4 = 4;
byte var5 = 16;
byte var6 = 19;
int var7 = var4 + 1;
byte var8 = 17;
int var9 = var4 + 1;
this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, var7 + 5, var9 + 5);
this.noiseArray = this.initializeNoiseField(this.noiseArray, par1 * var4, 0, par2 * var4, var7, var8, var9);
{
byte var4 = 4;
byte var5 = 16;
byte var6 = 19;
int var7 = var4 + 1;
byte var8 = 17;
int var9 = var4 + 1;
this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, var7 + 5, var9 + 5);
this.noiseArray = this.initializeNoiseField(this.noiseArray, par1 * var4, 0, par2 * var4, var7, var8, var9);
for (int var10 = 0; var10 < var4; ++var10)
{
for (int var11 = 0; var11 < var4; ++var11)
{
for (int var12 = 0; var12 < var5; ++var12)
{
double var13 = 0.125D;
double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0];
double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0];
double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0];
double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0];
double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13;
double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13;
double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13;
double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13;
for (int var10 = 0; var10 < var4; ++var10)
{
for (int var11 = 0; var11 < var4; ++var11)
{
for (int var12 = 0; var12 < var5; ++var12)
{
double var13 = 0.125D;
double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0];
double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0];
double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0];
double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0];
double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13;
double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13;
double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13;
double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13;
for (int var31 = 0; var31 < 8; ++var31)
{
double var32 = 0.25D;
double var34 = var15;
double var36 = var17;
double var38 = (var19 - var15) * var32;
double var40 = (var21 - var17) * var32;
for (int var31 = 0; var31 < 8; ++var31)
{
double var32 = 0.25D;
double var34 = var15;
double var36 = var17;
double var38 = (var19 - var15) * var32;
double var40 = (var21 - var17) * var32;
for (int var42 = 0; var42 < 4; ++var42)
{
int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 8 + var31;
short var44 = 128;
var43 -= var44;
double var45 = 0.25D;
double var49 = (var36 - var34) * var45;
double var47 = var34 - var49;
for (int var42 = 0; var42 < 4; ++var42)
{
int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 8 + var31;
short var44 = 128;
var43 -= var44;
double var45 = 0.25D;
double var49 = (var36 - var34) * var45;
double var47 = var34 - var49;
for (int var51 = 0; var51 < 4; ++var51)
{
if ((var47 += var49) > 0.0D)
{
par3ArrayOfByte[var43 += var44] = (byte)mod_pocketDim.blockLimboID;
}
else if (var12 * 8 + var31 < var6)
{
par3ArrayOfByte[var43 += var44] = (byte)mod_pocketDim.blockDimWallPermID;
}
else
{
par3ArrayOfByte[var43 += var44] = 0;
}
}
for (int var51 = 0; var51 < 4; ++var51)
{
if ((var47 += var49) > 0.0D)
{
par3ArrayOfByte[var43 += var44] = (byte)properties.LimboBlockID;
}
else if (var12 * 8 + var31 < var6)
{
par3ArrayOfByte[var43 += var44] = (byte)properties.PermaFabricBlockID;
}
var34 += var38;
var36 += var40;
}
else
{
par3ArrayOfByte[var43 += var44] = 0;
}
}
var34 += var38;
var36 += var40;
}
var15 += var23;
var17 += var25;
var19 += var27;
var21 += var29;
}
}
}
}
}
var15 += var23;
var17 += var25;
var19 += var27;
var21 += var29;
}
}
}
}
}
@Override
public boolean canSave() {
// TODO Auto-generated method stub
@@ -417,12 +418,12 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
}
@Override
public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
{
BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4);
return biomegenbase == null ? null : (biomegenbase == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType));
}
public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
{
BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4);
return biomegenbase == null ? null : (biomegenbase == BiomeGenBase.swampland && par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType));
}
@Override
public ChunkPosition findClosestStructure(World var1, String var2,
@@ -440,7 +441,7 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
@Override
public void recreateStructures(int var1, int var2) {
// TODO Auto-generated method stub
}
}

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,182 +8,175 @@ 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 IRenderHandler skyRenderer;
private DDProperties properties = null;
public LimboProvider()
{
this.hasNoSky=false;
this.skyRenderer =new limboSkyProvider();
this.hasNoSky = false;
this.skyRenderer = new limboSkyProvider();
if (properties == null)
properties = DDProperties.instance();
}
@SideOnly(Side.CLIENT)
public IRenderHandler getSkyRenderer()
{
return this.skyRenderer;
}
@Override
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1);
//this.dimensionId = ConfigAtum.dimensionID;
}
@Override
public BiomeGenBase getBiomeGenForCoords(int x, int z)
{
return mod_pocketDim.limboBiome;
}
public boolean canRespawnHere()
{
return properties.HardcoreLimboEnabled && properties.LimboEnabled;
}
public boolean isBlockHighHumidity(int x, int y, int z)
{
return false;
}
@Override
public boolean canSnowAt(int x, int y, int z)
{
return false;
}
@SideOnly(Side.CLIENT)
public IRenderHandler getSkyRenderer()
{
return this.skyRenderer;
}
@Override
protected void registerWorldChunkManager()
{
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1);
//this.dimensionId = ConfigAtum.dimensionID;
}
@Override
public BiomeGenBase getBiomeGenForCoords(int x, int z)
protected void generateLightBrightnessTable()
{
float modifier = 0.0F;
for (int steps = 0; steps <= 15; ++steps)
{
return mod_pocketDim.limboBiome;
float var3 = 1.0F - (float)steps / 15.0F;
this.lightBrightnessTable[steps] = ((0.0F + var3) / (var3 * 3.0F + 1.0F) * (1.0F - modifier) + modifier)*3;
// System.out.println( this.lightBrightnessTable[steps]+"light");
}
public boolean canRespawnHere()
{
return mod_pocketDim.hardcoreLimbo&&mod_pocketDim.isLimboActive;
}
public boolean isBlockHighHumidity(int x, int y, int z)
{
return false;
}
@Override
public boolean canSnowAt(int x, int y, int z)
{
return false;
}
@Override
protected void generateLightBrightnessTable()
{
float modifier = 0.0F;
}
for (int steps = 0; steps <= 15; ++steps)
{
float var3 = 1.0F - (float)steps / 15.0F;
this.lightBrightnessTable[steps] = ((0.0F + var3) / (var3 * 3.0F + 1.0F) * (1.0F - modifier) + modifier)*3;
// System.out.println( this.lightBrightnessTable[steps]+"light");
}
}
public ChunkCoordinates getSpawnPoint()
{
return this.getRandomizedSpawnPoint();
}
public ChunkCoordinates getSpawnPoint()
{
public float calculateCelestialAngle(long par1, float par3)
{
int var4 = (int)(par1 % 24000L);
float var5 = ((float)var4 + par3) / 24000.0F - 0.25F;
return this.getRandomizedSpawnPoint();
}
if (var5 < 0.0F)
{
++var5;
}
public float calculateCelestialAngle(long par1, float par3)
{
int var4 = (int)(par1 % 24000L);
float var5 = ((float)var4 + par3) / 24000.0F - 0.25F;
if (var5 > 1.0F)
{
--var5;
}
if (var5 < 0.0F)
{
++var5;
}
float var6 = var5;
var5 = 1.0F - (float)((Math.cos((double)var5 * Math.PI) + 1.0D) / 2.0D);
var5 = var6 + (var5 - var6) / 3.0F;
return 0;
}
if (var5 > 1.0F)
{
--var5;
}
@SideOnly(Side.CLIENT)
public int getMoonPhase(long par1, float par3)
{
return 4;
}
float var6 = var5;
var5 = 1.0F - (float)((Math.cos((double)var5 * Math.PI) + 1.0D) / 2.0D);
var5 = var6 + (var5 - var6) / 3.0F;
return 0;
}
@SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT)
public int getMoonPhase(long par1, float par3)
{
return 4;
}
@SideOnly(Side.CLIENT)
@Override
public String getSaveFolder()
{
return (dimensionId == 0 ? null : "DimensionalDoors/Limbo" + dimensionId);
}
public boolean canCoordinateBeSpawn(int par1, int par2)
{
int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2);
return var3 == mod_pocketDim.blockLimboID;
}
@Override
{
return (dimensionId == 0 ? null : "DimensionalDoors/Limbo" + dimensionId);
}
public boolean canCoordinateBeSpawn(int par1, int par2)
{
int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2);
return var3 == properties.LimboBlockID;
}
@Override
public double getHorizon()
{
return worldObj.getHeight()/4-800;
}
{
return worldObj.getHeight()/4-800;
}
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
{
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
setCloudRenderer( new CloudRenderBlank());
return this.worldObj.getWorldVec3Pool().getVecFromPool((double)0, (double)0, (double)0);
}
@SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT)
@Override
public Vec3 getFogColor(float par1, float par2)
{
return this.worldObj.getWorldVec3Pool().getVecFromPool((double).2, (double).2, (double).2);
{
return this.worldObj.getWorldVec3Pool().getVecFromPool((double).2, (double).2, (double).2);
}
public int getRespawnDimension(EntityPlayerMP player)
{
return 0;
}
}
public int getRespawnDimension(EntityPlayerMP player)
{
return 0;
}
@Override
public IChunkProvider createChunkGenerator()
{
return new LimboGenerator(worldObj, 45);
}
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
{
return false;
}
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
{
return false;
}
@Override
public ChunkCoordinates getRandomizedSpawnPoint()
{
ChunkCoordinates var5 = new ChunkCoordinates(0,0,0);
public ChunkCoordinates getRandomizedSpawnPoint()
{
ChunkCoordinates var5 = new ChunkCoordinates(0,0,0);
int spawnFuzz = 10000;
int spawnFuzzHalf = spawnFuzz / 2;
{
var5.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
var5.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
var5.posY = 700;
}
int spawnFuzz = 10000;
int spawnFuzzHalf = spawnFuzz / 2;
return var5;
{
var5.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
var5.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
var5.posY = 700;
}
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,8 +92,7 @@ public class pocketProvider extends WorldProvider
@Override
public String getDimensionName()
{
// TODO Auto-generated method stub
return "PocketDim "+this.dimensionId;
return "PocketDim " + this.dimensionId;
}
@@ -98,16 +100,16 @@ public class pocketProvider extends WorldProvider
{
int respawnDim;
if(mod_pocketDim.isLimboActive)
if (properties.LimboEnabled)
{
respawnDim= mod_pocketDim.limboDimID;
respawnDim = properties.LimboDimensionID;
}
else
{
respawnDim= dimHelper.dimList.get(this.dimensionId).exitDimLink.destDimID;
}
if(dimHelper.getWorld(respawnDim)==null)
if (dimHelper.getWorld(respawnDim)==null)
{
dimHelper.initDimension(respawnDim);
}