Merge pull request #53 from SenseiKiwi/master
Various Changes, Support for doMobSpawning, Overhauled CommonTickHandler
This commit is contained in:
@@ -1,278 +0,0 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
|
||||||
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
|
|
||||||
{
|
|
||||||
private int tickCount = 0;
|
|
||||||
private static DDProperties properties = null;
|
|
||||||
public static ArrayList<int[]> chunksToPopulate = new ArrayList<int[]>();
|
|
||||||
|
|
||||||
private static final Random rand = new Random();
|
|
||||||
|
|
||||||
public static final int MAX_MONOLITH_SPAWNING_CHANCE = 100;
|
|
||||||
private static final String label = "Dimensional Doors: Common Tick";
|
|
||||||
private static final int MAX_MONOLITH_SPAWN_Y = 245;
|
|
||||||
private static final int CHUNK_SIZE = 16;
|
|
||||||
private static final int RIFT_REGENERATION_INTERVAL = 100; //Regenerate random rifts every 100 ticks
|
|
||||||
private static final int LIMBO_DECAY_INTERVAL = 10; //Apply spread decay every 10 ticks
|
|
||||||
|
|
||||||
public CommonTickHandler()
|
|
||||||
{
|
|
||||||
if (properties == null)
|
|
||||||
properties = DDProperties.instance();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
|
||||||
{
|
|
||||||
if (type.equals(EnumSet.of(TickType.SERVER)))
|
|
||||||
{
|
|
||||||
onServerTick();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
|
||||||
{
|
|
||||||
if (type.equals(EnumSet.of(TickType.SERVER)))
|
|
||||||
{
|
|
||||||
if(!CommonTickHandler.chunksToPopulate.isEmpty())
|
|
||||||
{
|
|
||||||
//TODO: This is bad. =/ We should not be passing around arrays of magic numbers.
|
|
||||||
//We should have an object that contains this information. ~SenseiKiwi
|
|
||||||
|
|
||||||
for (int[] chunkData : CommonTickHandler.chunksToPopulate)
|
|
||||||
{
|
|
||||||
if(chunkData[0] == properties.LimboDimensionID)
|
|
||||||
{
|
|
||||||
this.placeMonolithsInLimbo(chunkData[0], chunkData[1], chunkData[2]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.placeMonolithsInPockets(chunkData[0], chunkData[1], chunkData[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CommonTickHandler.chunksToPopulate.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumSet<TickType> ticks()
|
|
||||||
{
|
|
||||||
return EnumSet.of(TickType.SERVER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLabel()
|
|
||||||
{
|
|
||||||
return label; //Used for profiling!
|
|
||||||
}
|
|
||||||
|
|
||||||
private void placeMonolithsInPockets(int worldID, int chunkX, int chunkZ)
|
|
||||||
{
|
|
||||||
World worldObj = dimHelper.getWorld(worldID);
|
|
||||||
DimData dimData = dimHelper.dimList.get(worldObj.provider.dimensionId);
|
|
||||||
int sanity = 0;
|
|
||||||
int blockID = 0;
|
|
||||||
boolean didSpawn=false;
|
|
||||||
|
|
||||||
if (dimData == null ||
|
|
||||||
dimData.dungeonGenerator == null ||
|
|
||||||
dimData.dungeonGenerator.isOpen)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//The following initialization code is based on code from ChunkProviderGenerate.
|
|
||||||
//It makes our generation depend on the world seed.
|
|
||||||
Random random = new Random(worldObj.getSeed());
|
|
||||||
long factorA = random.nextLong() / 2L * 2L + 1L;
|
|
||||||
long factorB = random.nextLong() / 2L * 2L + 1L;
|
|
||||||
random.setSeed(chunkX * factorA + chunkZ * factorB ^ worldObj.getSeed());
|
|
||||||
|
|
||||||
int x, y, z;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
//Select a random column within the chunk
|
|
||||||
x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
|
||||||
z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
|
||||||
y = MAX_MONOLITH_SPAWN_Y;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
|
|
||||||
while (blockID == 0 &&y>0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
|
|
||||||
}
|
|
||||||
while((blockID == mod_pocketDim.blockDimWall.blockID||blockID == mod_pocketDim.blockDimWallPerm.blockID)&&y>0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
}
|
|
||||||
while (blockID == 0 &&y>0)
|
|
||||||
{
|
|
||||||
y--;
|
|
||||||
blockID = worldObj.getBlockId(x, y, z);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(y > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int jumpSanity=0;
|
|
||||||
int jumpHeight=0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
|
|
||||||
jumpHeight = y+random.nextInt(10);
|
|
||||||
|
|
||||||
jumpSanity++;
|
|
||||||
}
|
|
||||||
while(!worldObj.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Entity mob = new MobObelisk(worldObj);
|
|
||||||
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
|
||||||
worldObj.spawnEntityInWorld(mob);
|
|
||||||
didSpawn=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sanity++;
|
|
||||||
|
|
||||||
}
|
|
||||||
while (sanity<5&&!didSpawn);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void placeMonolithsInLimbo(int worldID, int var2, int var3)
|
|
||||||
{
|
|
||||||
World world = dimHelper.getWorld(worldID);
|
|
||||||
|
|
||||||
if (rand.nextInt(MAX_MONOLITH_SPAWNING_CHANCE) < properties.MonolithSpawningChance)
|
|
||||||
{
|
|
||||||
int y =0;
|
|
||||||
int x = var2*16 + rand.nextInt(16);
|
|
||||||
int z = var3*16 + rand.nextInt(16);
|
|
||||||
int yTest;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
|
|
||||||
x = var2*16 + rand.nextInt(16);
|
|
||||||
z = var3*16 + rand.nextInt(16);
|
|
||||||
|
|
||||||
while(world.getBlockId(x, y, z)==0&&y<255)
|
|
||||||
{
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
y = yCoordHelper.getFirstUncovered(world,x , y+2, z);
|
|
||||||
|
|
||||||
yTest=yCoordHelper.getFirstUncovered(world,x , y+5, z);
|
|
||||||
if(yTest>245)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int jumpSanity=0;
|
|
||||||
int jumpHeight=0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
jumpHeight = y+rand.nextInt(25);
|
|
||||||
|
|
||||||
jumpSanity++;
|
|
||||||
}
|
|
||||||
while(!world.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
|
||||||
|
|
||||||
|
|
||||||
Entity mob = new MobObelisk(world);
|
|
||||||
mob.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
|
||||||
|
|
||||||
|
|
||||||
world.spawnEntityInWorld(mob);
|
|
||||||
|
|
||||||
}
|
|
||||||
while (yTest > y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onServerTick()
|
|
||||||
{
|
|
||||||
tickCount++; //There is no need to reset the counter. Let it overflow. Really.
|
|
||||||
|
|
||||||
if (tickCount % RIFT_REGENERATION_INTERVAL == 0)
|
|
||||||
{
|
|
||||||
regenerateRifts();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tickCount % LIMBO_DECAY_INTERVAL == 0)
|
|
||||||
{
|
|
||||||
LimboDecay.ApplyRandomFastDecay();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mod_pocketDim.teleTimer > 0)
|
|
||||||
{
|
|
||||||
mod_pocketDim.teleTimer--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void regenerateRifts()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//Regenerate rifts that have been replaced (not permanently removed) by players
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
System.out.println("An exception occurred in CommonTickHandler.onServerTick():");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraftforge.common.Configuration;
|
import net.minecraftforge.common.Configuration;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
|
||||||
|
|
||||||
public class DDProperties
|
public class DDProperties
|
||||||
{
|
{
|
||||||
@@ -206,7 +207,7 @@ public class DDProperties
|
|||||||
"Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true);
|
"Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true);
|
||||||
|
|
||||||
MonolithSpawningChance = config.get(Configuration.CATEGORY_GENERAL, "Monolith Spawning Chance", 28,
|
MonolithSpawningChance = config.get(Configuration.CATEGORY_GENERAL, "Monolith Spawning Chance", 28,
|
||||||
"Sets the chance (out of " + CommonTickHandler.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " +
|
"Sets the chance (out of " + MonolithSpawner.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " +
|
||||||
"spawn in a given Limbo chunk. The default chance is 28.").getInt();
|
"spawn in a given Limbo chunk. The default chance is 28.").getInt();
|
||||||
|
|
||||||
ClusterGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Cluster Generation Chance", 3,
|
ClusterGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Cluster Generation Chance", 3,
|
||||||
|
|||||||
@@ -7,67 +7,68 @@ import net.minecraft.block.BlockContainer;
|
|||||||
import net.minecraft.world.ChunkCoordIntPair;
|
import net.minecraft.world.ChunkCoordIntPair;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.IRegularTickReceiver;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.IRegularTickSender;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides methods for applying Limbo decay. Limbo decay refers to the effect that most blocks placed in Limbo
|
* Provides methods for applying Limbo decay. Limbo decay refers to the effect that most blocks placed in Limbo
|
||||||
* naturally change into stone, then cobble, then gravel, and finally Unraveled Fabric as time passes.
|
* naturally change into stone, then cobble, then gravel, and finally Unraveled Fabric as time passes.
|
||||||
*/
|
*/
|
||||||
public class LimboDecay {
|
public class LimboDecay implements IRegularTickReceiver {
|
||||||
|
|
||||||
private static final int MAX_DECAY_SPREAD_CHANCE = 100;
|
private static final int MAX_DECAY_SPREAD_CHANCE = 100;
|
||||||
private static final int DECAY_SPREAD_CHANCE = 50;
|
private static final int DECAY_SPREAD_CHANCE = 50;
|
||||||
private static final int CHUNK_SIZE = 16;
|
private static final int CHUNK_SIZE = 16;
|
||||||
private static final int SECTION_HEIGHT = 16;
|
private static final int SECTION_HEIGHT = 16;
|
||||||
|
private static final int LIMBO_DECAY_INTERVAL = 10; //Apply spread decay every 10 ticks
|
||||||
|
|
||||||
//Provides a reversed list of the block IDs that blocks cycle through during decay.
|
//Provides a reversed list of the block IDs that blocks cycle through during decay.
|
||||||
//Must be initialized later since it requires DDProperties to be initialized (for LimboBlockID).
|
private final int[] decaySequence;
|
||||||
private static int[] decaySequence = null;
|
|
||||||
|
|
||||||
private static Random random = new Random();
|
private Random random;
|
||||||
private static DDProperties properties = null;
|
private DDProperties properties = null;
|
||||||
|
|
||||||
private LimboDecay() { }
|
public LimboDecay(IRegularTickSender tickSender, DDProperties properties)
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the array containing the reversed sequence of block IDs that blocks cycle through during decay.
|
|
||||||
*/
|
|
||||||
private static void InitializeDecaySequence()
|
|
||||||
{
|
{
|
||||||
if (decaySequence == null)
|
|
||||||
{
|
|
||||||
if (properties == null)
|
|
||||||
properties = DDProperties.instance();
|
|
||||||
|
|
||||||
decaySequence = new int[] {
|
decaySequence = new int[] {
|
||||||
properties.LimboBlockID,
|
properties.LimboBlockID,
|
||||||
Block.gravel.blockID,
|
Block.gravel.blockID,
|
||||||
Block.cobblestone.blockID,
|
Block.cobblestone.blockID,
|
||||||
Block.stone.blockID
|
Block.stone.blockID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.properties = properties;
|
||||||
|
this.random = new Random();
|
||||||
|
tickSender.registerForTicking(this, LIMBO_DECAY_INTERVAL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies fast Limbo decay periodically.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void notifyTick()
|
||||||
|
{
|
||||||
|
applyRandomFastDecay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the blocks orthogonally around a given location (presumably the location of an Unraveled Fabric block)
|
* Checks the blocks orthogonally around a given location (presumably the location of an Unraveled Fabric block)
|
||||||
* and applies Limbo decay to them. This gives the impression that decay spreads outward from Unraveled Fabric.
|
* and applies Limbo decay to them. This gives the impression that decay spreads outward from Unraveled Fabric.
|
||||||
*/
|
*/
|
||||||
public static void ApplySpreadDecay(World world, int x, int y, int z)
|
public void applySpreadDecay(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
if (properties == null)
|
|
||||||
properties = DDProperties.instance();
|
|
||||||
|
|
||||||
//Check if we randomly apply decay spread or not. This can be used to moderate the frequency of
|
//Check if we randomly apply decay spread or not. This can be used to moderate the frequency of
|
||||||
//full spread decay checks, which can also shift its performance impact on the game.
|
//full spread decay checks, which can also shift its performance impact on the game.
|
||||||
if (random.nextInt(MAX_DECAY_SPREAD_CHANCE) < DECAY_SPREAD_CHANCE)
|
if (random.nextInt(MAX_DECAY_SPREAD_CHANCE) < DECAY_SPREAD_CHANCE)
|
||||||
{
|
{
|
||||||
//Apply decay to the blocks above, below, and on all four sides.
|
//Apply decay to the blocks above, below, and on all four sides.
|
||||||
//World.getBlockId() implements bounds checking, so we don't have to worry about reaching out of the world
|
//World.getBlockId() implements bounds checking, so we don't have to worry about reaching out of the world
|
||||||
DecayBlock(world, x - 1, y, z);
|
decayBlock(world, x - 1, y, z);
|
||||||
DecayBlock(world, x + 1, y, z);
|
decayBlock(world, x + 1, y, z);
|
||||||
DecayBlock(world, x, y, z - 1);
|
decayBlock(world, x, y, z - 1);
|
||||||
DecayBlock(world, x, y, z + 1);
|
decayBlock(world, x, y, z + 1);
|
||||||
DecayBlock(world, x, y - 1, z);
|
decayBlock(world, x, y - 1, z);
|
||||||
DecayBlock(world, x, y + 1, z);
|
decayBlock(world, x, y + 1, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,11 +76,8 @@ public class LimboDecay {
|
|||||||
* Picks random blocks from each active chunk in Limbo and, if decay is applicable, converts them directly to Unraveled Fabric.
|
* Picks random blocks from each active chunk in Limbo and, if decay is applicable, converts them directly to Unraveled Fabric.
|
||||||
* This decay method is designed to stop players from avoiding Limbo decay by building floating structures.
|
* This decay method is designed to stop players from avoiding Limbo decay by building floating structures.
|
||||||
*/
|
*/
|
||||||
public static void ApplyRandomFastDecay()
|
private void applyRandomFastDecay()
|
||||||
{
|
{
|
||||||
if (properties == null)
|
|
||||||
properties = DDProperties.instance();
|
|
||||||
|
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
int sectionY;
|
int sectionY;
|
||||||
int limboHeight;
|
int limboHeight;
|
||||||
@@ -102,7 +100,7 @@ public class LimboDecay {
|
|||||||
x = chunkCoord.chunkXPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
x = chunkCoord.chunkXPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
z = chunkCoord.chunkZPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
z = chunkCoord.chunkZPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
y = sectionY + random.nextInt(SECTION_HEIGHT);
|
y = sectionY + random.nextInt(SECTION_HEIGHT);
|
||||||
DecayBlockFast(limbo, x, y, z);
|
decayBlockFast(limbo, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,10 +109,10 @@ public class LimboDecay {
|
|||||||
/**
|
/**
|
||||||
* Checks if a block can be decayed and, if so, changes it directly into Unraveled Fabric.
|
* Checks if a block can be decayed and, if so, changes it directly into Unraveled Fabric.
|
||||||
*/
|
*/
|
||||||
private static boolean DecayBlockFast(World world, int x, int y, int z)
|
private boolean decayBlockFast(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
int blockID = world.getBlockId(x, y, z);
|
int blockID = world.getBlockId(x, y, z);
|
||||||
if (CanDecayBlock(blockID))
|
if (canDecayBlock(blockID))
|
||||||
{
|
{
|
||||||
world.setBlock(x, y, z, properties.LimboBlockID);
|
world.setBlock(x, y, z, properties.LimboBlockID);
|
||||||
return true;
|
return true;
|
||||||
@@ -125,14 +123,11 @@ public class LimboDecay {
|
|||||||
/**
|
/**
|
||||||
* Checks if a block can be decayed and, if so, changes it to the next block ID along the decay sequence.
|
* Checks if a block can be decayed and, if so, changes it to the next block ID along the decay sequence.
|
||||||
*/
|
*/
|
||||||
private static boolean DecayBlock(World world, int x, int y, int z)
|
private boolean decayBlock(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
//Make sure the decay sequence is initialized
|
|
||||||
InitializeDecaySequence();
|
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
int blockID = world.getBlockId(x, y, z);
|
int blockID = world.getBlockId(x, y, z);
|
||||||
if (CanDecayBlock(blockID))
|
if (canDecayBlock(blockID))
|
||||||
{
|
{
|
||||||
//Loop over the block IDs that decay can go through.
|
//Loop over the block IDs that decay can go through.
|
||||||
//Find an index matching the current blockID, if any.
|
//Find an index matching the current blockID, if any.
|
||||||
@@ -159,7 +154,7 @@ public class LimboDecay {
|
|||||||
/**
|
/**
|
||||||
* Checks if a block can decay. We will not decay air, Unraveled Fabric, Eternal Fabric, or containers.
|
* Checks if a block can decay. We will not decay air, Unraveled Fabric, Eternal Fabric, or containers.
|
||||||
*/
|
*/
|
||||||
private static boolean CanDecayBlock(int blockID)
|
private boolean canDecayBlock(int blockID)
|
||||||
{
|
{
|
||||||
if (blockID == 0 || blockID == properties.LimboBlockID || blockID == properties.PermaFabricBlockID)
|
if (blockID == 0 || blockID == properties.LimboBlockID || blockID == properties.PermaFabricBlockID)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
|||||||
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
|
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
|
||||||
import StevenDimDoors.mod_pocketDim.items.itemDimDoor;
|
import StevenDimDoors.mod_pocketDim.items.itemDimDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.pocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
import cpw.mods.fml.common.IWorldGenerator;
|
import cpw.mods.fml.common.IWorldGenerator;
|
||||||
|
|
||||||
public class RiftGenerator implements IWorldGenerator
|
public class RiftGenerator implements IWorldGenerator
|
||||||
@@ -38,7 +38,7 @@ public class RiftGenerator implements IWorldGenerator
|
|||||||
//Don't generate rifts or gateways if the rift generation flag is disabled,
|
//Don't generate rifts or gateways if the rift generation flag is disabled,
|
||||||
//the current world is a pocket dimension, or the world is remote.
|
//the current world is a pocket dimension, or the world is remote.
|
||||||
if ((!properties.WorldRiftGenerationEnabled && !(world.provider instanceof LimboProvider)) ||
|
if ((!properties.WorldRiftGenerationEnabled && !(world.provider instanceof LimboProvider)) ||
|
||||||
world.provider instanceof pocketProvider || world.isRemote)
|
world.provider instanceof PocketProvider || world.isRemote)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import net.minecraftforge.common.ChestGenHooks;
|
|||||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
|
|
||||||
public class SchematicLoader
|
public class SchematicLoader
|
||||||
{
|
{
|
||||||
@@ -1151,7 +1151,7 @@ public class SchematicLoader
|
|||||||
Point3D frameLocation = point.clone();
|
Point3D frameLocation = point.clone();
|
||||||
transformPoint(frameLocation, schematicEntrance, orientation - entryDirection, pocketCenter);
|
transformPoint(frameLocation, schematicEntrance, orientation - entryDirection, pocketCenter);
|
||||||
|
|
||||||
Entity mob = new MobObelisk(world);
|
Entity mob = new MobMonolith(world);
|
||||||
mob.setLocationAndAngles(frameLocation.getX(), frameLocation.getY(), frameLocation.getZ(), 1, 1); //TODO: Why not set the angles to 0? @.@ ~SenseiKiwi
|
mob.setLocationAndAngles(frameLocation.getX(), frameLocation.getY(), frameLocation.getZ(), 1, 1); //TODO: Why not set the angles to 0? @.@ ~SenseiKiwi
|
||||||
world.spawnEntityInWorld(mob);
|
world.spawnEntityInWorld(mob);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList;
|
||||||
|
|||||||
@@ -16,11 +16,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
public class BlockLimbo extends Block
|
public class BlockLimbo extends Block
|
||||||
{
|
{
|
||||||
private final int limboDimensionID;
|
private final int limboDimensionID;
|
||||||
|
private final LimboDecay decay;
|
||||||
|
|
||||||
public BlockLimbo(int i, int j, Material par2Material, int limboDimensionID)
|
public BlockLimbo(int i, int j, Material par2Material, int limboDimensionID, LimboDecay decay)
|
||||||
{
|
{
|
||||||
super(i, Material.ground);
|
super(i, Material.ground);
|
||||||
this.limboDimensionID = limboDimensionID;
|
this.limboDimensionID = limboDimensionID;
|
||||||
|
this.decay = decay;
|
||||||
this.setTickRandomly(true);
|
this.setTickRandomly(true);
|
||||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
}
|
}
|
||||||
@@ -56,7 +58,7 @@ public class BlockLimbo extends Block
|
|||||||
//Make sure this block is in Limbo
|
//Make sure this block is in Limbo
|
||||||
if (world.provider.dimensionId == limboDimensionID)
|
if (world.provider.dimensionId == limboDimensionID)
|
||||||
{
|
{
|
||||||
LimboDecay.ApplySpreadDecay(world, x, y, z);
|
decay.applySpreadDecay(world, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import StevenDimDoors.mod_pocketDim.DimData;
|
|||||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.world.pocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
import net.minecraft.block.BlockTrapDoor;
|
import net.minecraft.block.BlockTrapDoor;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
@@ -48,7 +48,7 @@ public class dimHatch extends BlockTrapDoor
|
|||||||
|
|
||||||
int num = par1World.getBlockMetadata(par2, par3, par4);
|
int num = par1World.getBlockMetadata(par2, par3, par4);
|
||||||
|
|
||||||
if(!par1World.isRemote&&(num>3&&num<8||num>11)&&par1World.provider instanceof pocketProvider)
|
if(!par1World.isRemote&&(num>3&&num<8||num>11)&&par1World.provider instanceof PocketProvider)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
|
this.onPoweredBlockChange(par1World, par2, par3, par4, false);
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
|
|
||||||
public class CommandStartDungeonCreation extends DDCommandBase
|
public class CommandCreatePocket extends DDCommandBase
|
||||||
{
|
{
|
||||||
private static CommandStartDungeonCreation instance = null;
|
private static CommandCreatePocket instance = null;
|
||||||
|
|
||||||
private CommandStartDungeonCreation()
|
private CommandCreatePocket()
|
||||||
{
|
{
|
||||||
super("dd-create", "");
|
super("dd-create", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommandStartDungeonCreation instance()
|
public static CommandCreatePocket instance()
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new CommandStartDungeonCreation();
|
instance = new CommandCreatePocket();
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@@ -6,21 +6,21 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
|
|
||||||
public class CommandEndDungeonCreation extends DDCommandBase
|
public class CommandExportDungeon extends DDCommandBase
|
||||||
{
|
{
|
||||||
private static CommandEndDungeonCreation instance = null;
|
private static CommandExportDungeon instance = null;
|
||||||
|
|
||||||
private CommandEndDungeonCreation()
|
private CommandExportDungeon()
|
||||||
{
|
{
|
||||||
super("dd-export", new String[] {
|
super("dd-export", new String[] {
|
||||||
"<dungeon type> <dungeon name> <'open' | 'closed'> [weight] ['override']",
|
"<dungeon type> <dungeon name> <'open' | 'closed'> [weight]",
|
||||||
"<schematic name> override" } );
|
"<schematic name> override" } );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommandEndDungeonCreation instance()
|
public static CommandExportDungeon instance()
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new CommandEndDungeonCreation();
|
instance = new CommandExportDungeon();
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@@ -29,11 +29,8 @@ public class CommandEndDungeonCreation extends DDCommandBase
|
|||||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* There are two versions of this command. One version takes 3 to 5 arguments consisting
|
* There are two versions of this command. One version takes 3 to 4 arguments consisting
|
||||||
* of the information needed for a proper schematic name and an optional override argument.
|
* of the information needed for a proper schematic name.
|
||||||
* The override argument only allows the user to export any dimension, even if it wasn't
|
|
||||||
* meant for custom dungeon creation. It does not allow the user to export a dungeon with
|
|
||||||
* invalid tags.
|
|
||||||
*
|
*
|
||||||
* If the user wishes to name his schematic in a different format, then he will have to use
|
* If the user wishes to name his schematic in a different format, then he will have to use
|
||||||
* the 2-argument version of this command, which accepts a schematic name and a mandatory
|
* the 2-argument version of this command, which accepts a schematic name and a mandatory
|
||||||
@@ -46,7 +43,7 @@ public class CommandEndDungeonCreation extends DDCommandBase
|
|||||||
{
|
{
|
||||||
return DDCommandResult.TOO_FEW_ARGUMENTS;
|
return DDCommandResult.TOO_FEW_ARGUMENTS;
|
||||||
}
|
}
|
||||||
if (command.length > 5)
|
if (command.length > 4)
|
||||||
{
|
{
|
||||||
return DDCommandResult.TOO_MANY_ARGUMENTS;
|
return DDCommandResult.TOO_MANY_ARGUMENTS;
|
||||||
}
|
}
|
||||||
@@ -77,21 +74,12 @@ public class CommandEndDungeonCreation extends DDCommandBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//The user must have used the 3-argument version of this command
|
//The user must have used the 3-argument version of this command
|
||||||
//Check if the current dimension is a pocket for building custom dungeons or if the override argument was used.
|
|
||||||
if (!dungeonHelper.isCustomDungeon(sender.worldObj.provider.dimensionId) &&
|
|
||||||
!command[command.length - 1].equalsIgnoreCase("override"))
|
|
||||||
{
|
|
||||||
//This dimension may not be exported without overriding!
|
|
||||||
return new DDCommandResult("Error: The current dimension was not made for dungeon creation. Use the 'override' argument to export anyway.");
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Why do we check remoteness here but not before? And why not for the other export case?
|
//TODO: Why do we check remoteness here but not before? And why not for the other export case?
|
||||||
//Something feels wrong... ~SenseiKiwi
|
//Something feels wrong... ~SenseiKiwi
|
||||||
|
|
||||||
if (!sender.worldObj.isRemote)
|
if (!sender.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
//TODO: This validation should be in DungeonHelper or in another class. We should move it
|
//TODO: This validation should be in DungeonHelper or in another class. We should move it
|
||||||
//once the during the save file format rewrite. ~SenseiKiwi
|
//during the save file format rewrite. ~SenseiKiwi
|
||||||
|
|
||||||
if (!dungeonHelper.validateDungeonType(command[0]))
|
if (!dungeonHelper.validateDungeonType(command[0]))
|
||||||
{
|
{
|
||||||
@@ -106,13 +94,14 @@ public class CommandEndDungeonCreation extends DDCommandBase
|
|||||||
return new DDCommandResult("Error: Please specify whether the dungeon is 'open' or 'closed'.");
|
return new DDCommandResult("Error: Please specify whether the dungeon is 'open' or 'closed'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//If there are no more argument, export the dungeon.
|
//If there are no more arguments, export the dungeon.
|
||||||
if (command.length == 3)
|
if (command.length == 3)
|
||||||
{
|
{
|
||||||
return exportDungeon(sender, join(command, "_", 0, 3));
|
return exportDungeon(sender, join(command, "_", 0, 3));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//Validate the 4th argument, which might be the weight or might be "override".
|
{
|
||||||
|
//Validate the weight argument
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int weight = Integer.parseInt(command[3]);
|
int weight = Integer.parseInt(command[3]);
|
||||||
@@ -121,14 +110,7 @@ public class CommandEndDungeonCreation extends DDCommandBase
|
|||||||
return exportDungeon(sender, join(command, "_", 0, 4));
|
return exportDungeon(sender, join(command, "_", 0, 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) { }
|
||||||
{
|
|
||||||
//The 4th argument could be "override", but only if it's the last argument.
|
|
||||||
//In that case, we assume the default dungeon weight.
|
|
||||||
if (command.length == 4 && command[3].equalsIgnoreCase("override"))
|
|
||||||
{
|
|
||||||
return exportDungeon(sender, join(command, "_", 0, 3));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//If we've reached this point, then we must have an invalid weight.
|
//If we've reached this point, then we must have an invalid weight.
|
||||||
@@ -62,8 +62,6 @@ public class DungeonHelper
|
|||||||
|
|
||||||
private Random rand = new Random();
|
private Random rand = new Random();
|
||||||
|
|
||||||
private HashMap<Integer, LinkData> customDungeonStatus = new HashMap<Integer, LinkData>();
|
|
||||||
|
|
||||||
public ArrayList<DungeonGenerator> customDungeons = new ArrayList<DungeonGenerator>();
|
public ArrayList<DungeonGenerator> customDungeons = new ArrayList<DungeonGenerator>();
|
||||||
public ArrayList<DungeonGenerator> registeredDungeons = new ArrayList<DungeonGenerator>();
|
public ArrayList<DungeonGenerator> registeredDungeons = new ArrayList<DungeonGenerator>();
|
||||||
|
|
||||||
@@ -157,18 +155,9 @@ public class DungeonHelper
|
|||||||
//Place a Warp Door linked to that pocket
|
//Place a Warp Door linked to that pocket
|
||||||
itemDimDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.ExitDoor);
|
itemDimDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.ExitDoor);
|
||||||
|
|
||||||
//Register the pocket as a custom dungeon
|
|
||||||
customDungeonStatus.put(link.destDimID,
|
|
||||||
dimHelper.instance.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID));
|
|
||||||
|
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomDungeon(int dimensionID)
|
|
||||||
{
|
|
||||||
return customDungeonStatus.containsKey(dimensionID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean validateDungeonType(String type)
|
public boolean validateDungeonType(String type)
|
||||||
{
|
{
|
||||||
//Check if the dungeon type is valid
|
//Check if the dungeon type is valid
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import StevenDimDoors.mod_pocketDim.Point3D;
|
|||||||
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.pocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@@ -386,7 +386,7 @@ public class dimHelper extends DimensionManager
|
|||||||
}
|
}
|
||||||
else if(!this.dimList.containsKey(world.provider.dimensionId))
|
else if(!this.dimList.containsKey(world.provider.dimensionId))
|
||||||
{
|
{
|
||||||
if(!(world.provider instanceof pocketProvider ||world.provider instanceof LimboProvider))
|
if(!(world.provider instanceof PocketProvider ||world.provider instanceof LimboProvider))
|
||||||
{
|
{
|
||||||
DimData data = new DimData(world.provider.dimensionId, false, 0, 0, world.getSpawnPoint().posX, world.getSpawnPoint().posY, world.getSpawnPoint().posZ);
|
DimData data = new DimData(world.provider.dimensionId, false, 0, 0, world.getSpawnPoint().posX, world.getSpawnPoint().posY, world.getSpawnPoint().posZ);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package StevenDimDoors.mod_pocketDim.items;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
|
|
||||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||||
import StevenDimDoors.mod_pocketDim.SchematicLoader;
|
import StevenDimDoors.mod_pocketDim.SchematicLoader;
|
||||||
import StevenDimDoors.mod_pocketDim.Spells;
|
import StevenDimDoors.mod_pocketDim.Spells;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
||||||
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ import StevenDimDoors.mod_pocketDim.blocks.ExitDoor;
|
|||||||
import StevenDimDoors.mod_pocketDim.blocks.dimDoor;
|
import StevenDimDoors.mod_pocketDim.blocks.dimDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.dimHatch;
|
import StevenDimDoors.mod_pocketDim.blocks.dimHatch;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandCreateDungeonRift;
|
import StevenDimDoors.mod_pocketDim.commands.CommandCreateDungeonRift;
|
||||||
|
import StevenDimDoors.mod_pocketDim.commands.CommandCreatePocket;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteAllLinks;
|
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteAllLinks;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteDimensionData;
|
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteDimensionData;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteRifts;
|
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteRifts;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandEndDungeonCreation;
|
import StevenDimDoors.mod_pocketDim.commands.CommandExportDungeon;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandPrintDimensionData;
|
import StevenDimDoors.mod_pocketDim.commands.CommandPrintDimensionData;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandPruneDimensions;
|
import StevenDimDoors.mod_pocketDim.commands.CommandPruneDimensions;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandResetDungeons;
|
import StevenDimDoors.mod_pocketDim.commands.CommandResetDungeons;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandStartDungeonCreation;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.BlockRotationHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.BlockRotationHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
@@ -44,11 +44,14 @@ import StevenDimDoors.mod_pocketDim.items.itemDimDoor;
|
|||||||
import StevenDimDoors.mod_pocketDim.items.itemExitDoor;
|
import StevenDimDoors.mod_pocketDim.items.itemExitDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.items.itemLinkSignature;
|
import StevenDimDoors.mod_pocketDim.items.itemLinkSignature;
|
||||||
import StevenDimDoors.mod_pocketDim.items.itemRiftRemover;
|
import StevenDimDoors.mod_pocketDim.items.itemRiftRemover;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator;
|
||||||
import StevenDimDoors.mod_pocketDim.world.BiomeGenLimbo;
|
import StevenDimDoors.mod_pocketDim.world.BiomeGenLimbo;
|
||||||
import StevenDimDoors.mod_pocketDim.world.BiomeGenPocket;
|
import StevenDimDoors.mod_pocketDim.world.BiomeGenPocket;
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.pocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler;
|
import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler;
|
||||||
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
@@ -130,7 +133,8 @@ public class mod_pocketDim
|
|||||||
public static boolean hasInitDims = false;
|
public static boolean hasInitDims = false;
|
||||||
public static boolean isPlayerWearingGoogles = false;
|
public static boolean isPlayerWearingGoogles = false;
|
||||||
|
|
||||||
private static DDProperties properties;
|
public static DDProperties properties;
|
||||||
|
public static MonolithSpawner spawner; //Added this field temporarily. Will be refactored out later.
|
||||||
public static RiftGenerator riftGen;
|
public static RiftGenerator riftGen;
|
||||||
|
|
||||||
public static long genTime;
|
public static long genTime;
|
||||||
@@ -175,6 +179,15 @@ public class mod_pocketDim
|
|||||||
@Init
|
@Init
|
||||||
public void Init(FMLInitializationEvent event)
|
public void Init(FMLInitializationEvent event)
|
||||||
{
|
{
|
||||||
|
CommonTickHandler commonTickHandler = new CommonTickHandler();
|
||||||
|
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
|
||||||
|
TickRegistry.registerTickHandler(commonTickHandler, Side.SERVER);
|
||||||
|
|
||||||
|
//MonolithSpawner should be initialized before any provider instances are created
|
||||||
|
//Register the other regular tick receivers as well
|
||||||
|
spawner = new MonolithSpawner(commonTickHandler, properties);
|
||||||
|
new RiftRegenerator(commonTickHandler); //No need to store the reference
|
||||||
|
LimboDecay decay = new LimboDecay(commonTickHandler, properties);
|
||||||
|
|
||||||
transientDoor = (new TransientDoor(properties.TransientDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("transientDoor");
|
transientDoor = (new TransientDoor(properties.TransientDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("transientDoor");
|
||||||
|
|
||||||
@@ -182,7 +195,7 @@ public class mod_pocketDim
|
|||||||
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm");
|
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm");
|
||||||
ExitDoor = (new ExitDoor(properties.WarpDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp");
|
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"));
|
blockRift = (new BlockRift(properties.RiftBlockID, 0, Material.air).setHardness(1.0F) .setUnlocalizedName("rift"));
|
||||||
blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));
|
blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID, decay).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));
|
||||||
chaosDoor = (new ChaosDoor(properties.UnstableDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").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");
|
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");
|
dimHatch = (new dimHatch(properties.TransTrapdoorID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch");
|
||||||
@@ -215,7 +228,7 @@ public class mod_pocketDim
|
|||||||
|
|
||||||
GameRegistry.registerPlayerTracker(tracker);
|
GameRegistry.registerPlayerTracker(tracker);
|
||||||
|
|
||||||
DimensionManager.registerProviderType(properties.PocketProviderID, pocketProvider.class, false);
|
DimensionManager.registerProviderType(properties.PocketProviderID, PocketProvider.class, false);
|
||||||
DimensionManager.registerProviderType(properties.LimboProviderID, LimboProvider.class, false);
|
DimensionManager.registerProviderType(properties.LimboProviderID, LimboProvider.class, false);
|
||||||
DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID);
|
DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID);
|
||||||
|
|
||||||
@@ -247,16 +260,13 @@ public class mod_pocketDim
|
|||||||
|
|
||||||
LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items");
|
LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items");
|
||||||
|
|
||||||
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
|
|
||||||
TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER);
|
|
||||||
|
|
||||||
//GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimRail");
|
//GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimRail");
|
||||||
|
|
||||||
GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor");
|
GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor");
|
||||||
GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift");
|
GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift");
|
||||||
|
|
||||||
EntityRegistry.registerModEntity(MobObelisk.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true);
|
EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true);
|
||||||
EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobObelisk.class);
|
EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobMonolith.class);
|
||||||
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
|
EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff));
|
||||||
LanguageRegistry.instance().addStringLocalization("entity.DimDoors.Obelisk.name", "Monolith");
|
LanguageRegistry.instance().addStringLocalization("entity.DimDoors.Obelisk.name", "Monolith");
|
||||||
|
|
||||||
@@ -428,10 +438,10 @@ public class mod_pocketDim
|
|||||||
CommandDeleteAllLinks.instance().register(event);
|
CommandDeleteAllLinks.instance().register(event);
|
||||||
CommandDeleteDimensionData.instance().register(event);
|
CommandDeleteDimensionData.instance().register(event);
|
||||||
CommandDeleteRifts.instance().register(event);
|
CommandDeleteRifts.instance().register(event);
|
||||||
CommandEndDungeonCreation.instance().register(event);
|
CommandExportDungeon.instance().register(event);
|
||||||
CommandPrintDimensionData.instance().register(event);
|
CommandPrintDimensionData.instance().register(event);
|
||||||
CommandPruneDimensions.instance().register(event);
|
CommandPruneDimensions.instance().register(event);
|
||||||
CommandStartDungeonCreation.instance().register(event);
|
CommandCreatePocket.instance().register(event);
|
||||||
dimHelper.instance.load();
|
dimHelper.instance.load();
|
||||||
|
|
||||||
if(!dimHelper.dimList.containsKey(properties.LimboDimensionID))
|
if(!dimHelper.dimList.containsKey(properties.LimboDimensionID))
|
||||||
|
|||||||
76
StevenDimDoors/mod_pocketDim/ticking/CommonTickHandler.java
Normal file
76
StevenDimDoors/mod_pocketDim/ticking/CommonTickHandler.java
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package StevenDimDoors.mod_pocketDim.ticking;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
import cpw.mods.fml.common.ITickHandler;
|
||||||
|
import cpw.mods.fml.common.TickType;
|
||||||
|
|
||||||
|
public class CommonTickHandler implements ITickHandler, IRegularTickSender
|
||||||
|
{
|
||||||
|
private static final String PROFILING_LABEL = "Dimensional Doors: Common Tick";
|
||||||
|
|
||||||
|
private int tickCount = 0;
|
||||||
|
private ArrayList<RegularTickReceiverInfo> receivers;
|
||||||
|
|
||||||
|
|
||||||
|
public CommonTickHandler()
|
||||||
|
{
|
||||||
|
this.receivers = new ArrayList<RegularTickReceiverInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerForTicking(IRegularTickReceiver receiver, int interval, boolean onTickStart)
|
||||||
|
{
|
||||||
|
RegularTickReceiverInfo info = new RegularTickReceiverInfo(receiver, interval, onTickStart);
|
||||||
|
receivers.add(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
||||||
|
{
|
||||||
|
if (type.equals(EnumSet.of(TickType.SERVER)))
|
||||||
|
{
|
||||||
|
for (RegularTickReceiverInfo info : receivers)
|
||||||
|
{
|
||||||
|
if (info.OnTickStart && tickCount % info.Interval == 0)
|
||||||
|
{
|
||||||
|
info.RegularTickReceiver.notifyTick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Stuck this in here because it's already rather hackish.
|
||||||
|
//We should standardize this as an IRegularTickReceiver in the future. ~SenseiKiwi
|
||||||
|
if (mod_pocketDim.teleTimer > 0)
|
||||||
|
{
|
||||||
|
mod_pocketDim.teleTimer--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
||||||
|
{
|
||||||
|
for (RegularTickReceiverInfo info : receivers)
|
||||||
|
{
|
||||||
|
if (!info.OnTickStart && tickCount % info.Interval == 0)
|
||||||
|
{
|
||||||
|
info.RegularTickReceiver.notifyTick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tickCount++; //There is no need to reset the counter. Let it overflow.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumSet<TickType> ticks()
|
||||||
|
{
|
||||||
|
return EnumSet.of(TickType.SERVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLabel()
|
||||||
|
{
|
||||||
|
return PROFILING_LABEL; //Used for profiling!
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package StevenDimDoors.mod_pocketDim.ticking;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IRegularTickReceiver {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called periodically to execute code based on ticks elapsed.
|
||||||
|
*/
|
||||||
|
public void notifyTick();
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package StevenDimDoors.mod_pocketDim.ticking;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IRegularTickSender {
|
||||||
|
|
||||||
|
public void registerForTicking(IRegularTickReceiver receiver, int interval, boolean onTickStart);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,24 +8,17 @@ import net.minecraft.entity.EntityLiving;
|
|||||||
import net.minecraft.entity.monster.IMob;
|
import net.minecraft.entity.monster.IMob;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.packet.Packet34EntityTeleport;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.LinkData;
|
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.pocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
public class MobMonolith extends EntityFlying implements IMob
|
||||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class MobObelisk extends EntityFlying implements IMob
|
|
||||||
{
|
{
|
||||||
|
|
||||||
float soundTime = 0;
|
float soundTime = 0;
|
||||||
@@ -38,7 +31,7 @@ public class MobObelisk extends EntityFlying implements IMob
|
|||||||
int destY=0;
|
int destY=0;
|
||||||
int destZ=0;
|
int destZ=0;
|
||||||
|
|
||||||
public MobObelisk(World par1World)
|
public MobMonolith(World par1World)
|
||||||
{
|
{
|
||||||
super(par1World);
|
super(par1World);
|
||||||
this.texture="/mods/DimDoors/textures/mobs/Monolith0.png";
|
this.texture="/mods/DimDoors/textures/mobs/Monolith0.png";
|
||||||
@@ -93,7 +86,7 @@ public class MobObelisk extends EntityFlying implements IMob
|
|||||||
@Override
|
@Override
|
||||||
public void onEntityUpdate()
|
public void onEntityUpdate()
|
||||||
{
|
{
|
||||||
if(!(this.worldObj.provider instanceof LimboProvider ||this.worldObj.provider instanceof pocketProvider))
|
if(!(this.worldObj.provider instanceof LimboProvider ||this.worldObj.provider instanceof PocketProvider))
|
||||||
{
|
{
|
||||||
this.setDead();
|
this.setDead();
|
||||||
}
|
}
|
||||||
@@ -140,7 +133,7 @@ public class MobObelisk extends EntityFlying implements IMob
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(this.worldObj.provider instanceof pocketProvider||this.worldObj.getClosestPlayerToEntity(this, 5)!=null)
|
if(this.worldObj.provider instanceof PocketProvider||this.worldObj.getClosestPlayerToEntity(this, 5)!=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
aggro++;
|
aggro++;
|
||||||
@@ -379,7 +372,7 @@ public class MobObelisk extends EntityFlying implements IMob
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(this.worldObj.provider instanceof pocketProvider)
|
else if(this.worldObj.provider instanceof PocketProvider)
|
||||||
{
|
{
|
||||||
if(list.size()>5||this.worldObj.canBlockSeeTheSky((int)this.posX, (int)this.posY, (int)this.posZ))
|
if(list.size()>5||this.worldObj.canBlockSeeTheSky((int)this.posX, (int)this.posY, (int)this.posZ))
|
||||||
{
|
{
|
||||||
203
StevenDimDoors/mod_pocketDim/ticking/MonolithSpawner.java
Normal file
203
StevenDimDoors/mod_pocketDim/ticking/MonolithSpawner.java
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
package StevenDimDoors.mod_pocketDim.ticking;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.world.GameRules;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DimData;
|
||||||
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.util.ChunkLocation;
|
||||||
|
|
||||||
|
public class MonolithSpawner implements IRegularTickReceiver {
|
||||||
|
|
||||||
|
public static final int MAX_MONOLITH_SPAWNING_CHANCE = 100;
|
||||||
|
private static final String MOB_SPAWNING_RULE = "doMobSpawning";
|
||||||
|
private static final int MAX_MONOLITH_SPAWN_Y = 245;
|
||||||
|
private static final int CHUNK_SIZE = 16;
|
||||||
|
private static final int MONOLITH_SPAWNING_INTERVAL = 1;
|
||||||
|
|
||||||
|
private DDProperties properties;
|
||||||
|
private ArrayList<ChunkLocation> locations;
|
||||||
|
|
||||||
|
public MonolithSpawner(IRegularTickSender sender, DDProperties properties)
|
||||||
|
{
|
||||||
|
this.properties = properties;
|
||||||
|
this.locations = new ArrayList<ChunkLocation>();
|
||||||
|
sender.registerForTicking(this, MONOLITH_SPAWNING_INTERVAL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyTick() {
|
||||||
|
|
||||||
|
//Check if any new spawning requests have come in
|
||||||
|
if (!locations.isEmpty())
|
||||||
|
{
|
||||||
|
//Check if mob spawning is allowed
|
||||||
|
if (isMobSpawningAllowed())
|
||||||
|
{
|
||||||
|
//Loop over the locations and call the appropriate function depending
|
||||||
|
//on whether the request is for Limbo or for a pocket dimension.
|
||||||
|
for (ChunkLocation location : locations)
|
||||||
|
{
|
||||||
|
if (location.DimensionID == properties.LimboDimensionID)
|
||||||
|
{
|
||||||
|
//Limbo chunk
|
||||||
|
placeMonolithsInLimbo(location.DimensionID, location.ChunkX, location.ChunkZ);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Pocket dimension chunk
|
||||||
|
placeMonolithsInPocket(location.DimensionID, location.ChunkX, location.ChunkZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
locations.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerChunkForPopulation(int dimensionID, int chunkX, int chunkZ)
|
||||||
|
{
|
||||||
|
ChunkLocation location = new ChunkLocation(dimensionID, chunkX, chunkZ);
|
||||||
|
locations.add(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void placeMonolithsInPocket(int dimensionID, int chunkX, int chunkZ)
|
||||||
|
{
|
||||||
|
World pocket = dimHelper.getWorld(dimensionID);
|
||||||
|
DimData dimData = dimHelper.dimList.get(dimensionID);
|
||||||
|
int sanity = 0;
|
||||||
|
int blockID = 0;
|
||||||
|
boolean didSpawn = false;
|
||||||
|
|
||||||
|
if (pocket == null ||
|
||||||
|
dimData == null ||
|
||||||
|
dimData.dungeonGenerator == null ||
|
||||||
|
dimData.dungeonGenerator.isOpen)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//The following initialization code is based on code from ChunkProviderGenerate.
|
||||||
|
//It makes our generation depend on the world seed.
|
||||||
|
Random random = new Random(pocket.getSeed());
|
||||||
|
long factorA = random.nextLong() / 2L * 2L + 1L;
|
||||||
|
long factorB = random.nextLong() / 2L * 2L + 1L;
|
||||||
|
random.setSeed(chunkX * factorA + chunkZ * factorB ^ pocket.getSeed());
|
||||||
|
|
||||||
|
//The following code really, really needs to be rewritten... "sanity" is not a proper variable name. ~SenseiKiwi
|
||||||
|
int x, y, z;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
//Select a random column within the chunk
|
||||||
|
x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
|
z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
|
y = MAX_MONOLITH_SPAWN_Y;
|
||||||
|
blockID = pocket.getBlockId(x, y, z);
|
||||||
|
|
||||||
|
while (blockID == 0 &&y>0)
|
||||||
|
{
|
||||||
|
y--;
|
||||||
|
blockID = pocket.getBlockId(x, y, z);
|
||||||
|
|
||||||
|
}
|
||||||
|
while ((blockID == properties.FabricBlockID || blockID == properties.PermaFabricBlockID) && y > 0)
|
||||||
|
{
|
||||||
|
y--;
|
||||||
|
blockID = pocket.getBlockId(x, y, z);
|
||||||
|
}
|
||||||
|
while (blockID == 0 && y > 0)
|
||||||
|
{
|
||||||
|
y--;
|
||||||
|
blockID = pocket.getBlockId(x, y, z);
|
||||||
|
}
|
||||||
|
if(y > 0)
|
||||||
|
{
|
||||||
|
int jumpSanity = 0;
|
||||||
|
int jumpHeight = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
jumpHeight = y + random.nextInt(10);
|
||||||
|
jumpSanity++;
|
||||||
|
}
|
||||||
|
while (!pocket.isAirBlock(x,jumpHeight+6 , z)&&jumpSanity<20);
|
||||||
|
|
||||||
|
Entity monolith = new MobMonolith(pocket);
|
||||||
|
monolith.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
||||||
|
pocket.spawnEntityInWorld(monolith);
|
||||||
|
didSpawn = true;
|
||||||
|
}
|
||||||
|
sanity++;
|
||||||
|
}
|
||||||
|
while (sanity < 5 && !didSpawn);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void placeMonolithsInLimbo(int dimensionID, int chunkX, int chunkZ)
|
||||||
|
{
|
||||||
|
World limbo = dimHelper.getWorld(dimensionID);
|
||||||
|
|
||||||
|
if (limbo == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//The following initialization code is based on code from ChunkProviderGenerate.
|
||||||
|
//It makes our generation depend on the world seed.
|
||||||
|
Random random = new Random(limbo.getSeed());
|
||||||
|
long factorA = random.nextLong() / 2L * 2L + 1L;
|
||||||
|
long factorB = random.nextLong() / 2L * 2L + 1L;
|
||||||
|
random.setSeed(chunkX * factorA + chunkZ * factorB ^ limbo.getSeed());
|
||||||
|
|
||||||
|
//Okay, the following code is full of magic constants and makes little sense. =/ ~SenseiKiwi
|
||||||
|
if (random.nextInt(MAX_MONOLITH_SPAWNING_CHANCE) < properties.MonolithSpawningChance)
|
||||||
|
{
|
||||||
|
int y = 0;
|
||||||
|
int yTest;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
int x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
|
int z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE);
|
||||||
|
|
||||||
|
while (limbo.getBlockId(x, y, z) == 0 && y <255)
|
||||||
|
{
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
y = yCoordHelper.getFirstUncovered(limbo, x, y + 2, z);
|
||||||
|
yTest = yCoordHelper.getFirstUncovered(limbo, x, y + 5, z);
|
||||||
|
if (yTest > 245)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int jumpSanity = 0;
|
||||||
|
int jumpHeight = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
jumpHeight = y + random.nextInt(25);
|
||||||
|
jumpSanity++;
|
||||||
|
}
|
||||||
|
while (!limbo.isAirBlock(x, jumpHeight + 6, z) && jumpSanity < 20);
|
||||||
|
|
||||||
|
|
||||||
|
Entity monolith = new MobMonolith(limbo);
|
||||||
|
monolith.setLocationAndAngles(x, jumpHeight, z, 1, 1);
|
||||||
|
limbo.spawnEntityInWorld(monolith);
|
||||||
|
}
|
||||||
|
while (yTest > y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isMobSpawningAllowed()
|
||||||
|
{
|
||||||
|
//This function is used to retrieve the value of doMobSpawning. The code is the same
|
||||||
|
//as the code used by Minecraft. Jaitsu requested this to make testing easier. ~SenseiKiwi
|
||||||
|
|
||||||
|
GameRules rules = MinecraftServer.getServer().worldServerForDimension(0).getGameRules();
|
||||||
|
return rules.getGameRuleBooleanValue(MOB_SPAWNING_RULE);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package StevenDimDoors.mod_pocketDim.ticking;
|
||||||
|
|
||||||
|
public class RegularTickReceiverInfo {
|
||||||
|
|
||||||
|
public IRegularTickReceiver RegularTickReceiver;
|
||||||
|
public int Interval;
|
||||||
|
public boolean OnTickStart;
|
||||||
|
|
||||||
|
public RegularTickReceiverInfo(IRegularTickReceiver regularTickReceiver, int interval, boolean onTickStart)
|
||||||
|
{
|
||||||
|
this.RegularTickReceiver = regularTickReceiver;
|
||||||
|
this.Interval = interval;
|
||||||
|
this.OnTickStart = onTickStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
72
StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java
Normal file
72
StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
package StevenDimDoors.mod_pocketDim.ticking;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
|
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||||
|
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
||||||
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
|
public class RiftRegenerator implements IRegularTickReceiver {
|
||||||
|
|
||||||
|
private static final int RIFT_REGENERATION_INTERVAL = 100; //Regenerate random rifts every 100 ticks
|
||||||
|
|
||||||
|
private DDProperties properties;
|
||||||
|
|
||||||
|
public RiftRegenerator(IRegularTickSender sender)
|
||||||
|
{
|
||||||
|
sender.registerForTicking(this, RIFT_REGENERATION_INTERVAL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyTick()
|
||||||
|
{
|
||||||
|
regenerate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void regenerate()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Regenerate rifts that have been replaced (not permanently removed) by players
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
System.out.println("An exception occurred in RiftRegenerator.regenerate():");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
StevenDimDoors/mod_pocketDim/util/ChunkLocation.java
Normal file
15
StevenDimDoors/mod_pocketDim/util/ChunkLocation.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package StevenDimDoors.mod_pocketDim.util;
|
||||||
|
|
||||||
|
public class ChunkLocation {
|
||||||
|
|
||||||
|
public int ChunkX;
|
||||||
|
public int ChunkZ;
|
||||||
|
public int DimensionID;
|
||||||
|
|
||||||
|
public ChunkLocation(int dimensionID, int chunkX, int chunkZ)
|
||||||
|
{
|
||||||
|
this.DimensionID = dimensionID;
|
||||||
|
this.ChunkX = chunkX;
|
||||||
|
this.ChunkZ = chunkZ;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.world;
|
package StevenDimDoors.mod_pocketDim.world;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
import net.minecraft.entity.monster.EntitySpider;
|
import net.minecraft.entity.monster.EntitySpider;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraft.world.biome.SpawnListEntry;
|
import net.minecraft.world.biome.SpawnListEntry;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.world;
|
package StevenDimDoors.mod_pocketDim.world;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraft.world.biome.SpawnListEntry;
|
import net.minecraft.world.biome.SpawnListEntry;
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,6 @@ package StevenDimDoors.mod_pocketDim.world;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
|
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EnumCreatureType;
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
import net.minecraft.util.IProgressUpdate;
|
import net.minecraft.util.IProgressUpdate;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
@@ -31,6 +22,9 @@ import net.minecraft.world.gen.structure.MapGenVillage;
|
|||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.Event.Result;
|
import net.minecraftforge.event.Event.Result;
|
||||||
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
|
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
|
||||||
|
|
||||||
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
|
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
|
||||||
{
|
{
|
||||||
@@ -110,20 +104,21 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||||||
// caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
|
// caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DDProperties properties = null;
|
private DDProperties properties;
|
||||||
|
private MonolithSpawner spawner;
|
||||||
|
|
||||||
public LimboGenerator(World par1World, long par2)
|
public LimboGenerator(World world, long seed, MonolithSpawner spawner, DDProperties properties)
|
||||||
{
|
{
|
||||||
super(par1World, par2, false);
|
super(world, seed, false);
|
||||||
//par2 = 90899090;
|
|
||||||
this.rand = new Random(par2);
|
LimboGenerator.rand = new Random(seed);
|
||||||
this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); //base terrain
|
this.noiseGen1 = new NoiseGeneratorOctaves(LimboGenerator.rand, 16); //base terrain
|
||||||
this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); //hillyness
|
this.noiseGen2 = new NoiseGeneratorOctaves(LimboGenerator.rand, 16); //hillyness
|
||||||
this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 80); //seems to adjust the size of features, how stretched things are -default 8
|
this.noiseGen3 = new NoiseGeneratorOctaves(LimboGenerator.rand, 80); //seems to adjust the size of features, how stretched things are -default 8
|
||||||
this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4);
|
this.noiseGen4 = new NoiseGeneratorOctaves(LimboGenerator.rand, 4);
|
||||||
this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
|
this.noiseGen5 = new NoiseGeneratorOctaves(LimboGenerator.rand, 10);
|
||||||
this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
|
this.noiseGen6 = new NoiseGeneratorOctaves(LimboGenerator.rand, 16);
|
||||||
this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
|
this.mobSpawnerNoise = new NoiseGeneratorOctaves(LimboGenerator.rand, 8);
|
||||||
|
|
||||||
NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise};
|
NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise};
|
||||||
// noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens);
|
// noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens);
|
||||||
@@ -134,11 +129,11 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||||||
this.noiseGen5 = noiseGens[4];
|
this.noiseGen5 = noiseGens[4];
|
||||||
this.noiseGen6 = noiseGens[5];
|
this.noiseGen6 = noiseGens[5];
|
||||||
this.mobSpawnerNoise = noiseGens[6];
|
this.mobSpawnerNoise = noiseGens[6];
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
this.worldObj=par1World;
|
|
||||||
|
|
||||||
if (properties == null)
|
this.worldObj = world;
|
||||||
properties = DDProperties.instance();
|
|
||||||
|
this.spawner = spawner;
|
||||||
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -153,24 +148,23 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Chunk provideChunk(int par1, int par2)
|
public Chunk provideChunk(int chunkX, int chunkZ)
|
||||||
{
|
{
|
||||||
this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
|
//TODO: Wtf? Why do you reinitialize the seed when we already initialized it in the constructor?! ~SenseiKiwi
|
||||||
|
LimboGenerator.rand.setSeed((long) chunkX * 341873128712L + (long) chunkZ * 132897987541L);
|
||||||
byte[] var3 = new byte[32768];
|
byte[] var3 = new byte[32768];
|
||||||
this.generateTerrain(par1, par2, var3);
|
this.generateTerrain(chunkX, chunkZ, var3);
|
||||||
Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);
|
Chunk var4 = new Chunk(this.worldObj, var3, chunkX, chunkZ);
|
||||||
var4.generateSkylightMap();
|
var4.generateSkylightMap();
|
||||||
|
|
||||||
if(!var4.isTerrainPopulated)
|
if (!var4.isTerrainPopulated)
|
||||||
{
|
{
|
||||||
var4.isTerrainPopulated=true;
|
var4.isTerrainPopulated=true;
|
||||||
CommonTickHandler.chunksToPopulate.add(new int[] {properties.LimboDimensionID,par1,par2});
|
spawner.registerChunkForPopulation(properties.LimboDimensionID, chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return var4;
|
return var4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Chunk loadChunk(int var1, int var2) {
|
public Chunk loadChunk(int var1, int var2) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import net.minecraftforge.client.IRenderHandler;
|
|||||||
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
|
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@@ -23,14 +24,15 @@ public class LimboProvider extends WorldProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IRenderHandler skyRenderer;
|
private IRenderHandler skyRenderer;
|
||||||
private DDProperties properties = null;
|
private DDProperties properties;
|
||||||
|
private MonolithSpawner spawner;
|
||||||
|
|
||||||
public LimboProvider()
|
public LimboProvider()
|
||||||
{
|
{
|
||||||
this.hasNoSky = false;
|
this.hasNoSky = false;
|
||||||
this.skyRenderer = new limboSkyProvider();
|
this.skyRenderer = new LimboSkyProvider();
|
||||||
if (properties == null)
|
this.spawner = mod_pocketDim.spawner;
|
||||||
properties = DDProperties.instance();
|
this.properties = mod_pocketDim.properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@@ -39,12 +41,10 @@ public class LimboProvider extends WorldProvider
|
|||||||
return this.skyRenderer;
|
return this.skyRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerWorldChunkManager()
|
protected void registerWorldChunkManager()
|
||||||
{
|
{
|
||||||
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1);
|
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1);
|
||||||
//this.dimensionId = ConfigAtum.dimensionID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -154,7 +154,8 @@ public class LimboProvider extends WorldProvider
|
|||||||
@Override
|
@Override
|
||||||
public IChunkProvider createChunkGenerator()
|
public IChunkProvider createChunkGenerator()
|
||||||
{
|
{
|
||||||
return new LimboGenerator(worldObj, 45);
|
//TODO: ...We're passing the LimboGenerator a fixed seed. We should be passing the world seed! @_@ ~SenseiKiwi
|
||||||
|
return new LimboGenerator(worldObj, 45, spawner, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
|
public boolean canBlockFreeze(int x, int y, int z, boolean byWater)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import net.minecraft.util.MathHelper;
|
|||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraftforge.client.IRenderHandler;
|
import net.minecraftforge.client.IRenderHandler;
|
||||||
|
|
||||||
public class limboSkyProvider extends IRenderHandler
|
public class LimboSkyProvider extends IRenderHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
int starGLCallList;
|
int starGLCallList;
|
||||||
@@ -1,41 +1,29 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.world;
|
package StevenDimDoors.mod_pocketDim.world;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EnumCreatureType;
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
import net.minecraft.network.packet.Packet34EntityTeleport;
|
|
||||||
import net.minecraft.world.ChunkPosition;
|
import net.minecraft.world.ChunkPosition;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||||
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
|
|
||||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
|
||||||
import StevenDimDoors.mod_pocketDim.DimData;
|
import StevenDimDoors.mod_pocketDim.DimData;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
|
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
|
||||||
|
|
||||||
public class PocketGenerator extends ChunkProviderGenerate implements IChunkProvider
|
public class PocketGenerator extends ChunkProviderGenerate implements IChunkProvider
|
||||||
{
|
{
|
||||||
private World worldObj;
|
private World worldObj;
|
||||||
|
|
||||||
private DDProperties properties = null;
|
private MonolithSpawner spawner;
|
||||||
|
|
||||||
|
public PocketGenerator(World par1World, long par2, boolean par4, MonolithSpawner spawner)
|
||||||
|
|
||||||
public PocketGenerator(World par1World, long par2, boolean par4)
|
|
||||||
{
|
{
|
||||||
super(par1World, par2, par4);
|
super(par1World, par2, par4);
|
||||||
this.worldObj = par1World;
|
this.worldObj = par1World;
|
||||||
|
|
||||||
if (properties == null)
|
this.spawner = spawner;
|
||||||
properties = DDProperties.instance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,8 +46,8 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
|||||||
|
|
||||||
if(!chunk.isTerrainPopulated)
|
if(!chunk.isTerrainPopulated)
|
||||||
{
|
{
|
||||||
chunk.isTerrainPopulated=true;
|
chunk.isTerrainPopulated = true;
|
||||||
CommonTickHandler.chunksToPopulate.add(new int[] {chunk.worldObj.provider.dimensionId,chunkX,chunkZ});
|
spawner.registerChunkForPopulation(worldObj.provider.dimensionId, chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
return chunk;
|
return chunk;
|
||||||
@@ -77,6 +65,7 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
@Override
|
@Override
|
||||||
public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3, int var4)
|
public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3, int var4)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.world;
|
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;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.WorldProvider;
|
import net.minecraft.world.WorldProvider;
|
||||||
import net.minecraft.world.biome.WorldChunkManagerHell;
|
import net.minecraft.world.biome.WorldChunkManagerHell;
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import StevenDimDoors.mod_pocketDim.CloudRenderBlank;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class pocketProvider extends WorldProvider
|
public class PocketProvider extends WorldProvider
|
||||||
{
|
{
|
||||||
public int exitXCoord;
|
public int exitXCoord;
|
||||||
public int exitYCoord;
|
public int exitYCoord;
|
||||||
@@ -24,13 +24,14 @@ public class pocketProvider extends WorldProvider
|
|||||||
|
|
||||||
public boolean isSavingSchematic= false;
|
public boolean isSavingSchematic= false;
|
||||||
public int dimToSave;
|
public int dimToSave;
|
||||||
private static DDProperties properties = null;
|
private DDProperties properties;
|
||||||
|
private MonolithSpawner spawner;
|
||||||
|
|
||||||
public pocketProvider()
|
public PocketProvider()
|
||||||
{
|
{
|
||||||
this.hasNoSky=true;
|
this.hasNoSky = true;
|
||||||
if (properties == null)
|
this.spawner = mod_pocketDim.spawner;
|
||||||
properties = DDProperties.instance();
|
this.properties = mod_pocketDim.properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,7 +80,7 @@ public class pocketProvider extends WorldProvider
|
|||||||
@Override
|
@Override
|
||||||
public IChunkProvider createChunkGenerator()
|
public IChunkProvider createChunkGenerator()
|
||||||
{
|
{
|
||||||
return new PocketGenerator(worldObj, dimensionId, false);
|
return new PocketGenerator(worldObj, dimensionId, false, spawner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -8,11 +8,11 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.src.ModLoader;
|
import net.minecraft.src.ModLoader;
|
||||||
import net.minecraftforge.client.MinecraftForgeClient;
|
import net.minecraftforge.client.MinecraftForgeClient;
|
||||||
import StevenDimDoors.mod_pocketDim.CommonProxy;
|
import StevenDimDoors.mod_pocketDim.CommonProxy;
|
||||||
import StevenDimDoors.mod_pocketDim.CommonTickHandler;
|
|
||||||
import StevenDimDoors.mod_pocketDim.Spells;
|
import StevenDimDoors.mod_pocketDim.Spells;
|
||||||
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
|
import StevenDimDoors.mod_pocketDim.TileEntityDimDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
||||||
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
|
|
||||||
|
|
||||||
public class ClientProxy extends CommonProxy
|
public class ClientProxy extends CommonProxy
|
||||||
@@ -27,7 +27,7 @@ public class ClientProxy extends CommonProxy
|
|||||||
|
|
||||||
|
|
||||||
//MinecraftForgeClient.preloadTexture(RIFT2_PNG);
|
//MinecraftForgeClient.preloadTexture(RIFT2_PNG);
|
||||||
RenderingRegistry.registerEntityRenderingHandler(MobObelisk.class, new RenderMobObelisk(.5F));
|
RenderingRegistry.registerEntityRenderingHandler(MobMonolith.class, new RenderMobObelisk(.5F));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
@@ -55,7 +55,7 @@ public class ModelMobObelisk extends ModelBase
|
|||||||
this.setRotationAngles(0, 0, 0, 0, 0,0, par1Entity);
|
this.setRotationAngles(0, 0, 0, 0, 0,0, par1Entity);
|
||||||
|
|
||||||
|
|
||||||
GL11.glScalef(((MobObelisk) par1Entity).getRenderSizeModifier(), ((MobObelisk) par1Entity).getRenderSizeModifier(), ((MobObelisk) par1Entity).getRenderSizeModifier());
|
GL11.glScalef(((MobMonolith) par1Entity).getRenderSizeModifier(), ((MobMonolith) par1Entity).getRenderSizeModifier(), ((MobMonolith) par1Entity).getRenderSizeModifier());
|
||||||
wholemonolith.render(par7);
|
wholemonolith.render(par7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package StevenDimDoors.mod_pocketDimClient;
|
package StevenDimDoors.mod_pocketDimClient;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
|
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
|||||||
Reference in New Issue
Block a user