diff --git a/StevenDimDoors/mod_pocketDim/CommonTickHandler.java b/StevenDimDoors/mod_pocketDim/CommonTickHandler.java deleted file mode 100644 index 5fee0a4..0000000 --- a/StevenDimDoors/mod_pocketDim/CommonTickHandler.java +++ /dev/null @@ -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 chunksToPopulate = new ArrayList(); - - 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 type, Object... tickData) - { - if (type.equals(EnumSet.of(TickType.SERVER))) - { - onServerTick(); - } - } - - @Override - public void tickEnd(EnumSet 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 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(); - } - } -} diff --git a/StevenDimDoors/mod_pocketDim/DDProperties.java b/StevenDimDoors/mod_pocketDim/DDProperties.java index a4b0ca4..51b0fb2 100644 --- a/StevenDimDoors/mod_pocketDim/DDProperties.java +++ b/StevenDimDoors/mod_pocketDim/DDProperties.java @@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim; import java.io.File; import net.minecraftforge.common.Configuration; +import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner; public class DDProperties { @@ -206,7 +207,7 @@ public class DDProperties "Sets whether dungeon rifts generate in dimensions other than Limbo").getBoolean(true); 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(); ClusterGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Cluster Generation Chance", 3, diff --git a/StevenDimDoors/mod_pocketDim/LimboDecay.java b/StevenDimDoors/mod_pocketDim/LimboDecay.java index fc10e3e..8038541 100644 --- a/StevenDimDoors/mod_pocketDim/LimboDecay.java +++ b/StevenDimDoors/mod_pocketDim/LimboDecay.java @@ -7,67 +7,68 @@ import net.minecraft.block.BlockContainer; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; 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 * 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 DECAY_SPREAD_CHANCE = 50; private static final int CHUNK_SIZE = 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. - //Must be initialized later since it requires DDProperties to be initialized (for LimboBlockID). - private static int[] decaySequence = null; + private final int[] decaySequence; - private static Random random = new Random(); - private static DDProperties properties = null; + private Random random; + private DDProperties properties = null; - private LimboDecay() { } + public LimboDecay(IRegularTickSender tickSender, DDProperties properties) + { + decaySequence = new int[] { + properties.LimboBlockID, + Block.gravel.blockID, + Block.cobblestone.blockID, + Block.stone.blockID + }; + + this.properties = properties; + this.random = new Random(); + tickSender.registerForTicking(this, LIMBO_DECAY_INTERVAL, false); + } /** - * Initializes the array containing the reversed sequence of block IDs that blocks cycle through during decay. + * Applies fast Limbo decay periodically. */ - private static void InitializeDecaySequence() + @Override + public void notifyTick() { - if (decaySequence == null) - { - if (properties == null) - properties = DDProperties.instance(); - - decaySequence = new int[] { - properties.LimboBlockID, - Block.gravel.blockID, - Block.cobblestone.blockID, - Block.stone.blockID - }; - } + applyRandomFastDecay(); } - + /** * 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. */ - public static void ApplySpreadDecay(World world, int x, int y, int z) - { - if (properties == null) - properties = DDProperties.instance(); - + public void applySpreadDecay(World world, int x, int y, int z) + { //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. if (random.nextInt(MAX_DECAY_SPREAD_CHANCE) < DECAY_SPREAD_CHANCE) { //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 - 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 - 1, z); - DecayBlock(world, x, y + 1, 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 - 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. * 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 sectionY; int limboHeight; @@ -102,7 +100,7 @@ public class LimboDecay { x = chunkCoord.chunkXPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); z = chunkCoord.chunkZPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); 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. */ - 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); - if (CanDecayBlock(blockID)) + if (canDecayBlock(blockID)) { world.setBlock(x, y, z, properties.LimboBlockID); 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. */ - 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 blockID = world.getBlockId(x, y, z); - if (CanDecayBlock(blockID)) + if (canDecayBlock(blockID)) { //Loop over the block IDs that decay can go through. //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. */ - private static boolean CanDecayBlock(int blockID) + private boolean canDecayBlock(int blockID) { if (blockID == 0 || blockID == properties.LimboBlockID || blockID == properties.PermaFabricBlockID) return false; diff --git a/StevenDimDoors/mod_pocketDim/RiftGenerator.java b/StevenDimDoors/mod_pocketDim/RiftGenerator.java index 7688806..5c3715a 100644 --- a/StevenDimDoors/mod_pocketDim/RiftGenerator.java +++ b/StevenDimDoors/mod_pocketDim/RiftGenerator.java @@ -10,7 +10,7 @@ import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade; import StevenDimDoors.mod_pocketDim.items.itemDimDoor; import StevenDimDoors.mod_pocketDim.world.LimboProvider; -import StevenDimDoors.mod_pocketDim.world.pocketProvider; +import StevenDimDoors.mod_pocketDim.world.PocketProvider; import cpw.mods.fml.common.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, //the current world is a pocket dimension, or the world is remote. if ((!properties.WorldRiftGenerationEnabled && !(world.provider instanceof LimboProvider)) || - world.provider instanceof pocketProvider || world.isRemote) + world.provider instanceof PocketProvider || world.isRemote) { return; } diff --git a/StevenDimDoors/mod_pocketDim/SchematicLoader.java b/StevenDimDoors/mod_pocketDim/SchematicLoader.java index c993836..332c535 100644 --- a/StevenDimDoors/mod_pocketDim/SchematicLoader.java +++ b/StevenDimDoors/mod_pocketDim/SchematicLoader.java @@ -31,7 +31,7 @@ import net.minecraftforge.common.ChestGenHooks; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; -import StevenDimDoors.mod_pocketDim.ticking.MobObelisk; +import StevenDimDoors.mod_pocketDim.ticking.MobMonolith; public class SchematicLoader { @@ -1151,7 +1151,7 @@ public class SchematicLoader Point3D frameLocation = point.clone(); 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 world.spawnEntityInWorld(mob); } diff --git a/StevenDimDoors/mod_pocketDim/TileEntityRift.java b/StevenDimDoors/mod_pocketDim/TileEntityRift.java index ba7d97c..2d057bb 100644 --- a/StevenDimDoors/mod_pocketDim/TileEntityRift.java +++ b/StevenDimDoors/mod_pocketDim/TileEntityRift.java @@ -8,7 +8,7 @@ import java.util.Random; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; 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.EntityList; diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java b/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java index bfbd133..8d43ab6 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java @@ -16,11 +16,13 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockLimbo extends Block { 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); this.limboDimensionID = limboDimensionID; + this.decay = decay; this.setTickRandomly(true); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); } @@ -56,7 +58,7 @@ public class BlockLimbo extends Block //Make sure this block is in Limbo if (world.provider.dimensionId == limboDimensionID) { - LimboDecay.ApplySpreadDecay(world, x, y, z); + decay.applySpreadDecay(world, x, y, z); } } } diff --git a/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java b/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java index c4aaad2..c1655a5 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java +++ b/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java @@ -4,7 +4,7 @@ import StevenDimDoors.mod_pocketDim.DimData; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; 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.material.Material; import net.minecraft.client.renderer.texture.IconRegister; @@ -48,7 +48,7 @@ public class dimHatch extends BlockTrapDoor 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); diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java b/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java similarity index 82% rename from StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java rename to StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java index 39fbccf..27a0d5f 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java @@ -4,19 +4,19 @@ import net.minecraft.entity.player.EntityPlayer; import StevenDimDoors.mod_pocketDim.LinkData; 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", ""); } - public static CommandStartDungeonCreation instance() + public static CommandCreatePocket instance() { if (instance == null) - instance = new CommandStartDungeonCreation(); + instance = new CommandCreatePocket(); return instance; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java b/StevenDimDoors/mod_pocketDim/commands/CommandExportDungeon.java similarity index 70% rename from StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java rename to StevenDimDoors/mod_pocketDim/commands/CommandExportDungeon.java index 9e1127c..9ba047c 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandEndDungeonCreation.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandExportDungeon.java @@ -6,21 +6,21 @@ import net.minecraft.entity.player.EntityPlayer; import StevenDimDoors.mod_pocketDim.DDProperties; 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[] { - " <'open' | 'closed'> [weight] ['override']", + " <'open' | 'closed'> [weight]", " override" } ); } - public static CommandEndDungeonCreation instance() + public static CommandExportDungeon instance() { if (instance == null) - instance = new CommandEndDungeonCreation(); + instance = new CommandExportDungeon(); return instance; } @@ -29,11 +29,8 @@ public class CommandEndDungeonCreation extends DDCommandBase protected DDCommandResult processCommand(EntityPlayer sender, String[] command) { /* - * There are two versions of this command. One version takes 3 to 5 arguments consisting - * of the information needed for a proper schematic name and an optional override argument. - * 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. + * There are two versions of this command. One version takes 3 to 4 arguments consisting + * of the information needed for a proper schematic name. * * 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 @@ -46,7 +43,7 @@ public class CommandEndDungeonCreation extends DDCommandBase { return DDCommandResult.TOO_FEW_ARGUMENTS; } - if (command.length > 5) + if (command.length > 4) { 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 - //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? //Something feels wrong... ~SenseiKiwi - if (!sender.worldObj.isRemote) { //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])) { @@ -106,29 +94,23 @@ public class CommandEndDungeonCreation extends DDCommandBase 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) { return exportDungeon(sender, join(command, "_", 0, 3)); } - - //Validate the 4th argument, which might be the weight or might be "override". - try + else { - int weight = Integer.parseInt(command[3]); - if (weight >= 0 && weight <= DungeonHelper.MAX_DUNGEON_WEIGHT) + //Validate the weight argument + try { - return exportDungeon(sender, join(command, "_", 0, 4)); - } - } - 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)); + int weight = Integer.parseInt(command[3]); + if (weight >= 0 && weight <= DungeonHelper.MAX_DUNGEON_WEIGHT) + { + return exportDungeon(sender, join(command, "_", 0, 4)); + } } + catch (Exception e) { } } //If we've reached this point, then we must have an invalid weight. diff --git a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java index 6ba3378..268fbd2 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java @@ -61,8 +61,6 @@ public class DungeonHelper }; private Random rand = new Random(); - - private HashMap customDungeonStatus = new HashMap(); public ArrayList customDungeons = new ArrayList(); public ArrayList registeredDungeons = new ArrayList(); @@ -157,18 +155,9 @@ public class DungeonHelper //Place a Warp Door linked to that pocket 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; } - public boolean isCustomDungeon(int dimensionID) - { - return customDungeonStatus.containsKey(dimensionID); - } - public boolean validateDungeonType(String type) { //Check if the dungeon type is valid diff --git a/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java b/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java index 97938ad..795c603 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java @@ -42,7 +42,7 @@ import StevenDimDoors.mod_pocketDim.Point3D; import StevenDimDoors.mod_pocketDim.TileEntityRift; import StevenDimDoors.mod_pocketDim.mod_pocketDim; 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.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; @@ -386,7 +386,7 @@ public class dimHelper extends DimensionManager } 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); } diff --git a/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java b/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java index 50dafe8..5ed6bfe 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java @@ -2,12 +2,12 @@ package StevenDimDoors.mod_pocketDim.items; import java.util.List; -import StevenDimDoors.mod_pocketDim.CommonTickHandler; import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.SchematicLoader; import StevenDimDoors.mod_pocketDim.Spells; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; +import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler; import StevenDimDoors.mod_pocketDimClient.ClientTickHandler; import net.minecraft.block.Block; diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index eadedad..068299c 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -24,14 +24,14 @@ import StevenDimDoors.mod_pocketDim.blocks.ExitDoor; import StevenDimDoors.mod_pocketDim.blocks.dimDoor; import StevenDimDoors.mod_pocketDim.blocks.dimHatch; import StevenDimDoors.mod_pocketDim.commands.CommandCreateDungeonRift; +import StevenDimDoors.mod_pocketDim.commands.CommandCreatePocket; import StevenDimDoors.mod_pocketDim.commands.CommandDeleteAllLinks; import StevenDimDoors.mod_pocketDim.commands.CommandDeleteDimensionData; 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.CommandPruneDimensions; import StevenDimDoors.mod_pocketDim.commands.CommandResetDungeons; -import StevenDimDoors.mod_pocketDim.commands.CommandStartDungeonCreation; import StevenDimDoors.mod_pocketDim.helpers.BlockRotationHelper; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; 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.itemLinkSignature; 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.BiomeGenPocket; 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.ClientTickHandler; import cpw.mods.fml.common.Mod; @@ -130,7 +133,8 @@ public class mod_pocketDim public static boolean hasInitDims = 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 long genTime; @@ -175,6 +179,15 @@ public class mod_pocketDim @Init 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"); @@ -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"); 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, 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) ); 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"); @@ -215,7 +228,7 @@ public class mod_pocketDim 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.registerDimension(properties.LimboDimensionID, properties.LimboProviderID); @@ -246,17 +259,14 @@ public class mod_pocketDim 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, "TileEntityDimDoor"); GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift"); - EntityRegistry.registerModEntity(MobObelisk.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true); - EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobObelisk.class); + EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true); + EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobMonolith.class); EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff)); LanguageRegistry.instance().addStringLocalization("entity.DimDoors.Obelisk.name", "Monolith"); @@ -428,10 +438,10 @@ public class mod_pocketDim CommandDeleteAllLinks.instance().register(event); CommandDeleteDimensionData.instance().register(event); CommandDeleteRifts.instance().register(event); - CommandEndDungeonCreation.instance().register(event); + CommandExportDungeon.instance().register(event); CommandPrintDimensionData.instance().register(event); CommandPruneDimensions.instance().register(event); - CommandStartDungeonCreation.instance().register(event); + CommandCreatePocket.instance().register(event); dimHelper.instance.load(); if(!dimHelper.dimList.containsKey(properties.LimboDimensionID)) diff --git a/StevenDimDoors/mod_pocketDim/ticking/CommonTickHandler.java b/StevenDimDoors/mod_pocketDim/ticking/CommonTickHandler.java new file mode 100644 index 0000000..6cf3ecd --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/ticking/CommonTickHandler.java @@ -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 receivers; + + + public CommonTickHandler() + { + this.receivers = new ArrayList(); + } + + @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 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 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 ticks() + { + return EnumSet.of(TickType.SERVER); + } + + @Override + public String getLabel() + { + return PROFILING_LABEL; //Used for profiling! + } +} diff --git a/StevenDimDoors/mod_pocketDim/ticking/IRegularTickReceiver.java b/StevenDimDoors/mod_pocketDim/ticking/IRegularTickReceiver.java new file mode 100644 index 0000000..97edb70 --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/ticking/IRegularTickReceiver.java @@ -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(); +} diff --git a/StevenDimDoors/mod_pocketDim/ticking/IRegularTickSender.java b/StevenDimDoors/mod_pocketDim/ticking/IRegularTickSender.java new file mode 100644 index 0000000..6ed2dca --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/ticking/IRegularTickSender.java @@ -0,0 +1,8 @@ +package StevenDimDoors.mod_pocketDim.ticking; + + +public interface IRegularTickSender { + + public void registerForTicking(IRegularTickReceiver receiver, int interval, boolean onTickStart); + +} diff --git a/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java similarity index 93% rename from StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java rename to StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java index b91b65e..1cdb7f3 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java +++ b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java @@ -8,24 +8,17 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.packet.Packet34EntityTeleport; 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; import StevenDimDoors.mod_pocketDim.world.LimboProvider; -import StevenDimDoors.mod_pocketDim.world.pocketProvider; +import StevenDimDoors.mod_pocketDim.world.PocketProvider; -import cpw.mods.fml.client.FMLClientHandler; -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 +public class MobMonolith extends EntityFlying implements IMob { float soundTime = 0; @@ -38,7 +31,7 @@ public class MobObelisk extends EntityFlying implements IMob int destY=0; int destZ=0; - public MobObelisk(World par1World) + public MobMonolith(World par1World) { super(par1World); this.texture="/mods/DimDoors/textures/mobs/Monolith0.png"; @@ -93,7 +86,7 @@ public class MobObelisk extends EntityFlying implements IMob @Override 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(); } @@ -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++; @@ -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)) { diff --git a/StevenDimDoors/mod_pocketDim/ticking/MonolithSpawner.java b/StevenDimDoors/mod_pocketDim/ticking/MonolithSpawner.java new file mode 100644 index 0000000..fb2fece --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/ticking/MonolithSpawner.java @@ -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 locations; + + public MonolithSpawner(IRegularTickSender sender, DDProperties properties) + { + this.properties = properties; + this.locations = new ArrayList(); + 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); + } +} diff --git a/StevenDimDoors/mod_pocketDim/ticking/RegularTickReceiverInfo.java b/StevenDimDoors/mod_pocketDim/ticking/RegularTickReceiverInfo.java new file mode 100644 index 0000000..2c49bb2 --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/ticking/RegularTickReceiverInfo.java @@ -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; + } + +} diff --git a/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java b/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java new file mode 100644 index 0000000..389c71d --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java @@ -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(); + } + } +} diff --git a/StevenDimDoors/mod_pocketDim/util/ChunkLocation.java b/StevenDimDoors/mod_pocketDim/util/ChunkLocation.java new file mode 100644 index 0000000..0f1c5c1 --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/util/ChunkLocation.java @@ -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; + } +} diff --git a/StevenDimDoors/mod_pocketDim/world/BiomeGenLimbo.java b/StevenDimDoors/mod_pocketDim/world/BiomeGenLimbo.java index e8b48e1..4b8fd1d 100644 --- a/StevenDimDoors/mod_pocketDim/world/BiomeGenLimbo.java +++ b/StevenDimDoors/mod_pocketDim/world/BiomeGenLimbo.java @@ -1,6 +1,6 @@ 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.world.biome.BiomeGenBase; import net.minecraft.world.biome.SpawnListEntry; diff --git a/StevenDimDoors/mod_pocketDim/world/BiomeGenPocket.java b/StevenDimDoors/mod_pocketDim/world/BiomeGenPocket.java index 7a884a8..3fe0c57 100644 --- a/StevenDimDoors/mod_pocketDim/world/BiomeGenPocket.java +++ b/StevenDimDoors/mod_pocketDim/world/BiomeGenPocket.java @@ -1,6 +1,6 @@ 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.SpawnListEntry; diff --git a/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java b/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java index 0dae107..9ea9aa3 100644 --- a/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java +++ b/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java @@ -3,15 +3,6 @@ package StevenDimDoors.mod_pocketDim.world; import java.util.List; 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.util.IProgressUpdate; import net.minecraft.util.MathHelper; @@ -31,6 +22,9 @@ import net.minecraft.world.gen.structure.MapGenVillage; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event.Result; 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 { @@ -110,20 +104,21 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi // 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); - //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); + super(world, seed, false); + + LimboGenerator.rand = new Random(seed); + this.noiseGen1 = new NoiseGeneratorOctaves(LimboGenerator.rand, 16); //base terrain + this.noiseGen2 = new NoiseGeneratorOctaves(LimboGenerator.rand, 16); //hillyness + this.noiseGen3 = new NoiseGeneratorOctaves(LimboGenerator.rand, 80); //seems to adjust the size of features, how stretched things are -default 8 + this.noiseGen4 = new NoiseGeneratorOctaves(LimboGenerator.rand, 4); + this.noiseGen5 = new NoiseGeneratorOctaves(LimboGenerator.rand, 10); + this.noiseGen6 = new NoiseGeneratorOctaves(LimboGenerator.rand, 16); + this.mobSpawnerNoise = new NoiseGeneratorOctaves(LimboGenerator.rand, 8); NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise}; // noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens); @@ -134,11 +129,11 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi this.noiseGen5 = noiseGens[4]; this.noiseGen6 = noiseGens[5]; this.mobSpawnerNoise = noiseGens[6]; - // TODO Auto-generated constructor stub - this.worldObj=par1World; + + this.worldObj = world; - if (properties == null) - properties = DDProperties.instance(); + this.spawner = spawner; + this.properties = properties; } @Override @@ -153,24 +148,23 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi } @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]; - this.generateTerrain(par1, par2, var3); - Chunk var4 = new Chunk(this.worldObj, var3, par1, par2); + this.generateTerrain(chunkX, chunkZ, var3); + Chunk var4 = new Chunk(this.worldObj, var3, chunkX, chunkZ); var4.generateSkylightMap(); - if(!var4.isTerrainPopulated) + if (!var4.isTerrainPopulated) { var4.isTerrainPopulated=true; - CommonTickHandler.chunksToPopulate.add(new int[] {properties.LimboDimensionID,par1,par2}); + spawner.registerChunkForPopulation(properties.LimboDimensionID, chunkX, chunkZ); } - - - return var4; } + @Override public Chunk loadChunk(int var1, int var2) { // TODO Auto-generated method stub diff --git a/StevenDimDoors/mod_pocketDim/world/LimboProvider.java b/StevenDimDoors/mod_pocketDim/world/LimboProvider.java index 02e7b82..166a89f 100644 --- a/StevenDimDoors/mod_pocketDim/world/LimboProvider.java +++ b/StevenDimDoors/mod_pocketDim/world/LimboProvider.java @@ -12,6 +12,7 @@ import net.minecraftforge.client.IRenderHandler; import StevenDimDoors.mod_pocketDim.CloudRenderBlank; import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -23,14 +24,15 @@ public class LimboProvider extends WorldProvider } private IRenderHandler skyRenderer; - private DDProperties properties = null; + private DDProperties properties; + private MonolithSpawner spawner; public LimboProvider() { this.hasNoSky = false; - this.skyRenderer = new limboSkyProvider(); - if (properties == null) - properties = DDProperties.instance(); + this.skyRenderer = new LimboSkyProvider(); + this.spawner = mod_pocketDim.spawner; + this.properties = mod_pocketDim.properties; } @SideOnly(Side.CLIENT) @@ -39,12 +41,10 @@ public class LimboProvider extends WorldProvider return this.skyRenderer; } - @Override protected void registerWorldChunkManager() { super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1); - //this.dimensionId = ConfigAtum.dimensionID; } @Override @@ -154,7 +154,8 @@ public class LimboProvider extends WorldProvider @Override 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) diff --git a/StevenDimDoors/mod_pocketDim/world/limboSkyProvider.java b/StevenDimDoors/mod_pocketDim/world/LimboSkyProvider.java similarity index 99% rename from StevenDimDoors/mod_pocketDim/world/limboSkyProvider.java rename to StevenDimDoors/mod_pocketDim/world/LimboSkyProvider.java index 52e4cfe..21b1d73 100644 --- a/StevenDimDoors/mod_pocketDim/world/limboSkyProvider.java +++ b/StevenDimDoors/mod_pocketDim/world/LimboSkyProvider.java @@ -11,7 +11,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraftforge.client.IRenderHandler; -public class limboSkyProvider extends IRenderHandler +public class LimboSkyProvider extends IRenderHandler { int starGLCallList; diff --git a/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java b/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java index e897446..1744f7e 100644 --- a/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java +++ b/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java @@ -1,41 +1,29 @@ package StevenDimDoors.mod_pocketDim.world; 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.network.packet.Packet34EntityTeleport; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; 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.mod_pocketDim; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; -import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; -import StevenDimDoors.mod_pocketDim.ticking.MobObelisk; +import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner; public class PocketGenerator extends ChunkProviderGenerate implements IChunkProvider { private World worldObj; - private DDProperties properties = null; - - + private MonolithSpawner spawner; - public PocketGenerator(World par1World, long par2, boolean par4) + public PocketGenerator(World par1World, long par2, boolean par4, MonolithSpawner spawner) { super(par1World, par2, par4); this.worldObj = par1World; - if (properties == null) - properties = DDProperties.instance(); + this.spawner = spawner; } @Override @@ -58,8 +46,8 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv if(!chunk.isTerrainPopulated) { - chunk.isTerrainPopulated=true; - CommonTickHandler.chunksToPopulate.add(new int[] {chunk.worldObj.provider.dimensionId,chunkX,chunkZ}); + chunk.isTerrainPopulated = true; + spawner.registerChunkForPopulation(worldObj.provider.dimensionId, chunkX, chunkZ); } return chunk; @@ -77,6 +65,7 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv } + @SuppressWarnings("rawtypes") @Override public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3, int var4) { diff --git a/StevenDimDoors/mod_pocketDim/world/pocketProvider.java b/StevenDimDoors/mod_pocketDim/world/PocketProvider.java similarity index 87% rename from StevenDimDoors/mod_pocketDim/world/pocketProvider.java rename to StevenDimDoors/mod_pocketDim/world/PocketProvider.java index 9f61609..e6047d3 100644 --- a/StevenDimDoors/mod_pocketDim/world/pocketProvider.java +++ b/StevenDimDoors/mod_pocketDim/world/PocketProvider.java @@ -1,20 +1,20 @@ 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.player.EntityPlayerMP; import net.minecraft.util.Vec3; import net.minecraft.world.WorldProvider; import net.minecraft.world.biome.WorldChunkManagerHell; 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.SideOnly; -public class pocketProvider extends WorldProvider +public class PocketProvider extends WorldProvider { public int exitXCoord; public int exitYCoord; @@ -24,13 +24,14 @@ public class pocketProvider extends WorldProvider public boolean isSavingSchematic= false; public int dimToSave; - private static DDProperties properties = null; + private DDProperties properties; + private MonolithSpawner spawner; - public pocketProvider() + public PocketProvider() { - this.hasNoSky=true; - if (properties == null) - properties = DDProperties.instance(); + this.hasNoSky = true; + this.spawner = mod_pocketDim.spawner; + this.properties = mod_pocketDim.properties; } @Override @@ -79,7 +80,7 @@ public class pocketProvider extends WorldProvider @Override public IChunkProvider createChunkGenerator() { - return new PocketGenerator(worldObj, dimensionId, false); + return new PocketGenerator(worldObj, dimensionId, false, spawner); } @Override diff --git a/StevenDimDoors/mod_pocketDimClient/ClientProxy.java b/StevenDimDoors/mod_pocketDimClient/ClientProxy.java index 6c1668d..e169140 100644 --- a/StevenDimDoors/mod_pocketDimClient/ClientProxy.java +++ b/StevenDimDoors/mod_pocketDimClient/ClientProxy.java @@ -8,11 +8,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.src.ModLoader; import net.minecraftforge.client.MinecraftForgeClient; import StevenDimDoors.mod_pocketDim.CommonProxy; -import StevenDimDoors.mod_pocketDim.CommonTickHandler; import StevenDimDoors.mod_pocketDim.Spells; import StevenDimDoors.mod_pocketDim.TileEntityDimDoor; 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 @@ -27,7 +27,7 @@ public class ClientProxy extends CommonProxy //MinecraftForgeClient.preloadTexture(RIFT2_PNG); - RenderingRegistry.registerEntityRenderingHandler(MobObelisk.class, new RenderMobObelisk(.5F)); + RenderingRegistry.registerEntityRenderingHandler(MobMonolith.class, new RenderMobObelisk(.5F)); diff --git a/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java b/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java index 172008f..564a9ca 100644 --- a/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java +++ b/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java @@ -17,7 +17,7 @@ import java.util.Random; 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.ModelRenderer; @@ -55,7 +55,7 @@ public class ModelMobObelisk extends ModelBase 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); } diff --git a/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java b/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java index 4a6a8c7..e1060a9 100644 --- a/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java +++ b/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java @@ -1,6 +1,6 @@ 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.entity.Entity; import net.minecraft.entity.EntityLiving;