From e4ee4a3cee6a791dec00420c73be8ad68c70d906 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Wed, 6 Nov 2013 15:46:43 -0500 Subject: [PATCH 01/13] crafting change --- StevenDimDoors/mod_pocketDim/CraftingManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StevenDimDoors/mod_pocketDim/CraftingManager.java b/StevenDimDoors/mod_pocketDim/CraftingManager.java index 065ae05f..11260ff8 100644 --- a/StevenDimDoors/mod_pocketDim/CraftingManager.java +++ b/StevenDimDoors/mod_pocketDim/CraftingManager.java @@ -98,7 +98,7 @@ public class CraftingManager { GameRegistry.addRecipe(new ItemStack(itemStableFabric, 1), new Object[] { - " y ", "yxy", " y ", 'x', coreCraftingItem, 'y', mod_pocketDim.itemWorldThread + "yyy", "yxy", "yyy", 'x', coreCraftingItem, 'y', mod_pocketDim.itemWorldThread }); } From 6b3b2d647147c0311a16a8d8cd7515a486ef5d5a Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Thu, 7 Nov 2013 00:32:04 -0500 Subject: [PATCH 02/13] Fixed Chunk Loading crash --- .../helpers/ChunkLoaderHelper.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/helpers/ChunkLoaderHelper.java b/StevenDimDoors/mod_pocketDim/helpers/ChunkLoaderHelper.java index 1e368ec0..e758218a 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/ChunkLoaderHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/ChunkLoaderHelper.java @@ -23,18 +23,26 @@ public class ChunkLoaderHelper implements LoadingCallback { @Override - public void ticketsLoaded(List tickets, World world) - { - for (Ticket ticket : tickets) - { - int goldDimDoorX = ticket.getModData().getInteger("goldDimDoorX"); - int goldDimDoorY = ticket.getModData().getInteger("goldDimDoorY"); - int goldDimDoorZ = ticket.getModData().getInteger("goldDimDoorZ"); - IChunkLoader tile = (IChunkLoader) world.getBlockTileEntity(goldDimDoorX, goldDimDoorY, goldDimDoorZ); - tile.forceChunkLoading(ticket,goldDimDoorX,goldDimDoorZ); - - } - } + public void ticketsLoaded(List tickets, World world) + { + for (Ticket ticket : tickets) + { + int goldDimDoorX = ticket.getModData().getInteger("goldDimDoorX"); + int goldDimDoorY = ticket.getModData().getInteger("goldDimDoorY"); + int goldDimDoorZ = ticket.getModData().getInteger("goldDimDoorZ"); + if(world.getBlockId(goldDimDoorX, goldDimDoorY, goldDimDoorZ)!=mod_pocketDim.properties.GoldDimDoorID) + { + ForgeChunkManager.releaseTicket(ticket); + } + else + { + IChunkLoader tile = (IChunkLoader) world.getBlockTileEntity(goldDimDoorX, goldDimDoorY, goldDimDoorZ); + tile.forceChunkLoading(ticket,goldDimDoorX,goldDimDoorZ); + } + } + } + + public static void loadChunkForcedWorlds(FMLServerStartingEvent event) { From 0f49c8c28f69e8f9785ce423f073df479d400016 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Mon, 11 Nov 2013 03:07:55 -0500 Subject: [PATCH 03/13] Small Fixes --- StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java | 8 ++++++++ .../mod_pocketDim/blocks/BlockGoldDimDoor.java | 9 ++++++--- StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java | 2 +- StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java b/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java index fdc26c3f..5dead11f 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java @@ -1,5 +1,7 @@ package StevenDimDoors.mod_pocketDim.blocks; +import java.util.Random; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import StevenDimDoors.mod_pocketDim.DDProperties; @@ -7,6 +9,7 @@ import StevenDimDoors.mod_pocketDim.mod_pocketDim; import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.item.Item; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; @@ -23,6 +26,11 @@ public class BlockDoorGold extends BlockDoor } + public int idDropped(int par1, Random par2Random, int par3) + { + return mod_pocketDim.itemGoldDoor.itemID; + } + public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_top"); diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java b/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java index 9089d0e2..66feccc4 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java @@ -1,10 +1,13 @@ package StevenDimDoors.mod_pocketDim.blocks; +import java.util.Random; + import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DDProperties; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.LinkTypes; import StevenDimDoors.mod_pocketDim.core.NewDimData; @@ -37,9 +40,9 @@ public class BlockGoldDimDoor extends BaseDimDoor implements IDimDoor } @Override public int getDrops() - { - return this.properties.GoldDoorItemID; - } + { + return mod_pocketDim.itemGoldDoor.itemID; + } @Override public TileEntity createNewTileEntity(World world) diff --git a/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java b/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java index 1a1232ba..35566b15 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java @@ -27,7 +27,7 @@ public class TransientDoor extends BaseDimDoor public void enterDimDoor(World world, int x, int y, int z, Entity entity) { // We need to ignore particle entities - if (world.isRemote || entity instanceof EntityFX) + if (world.isRemote) { return; } diff --git a/StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java b/StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java index 43efc217..6e9430a4 100644 --- a/StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java +++ b/StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java @@ -100,7 +100,7 @@ public class GatewayGenerator implements IWorldGenerator if (link == null) { dimension = PocketManager.getDimensionData(world); - link = dimension.createLink(x, y + 1, z, LinkTypes.POCKET); + link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON); } else { From 5cd5a323e022296c414d89455532429047128c3a Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Mon, 11 Nov 2013 17:24:20 -0500 Subject: [PATCH 04/13] Fixed Packet issues --- .../mod_pocketDim/ConnectionHandler.java | 45 +++++++++++-------- .../mod_pocketDim/core/PocketManager.java | 20 ++++++--- .../mod_pocketDim/mod_pocketDim.java | 2 +- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java index 07a0b778..e29bb5a6 100644 --- a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java +++ b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java @@ -19,25 +19,6 @@ public class ConnectionHandler implements IConnectionHandler @Override public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager) { - return null; - } - - @Override - public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) { } - - @Override - public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager) { } - - @Override - public void connectionClosed(INetworkManager manager) { } - - @Override - public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) { } - - @Override - public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) - { - //Send information about all the registered dimensions and links to the client try { Packet250CustomPayload packet = new Packet250CustomPayload(); @@ -56,5 +37,31 @@ public class ConnectionHandler implements IConnectionHandler //This shouldn't happen... e.printStackTrace(); } + return null; + } + + @Override + public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) { } + + @Override + public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager) { } + + @Override + public void connectionClosed(INetworkManager manager) + { + if(PocketManager.isConnected) + { + PocketManager.unload(); + } + } + + @Override + public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) { } + + @Override + public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) + { + //Send information about all the registered dimensions and links to the client + } } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/core/PocketManager.java b/StevenDimDoors/mod_pocketDim/core/PocketManager.java index 63eec3b5..6a6944b2 100644 --- a/StevenDimDoors/mod_pocketDim/core/PocketManager.java +++ b/StevenDimDoors/mod_pocketDim/core/PocketManager.java @@ -204,6 +204,10 @@ public class PocketManager private static volatile boolean isLoading = false; private static volatile boolean isLoaded = false; private static volatile boolean isSaving = false; + /** + * Set as true if we are a client that has connected to a dedicated server + */ + public static volatile boolean isConnected = false; private static final UpdateWatcherProxy linkWatcher = new UpdateWatcherProxy(); private static final UpdateWatcherProxy dimWatcher = new UpdateWatcherProxy(); private static ArrayList rootDimensions = null; @@ -564,6 +568,10 @@ public class PocketManager //Any pocket dimension must be listed with PocketManager to have a dimension ID //assigned, so it's safe to assume that any unknown dimensions don't belong to us. + if(PocketManager.dimensionData == null) + { + System.out.println("Something odd happend during shutdown"); + } NewDimData dimension = PocketManager.dimensionData.get(dimensionID); if (dimension == null) { @@ -585,16 +593,19 @@ public class PocketManager public static void unload() { + System.out.println("Dimensional Doors unloading..."); + if (!isLoaded) { throw new IllegalStateException("Pocket dimensions have already been unloaded!"); } - + save(); unregisterPockets(); dimensionData = null; rootDimensions = null; isLoaded = false; + isConnected = false; } public static DimLink getLink(int x, int y, int z, World world) @@ -680,12 +691,9 @@ public class PocketManager throw new IllegalStateException("Pocket dimensions are already loading!"); } // Load compacted client-side dimension data + load(); Compactor.readDimensions(input, new DimRegistrationCallback()); - - // Register pocket dimensions - DDProperties properties = DDProperties.instance(); - registerPockets(properties); - + isConnected = true; isLoaded = true; isLoading = false; } diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 570b2b1f..f8b0ed69 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -94,7 +94,7 @@ serverPacketHandlerSpec = public class mod_pocketDim { - public static final String version = "1.5.2R1.4.1RC1"; + public static final String version = "1.5.2R2.0.1RC1"; public static final String modid = "DimDoors"; //need to clean up From 8dd1d85e6e85c96dda2dd00cba03f563e33e8083 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Mon, 11 Nov 2013 21:49:47 -0500 Subject: [PATCH 05/13] Fixed chunkloaders and loading bug --- .../mod_pocketDim/core/DimLink.java | 1 - .../mod_pocketDim/core/PocketManager.java | 4 +- .../tileentities/TileEntityDimDoorGold.java | 94 ++++++++++++------- .../mod_pocketDim/world/PocketBuilder.java | 2 +- 4 files changed, 64 insertions(+), 37 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/core/DimLink.java b/StevenDimDoors/mod_pocketDim/core/DimLink.java index 9f1369d8..0b89b30e 100644 --- a/StevenDimDoors/mod_pocketDim/core/DimLink.java +++ b/StevenDimDoors/mod_pocketDim/core/DimLink.java @@ -4,7 +4,6 @@ import java.util.LinkedList; import java.util.List; import StevenDimDoors.mod_pocketDim.util.Point4D; -@Deprecated public abstract class DimLink { protected Point4D source; diff --git a/StevenDimDoors/mod_pocketDim/core/PocketManager.java b/StevenDimDoors/mod_pocketDim/core/PocketManager.java index 6a6944b2..52112afe 100644 --- a/StevenDimDoors/mod_pocketDim/core/PocketManager.java +++ b/StevenDimDoors/mod_pocketDim/core/PocketManager.java @@ -272,7 +272,7 @@ public class PocketManager dimData.root=dimData; dimData.parent=dimData; dimData.isFilled=packedData.IsFilled; - + dimData.origin = new Point4D(packedData.Origin.getX(),packedData.Origin.getY(),packedData.Origin.getZ(),packedData.ID); PocketManager.rootDimensions.add(dimData); } else @@ -280,7 +280,7 @@ public class PocketManager InnerDimData test = PocketManager.dimensionData.get(packedData.ParentID); dimData = new InnerDimData(packedData.ID, test,true, packedData.IsDungeon, linkWatcher); dimData.isFilled=packedData.IsFilled; - + dimData.origin = new Point4D(packedData.Origin.getX(),packedData.Origin.getY(),packedData.Origin.getZ(),packedData.ID); dimData.root=PocketManager.getDimensionData(packedData.RootID); if(packedData.DungeonData!=null) diff --git a/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoorGold.java b/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoorGold.java index 6091aedb..248046f5 100644 --- a/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoorGold.java +++ b/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoorGold.java @@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.tileentities; import StevenDimDoors.mod_pocketDim.IChunkLoader; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.core.PocketManager; +import StevenDimDoors.mod_pocketDim.util.Point4D; import StevenDimDoors.mod_pocketDim.world.PocketBuilder; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.ChunkCoordIntPair; @@ -20,40 +21,67 @@ public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLo return true; } - public void updateEntity() - { - if(PocketManager.getDimensionData(this.worldObj)!=null&&PocketManager.getDimensionData(this.worldObj).isPocketDimension()&&!this.worldObj.isRemote) - { - if(this.chunkTicket==null) - { - chunkTicket = ForgeChunkManager.requestTicket(mod_pocketDim.instance, worldObj, Type.NORMAL); - } - - chunkTicket.getModData().setInteger("goldDimDoorX", xCoord); - chunkTicket.getModData().setInteger("goldDimDoorY", yCoord); - chunkTicket.getModData().setInteger("goldDimDoorZ", zCoord); - ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair(xCoord >> 4, zCoord >> 4)); - forceChunkLoading(chunkTicket,this.xCoord,this.zCoord); - } - } - - public void forceChunkLoading(Ticket chunkTicket,int x,int z) - { - if(PocketManager.getDimensionData(chunkTicket.world)==null) - { - return; - } - if(!PocketManager.getDimensionData(chunkTicket.world).isPocketDimension()) - { - return; - } - - for(int chunks = (PocketBuilder.DEFAULT_POCKET_SIZE/16)+1;chunks>0;chunks--) - { - ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair((xCoord >> 4)+chunks, (zCoord >> 4)+chunks)); + @Override + public void updateEntity() + { // every tick? + if (PocketManager.getDimensionData(this.worldObj) != null && + PocketManager.getDimensionData(this.worldObj).isPocketDimension() && + !this.worldObj.isRemote) + { + if(PocketManager.getLink(this.xCoord,this.yCoord,this.zCoord,this.worldObj)==null) + { + return; + } + if (this.chunkTicket == null) + { + chunkTicket = ForgeChunkManager.requestTicket(mod_pocketDim.instance, worldObj, Type.NORMAL); + chunkTicket.getModData().setInteger("goldDimDoorX", xCoord); + chunkTicket.getModData().setInteger("goldDimDoorY", yCoord); + chunkTicket.getModData().setInteger("goldDimDoorZ", zCoord); + forceChunkLoading(chunkTicket,this.xCoord,this.zCoord); + } - } - } + } + } + + @Override + public void forceChunkLoading(Ticket chunkTicket,int x,int z) + { + Point4D origin = PocketManager.getDimensionData(this.worldObj).origin(); + int orientation = PocketManager.getDimensionData(this.worldObj).orientation(); + + int xOffset=0; + int zOffset=0; + + switch(orientation) + { + case 0: + xOffset = PocketBuilder.DEFAULT_POCKET_SIZE/2; + break; + case 1: + zOffset = PocketBuilder.DEFAULT_POCKET_SIZE/2; + + break; + case 2: + xOffset = -PocketBuilder.DEFAULT_POCKET_SIZE/2; + + break; + case 3: + zOffset = -PocketBuilder.DEFAULT_POCKET_SIZE/2; + + break; + } + for(int chunkX = -1; chunkX<2;chunkX++) + { + for(int chunkZ = -1; chunkZ<2;chunkZ++) + { + ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair((origin.getX()+xOffset >> 4)+chunkX, (origin.getZ()+zOffset >> 4)+chunkZ)); + } + } + + + + } diff --git a/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java b/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java index 88b326a1..1773f32d 100644 --- a/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java +++ b/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java @@ -375,7 +375,7 @@ public class PocketBuilder int orientation = getDoorOrientation(source, properties); //Place a link leading back out of the pocket - DimLink reverseLink = dimension.createLink(source.getX(), destinationY, source.getZ(), LinkTypes.REVERSE); + DimLink reverseLink = dimension.createLink(source.getX(), destinationY, source.getZ(), LinkTypes.REVERSE,(link.orientation()+2)%4); parent.setDestination(reverseLink, source.getX(), source.getY(), source.getZ()); //Build the actual pocket area From 8fbb41a588612eb46c4f6b847b2a3472f7303289 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Tue, 12 Nov 2013 13:08:05 -0500 Subject: [PATCH 06/13] fixed commands and rift orientation --- .../mod_pocketDim/DDProperties.java | 8 +- .../mod_pocketDim/blocks/TransTrapdoor.java | 2 +- .../commands/CommandCreateDungeonRift.java | 8 +- .../mod_pocketDim/core/NewDimData.java | 5 +- .../mod_pocketDim/core/PocketManager.java | 11 +- .../mod_pocketDim/helpers/Compactor.java | 6 +- .../mod_pocketDim/watcher/ClientLinkData.java | 38 ++++++ .../mod_pocketDim/watcher/IUpdateSource.java | 2 +- .../mod_pocketDim/world/GatewayGenerator.java | 4 +- .../mod_pocketDim/world/PocketBuilder.java | 113 +++++++++++++----- .../ClientPacketHandler.java | 9 +- 11 files changed, 149 insertions(+), 57 deletions(-) create mode 100644 StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java diff --git a/StevenDimDoors/mod_pocketDim/DDProperties.java b/StevenDimDoors/mod_pocketDim/DDProperties.java index 182dde20..fb6bd176 100644 --- a/StevenDimDoors/mod_pocketDim/DDProperties.java +++ b/StevenDimDoors/mod_pocketDim/DDProperties.java @@ -230,13 +230,13 @@ public class DDProperties "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, + ClusterGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Cluster Generation Chance", 2, "Sets the chance (out of " + GatewayGenerator.MAX_CLUSTER_GENERATION_CHANCE + ") that a cluster of rifts will " + - "generate in a given chunk. The default chance is 3.").getInt(); + "generate in a given chunk. The default chance is 2.").getInt(); - GatewayGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Gateway Generation Chance", 10, + GatewayGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Gateway Generation Chance", 15, "Sets the chance (out of " + GatewayGenerator.MAX_GATEWAY_GENERATION_CHANCE + ") that a Rift Gateway will " + - "generate in a given chunk. The default chance is 10.").getInt(); + "generate in a given chunk. The default chance is 15.").getInt(); LimboBiomeID = config.get(CATEGORY_BIOME, "Limbo Biome ID", 251).getInt(); PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 250).getInt(); diff --git a/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java b/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java index 97f94ba8..7c629238 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java @@ -96,7 +96,7 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit DimLink link = dimension.getLink(x, y, z); if (link == null && dimension.isPocketDimension()) { - dimension.createLink(x, y, z, LinkTypes.UNSAFE_EXIT); + dimension.createLink(x, y, z, LinkTypes.UNSAFE_EXIT,0); } } } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java b/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java index 2bb83284..7b24c72a 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java @@ -11,6 +11,7 @@ import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.dungeon.DungeonData; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; +import StevenDimDoors.mod_pocketDim.world.PocketBuilder; public class CommandCreateDungeonRift extends DDCommandBase { @@ -70,7 +71,7 @@ public class CommandCreateDungeonRift extends DDCommandBase { dimension = PocketManager.getDimensionData(sender.worldObj); - link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON); + link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,orientation); sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3); sender.sendChatToPlayer("Created a rift to a random dungeon."); @@ -88,8 +89,9 @@ public class CommandCreateDungeonRift extends DDCommandBase //Create a rift to our selected dungeon and notify the player //TODO currently crashes, need to create the dimension first dimension = PocketManager.getDimensionData(sender.worldObj); - link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON); - PocketManager.getDimensionData(link.destination().getDimension()).initializeDungeon(x, y + 1, z, orientation,link, result); + link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,orientation); + PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result); + sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3); sender.sendChatToPlayer("Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ")."); } diff --git a/StevenDimDoors/mod_pocketDim/core/NewDimData.java b/StevenDimDoors/mod_pocketDim/core/NewDimData.java index cc909d9e..a91883d8 100644 --- a/StevenDimDoors/mod_pocketDim/core/NewDimData.java +++ b/StevenDimDoors/mod_pocketDim/core/NewDimData.java @@ -244,10 +244,7 @@ public abstract class NewDimData { return Math.abs(i) + Math.abs(j) + Math.abs(k); } - public DimLink createLink(int x, int y, int z, int linkType) - { - return createLink(new Point4D(x, y, z, id), linkType,0); - } + public DimLink createLink(int x, int y, int z, int linkType,int orientation) { return createLink(new Point4D(x, y, z, id), linkType,orientation); diff --git a/StevenDimDoors/mod_pocketDim/core/PocketManager.java b/StevenDimDoors/mod_pocketDim/core/PocketManager.java index 52112afe..5072c54a 100644 --- a/StevenDimDoors/mod_pocketDim/core/PocketManager.java +++ b/StevenDimDoors/mod_pocketDim/core/PocketManager.java @@ -27,6 +27,7 @@ import StevenDimDoors.mod_pocketDim.saving.PackedLinkData; import StevenDimDoors.mod_pocketDim.saving.PackedLinkTail; import StevenDimDoors.mod_pocketDim.util.Point4D; import StevenDimDoors.mod_pocketDim.watcher.ClientDimData; +import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; import StevenDimDoors.mod_pocketDim.watcher.IUpdateSource; import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher; import StevenDimDoors.mod_pocketDim.watcher.UpdateWatcherProxy; @@ -153,18 +154,20 @@ public class PocketManager } } - private static class ClientLinkWatcher implements IUpdateWatcher + private static class ClientLinkWatcher implements IUpdateWatcher { @Override - public void onCreated(Point4D source) + public void onCreated(ClientLinkData link) { + Point4D source = link.point; NewDimData dimension = getDimensionData(source.getDimension()); - dimension.createLink(source.getX(), source.getY(), source.getZ(), LinkTypes.CLIENT_SIDE); + dimension.createLink(source.getX(), source.getY(), source.getZ(), LinkTypes.CLIENT_SIDE,link.orientation); } @Override - public void onDeleted(Point4D source) + public void onDeleted(ClientLinkData link) { + Point4D source = link.point; NewDimData dimension = getDimensionData(source.getDimension()); dimension.deleteLink(source.getX(), source.getY(), source.getZ()); } diff --git a/StevenDimDoors/mod_pocketDim/helpers/Compactor.java b/StevenDimDoors/mod_pocketDim/helpers/Compactor.java index e13d9029..08ed55d3 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/Compactor.java +++ b/StevenDimDoors/mod_pocketDim/helpers/Compactor.java @@ -12,6 +12,7 @@ import StevenDimDoors.mod_pocketDim.core.IDimRegistrationCallback; import StevenDimDoors.mod_pocketDim.core.LinkTypes; import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.util.Point4D; +import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; public class Compactor { @@ -75,8 +76,9 @@ public class Compactor int linkCount = input.readInt(); for (int h = 0; h < linkCount; h++) { - Point4D source = Point4D.read(input); - dimension.createLink(source.getX(), source.getY(), source.getZ(), LinkTypes.CLIENT_SIDE); + ClientLinkData link = ClientLinkData.read(input); + Point4D source = link.point; + dimension.createLink(source.getX(), source.getY(), source.getZ(), LinkTypes.CLIENT_SIDE,link.orientation); } } } diff --git a/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java b/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java new file mode 100644 index 00000000..5af6a456 --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java @@ -0,0 +1,38 @@ +package StevenDimDoors.mod_pocketDim.watcher; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import StevenDimDoors.mod_pocketDim.core.DimLink; +import StevenDimDoors.mod_pocketDim.util.Point4D; + +public class ClientLinkData +{ + public Point4D point; + public int orientation; + + public ClientLinkData(DimLink link) + { + this.point= link.source(); + this.orientation=link.orientation(); + } + + public ClientLinkData(Point4D point, int orientation) + { + this.point = point; + this.orientation=orientation; + } + + public void write(DataOutputStream output) throws IOException + { + Point4D.write(point, output); + output.writeInt(orientation); + } + + public static ClientLinkData read(DataInputStream input) throws IOException + { + return new ClientLinkData(Point4D.read(input), input.readInt()); + } + +} diff --git a/StevenDimDoors/mod_pocketDim/watcher/IUpdateSource.java b/StevenDimDoors/mod_pocketDim/watcher/IUpdateSource.java index 98e260e8..f8dd4045 100644 --- a/StevenDimDoors/mod_pocketDim/watcher/IUpdateSource.java +++ b/StevenDimDoors/mod_pocketDim/watcher/IUpdateSource.java @@ -4,5 +4,5 @@ import StevenDimDoors.mod_pocketDim.util.Point4D; public interface IUpdateSource { - public void registerWatchers(IUpdateWatcher dimWatcher, IUpdateWatcher linkWatcher); + public void registerWatchers(IUpdateWatcher dimWatcher, IUpdateWatcher linkWatcher); } diff --git a/StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java b/StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java index 6e9430a4..6c788bc2 100644 --- a/StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java +++ b/StevenDimDoors/mod_pocketDim/world/GatewayGenerator.java @@ -100,7 +100,7 @@ public class GatewayGenerator implements IWorldGenerator if (link == null) { dimension = PocketManager.getDimensionData(world); - link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON); + link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,0); } else { @@ -135,7 +135,7 @@ public class GatewayGenerator implements IWorldGenerator { //Create a partial link to a dungeon. dimension = PocketManager.getDimensionData(world); - link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON); + link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,0); //If the current dimension isn't Limbo, build a Rift Gateway out of Stone Bricks if (dimension.id() != properties.LimboDimensionID) diff --git a/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java b/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java index 1773f32d..c151ab5d 100644 --- a/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java +++ b/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java @@ -118,6 +118,85 @@ public class PocketBuilder } + + private static boolean buildDungeonPocket(DungeonData dungeon, NewDimData dimension, DimLink link, DungeonSchematic schematic,World world, DDProperties properties) + { + + //Calculate the destination point + DungeonPackConfig packConfig = dungeon.dungeonType().Owner != null ? dungeon.dungeonType().Owner.getConfig() : null; + Point4D source = link.source(); + int orientation = link.orientation(); + Point3D destination; + + if (packConfig != null && packConfig.doDistortDoorCoordinates()) + { + destination = calculateNoisyDestination(source, dimension, dungeon, orientation); + } + else + { + destination = new Point3D(source.getX(), source.getY(), source.getZ()); + } + + destination.setY( yCoordHelper.adjustDestinationY(destination.getY(), world.getHeight(), schematic.getEntranceDoorLocation().getY(), schematic.getHeight()) ); + + //Generate the dungeon + schematic.copyToWorld(world, destination, orientation, link, random); + + //Finish up destination initialization + dimension.initializeDungeon(destination.getX(), destination.getY(), destination.getZ(), orientation, link, dungeon); + dimension.setFilled(true); + return true; + + + } + + public static boolean generateSelectedDungeonPocket(DimLink link, DDProperties properties,DungeonData data) + { + if (link == null) + { + throw new IllegalArgumentException("link cannot be null."); + } + if (properties == null) + { + throw new IllegalArgumentException("properties cannot be null."); + } + + if (link.hasDestination()) + { + throw new IllegalArgumentException("link cannot have a destination assigned already."); + } + + + + //Register a new dimension + NewDimData parent = PocketManager.getDimensionData(link.source().getDimension()); + NewDimData dimension = PocketManager.registerPocket(parent, true); + + //Load a world + World world = PocketManager.loadDimension(dimension.id()); + + if (world == null || world.provider == null) + { + System.err.println("Could not initialize dimension for a dungeon!"); + return false; + } + + DungeonData dungeon = null; + DungeonSchematic schematic = null; + + dungeon = data; + if (data == null) + { + System.err.println("Could not select a dungeon for generation!"); + return false; + } + schematic = loadAndValidateDungeon(dungeon,properties); + + return PocketBuilder.buildDungeonPocket(dungeon, dimension, link, schematic, world, properties); + + } + + public static boolean generateNewDungeonPocket(DimLink link, DDProperties properties) { if (link == null) @@ -135,8 +214,7 @@ public class PocketBuilder } - try - { + //Register a new dimension NewDimData parent = PocketManager.getDimensionData(link.source().getDimension()); NewDimData dimension = PocketManager.registerPocket(parent, true); @@ -160,36 +238,7 @@ public class PocketBuilder DungeonData dungeon = pair.getFirst(); DungeonSchematic schematic = pair.getSecond(); - //Calculate the destination point - DungeonPackConfig packConfig = dungeon.dungeonType().Owner != null ? dungeon.dungeonType().Owner.getConfig() : null; - Point4D source = link.source(); - int orientation = getDoorOrientation(source, properties); - Point3D destination; - - if (packConfig != null && packConfig.doDistortDoorCoordinates()) - { - destination = calculateNoisyDestination(source, dimension, dungeon, orientation); - } - else - { - destination = new Point3D(source.getX(), source.getY(), source.getZ()); - } - - destination.setY( yCoordHelper.adjustDestinationY(destination.getY(), world.getHeight(), schematic.getEntranceDoorLocation().getY(), schematic.getHeight()) ); - - //Generate the dungeon - schematic.copyToWorld(world, destination, orientation, link, random); - - //Finish up destination initialization - dimension.initializeDungeon(destination.getX(), destination.getY(), destination.getZ(), orientation, link, dungeon); - dimension.setFilled(true); - return true; - } - catch (Exception e) - { - e.printStackTrace(); - return false; - } + return buildDungeonPocket(dungeon, dimension, link, schematic, world, properties); } private static Point3D calculateNoisyDestination(Point4D source, NewDimData dimension, DungeonData dungeon, int orientation) diff --git a/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java b/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java index 3c2a6665..27eea897 100644 --- a/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java +++ b/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java @@ -10,6 +10,7 @@ import StevenDimDoors.mod_pocketDim.PacketConstants; import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.util.Point4D; import StevenDimDoors.mod_pocketDim.watcher.ClientDimData; +import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; import StevenDimDoors.mod_pocketDim.watcher.IUpdateSource; import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher; import cpw.mods.fml.common.FMLCommonHandler; @@ -19,7 +20,7 @@ import cpw.mods.fml.relauncher.Side; public class ClientPacketHandler implements IPacketHandler, IUpdateSource { - private IUpdateWatcher linkWatcher; + private IUpdateWatcher linkWatcher; private IUpdateWatcher dimWatcher; public ClientPacketHandler() @@ -28,7 +29,7 @@ public class ClientPacketHandler implements IPacketHandler, IUpdateSource } @Override - public void registerWatchers(IUpdateWatcher dimWatcher, IUpdateWatcher linkWatcher) + public void registerWatchers(IUpdateWatcher dimWatcher, IUpdateWatcher linkWatcher) { this.dimWatcher = dimWatcher; this.linkWatcher = linkWatcher; @@ -58,13 +59,13 @@ public class ClientPacketHandler implements IPacketHandler, IUpdateSource dimWatcher.onCreated( ClientDimData.read(input) ); break; case PacketConstants.CREATE_LINK_PACKET_ID: - linkWatcher.onCreated( Point4D.read(input) ); + linkWatcher.onCreated( ClientLinkData.read(input) ); break; case PacketConstants.DELETE_DIM_PACKET_ID: dimWatcher.onDeleted( ClientDimData.read(input) ); break; case PacketConstants.DELETE_LINK_PACKET_ID: - linkWatcher.onDeleted( Point4D.read(input) ); + linkWatcher.onDeleted( ClientLinkData.read(input) ); break; } } From 7687a7733217f1d0909ebbbc553619a112e7de30 Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Tue, 12 Nov 2013 13:56:52 -0500 Subject: [PATCH 07/13] Chunkloader fixes --- .../mod_pocketDim/mod_pocketDim.java | 10 ++++- .../tileentities/TileEntityDimDoorGold.java | 39 ++++++++++--------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index f8b0ed69..77828bae 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -319,7 +319,13 @@ public class mod_pocketDim CommandCreatePocket.instance().register(event); CommandTeleportPlayer.instance().register(event); - - ChunkLoaderHelper.loadChunkForcedWorlds(event); + try + { + ChunkLoaderHelper.loadChunkForcedWorlds(event); + } + catch(Exception e) + { + System.out.println("Loading chunkloaders failed"); + } } } diff --git a/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoorGold.java b/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoorGold.java index 248046f5..6892d1dc 100644 --- a/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoorGold.java +++ b/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoorGold.java @@ -24,24 +24,27 @@ public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLo @Override public void updateEntity() { // every tick? - if (PocketManager.getDimensionData(this.worldObj) != null && - PocketManager.getDimensionData(this.worldObj).isPocketDimension() && - !this.worldObj.isRemote) - { - if(PocketManager.getLink(this.xCoord,this.yCoord,this.zCoord,this.worldObj)==null) - { - return; - } - if (this.chunkTicket == null) - { - chunkTicket = ForgeChunkManager.requestTicket(mod_pocketDim.instance, worldObj, Type.NORMAL); - chunkTicket.getModData().setInteger("goldDimDoorX", xCoord); - chunkTicket.getModData().setInteger("goldDimDoorY", yCoord); - chunkTicket.getModData().setInteger("goldDimDoorZ", zCoord); - forceChunkLoading(chunkTicket,this.xCoord,this.zCoord); - } - - } + if (PocketManager.getDimensionData(this.worldObj) != null && + PocketManager.getDimensionData(this.worldObj).isPocketDimension() && + !this.worldObj.isRemote) + { + if(PocketManager.getLink(this.xCoord,this.yCoord,this.zCoord,this.worldObj)==null) + { + return; + } + if (this.chunkTicket == null) + { + if(chunkTicket == null) + { + return; + } + chunkTicket = ForgeChunkManager.requestTicket(mod_pocketDim.instance, worldObj, Type.NORMAL); + chunkTicket.getModData().setInteger("goldDimDoorX", xCoord); + chunkTicket.getModData().setInteger("goldDimDoorY", yCoord); + chunkTicket.getModData().setInteger("goldDimDoorZ", zCoord); + forceChunkLoading(chunkTicket,this.xCoord,this.zCoord); + } + } } @Override From e825cb74b910065f912319a8170d1e914813eb6f Mon Sep 17 00:00:00 2001 From: CannibalVox Date: Fri, 6 Dec 2013 20:38:55 -0600 Subject: [PATCH 08/13] 1.6.4 basic fixes --- .../mod_pocketDim/EventHookContainer.java | 22 +- .../mod_pocketDim/blocks/BaseDimDoor.java | 4 +- .../mod_pocketDim/blocks/BlockDimWall.java | 4 +- .../blocks/BlockDimWallPerm.java | 2 +- .../mod_pocketDim/blocks/BlockDoorGold.java | 4 +- .../mod_pocketDim/blocks/BlockLimbo.java | 2 +- .../mod_pocketDim/blocks/BlockRift.java | 2 +- .../mod_pocketDim/blocks/TransTrapdoor.java | 2 +- .../commands/CommandCreateDungeonRift.java | 16 +- .../commands/CommandCreatePocket.java | 8 +- .../commands/CommandDeleteAllLinks.java | 10 +- .../commands/CommandDeleteRifts.java | 10 +- .../commands/CommandExportDungeon.java | 10 +- .../commands/CommandResetDungeons.java | 8 +- .../commands/CommandTeleportPlayer.java | 6 + .../mod_pocketDim/commands/DDCommandBase.java | 4 +- .../mod_pocketDim/core/DDTeleporter.java | 4 +- .../mod_pocketDim/items/ItemBlockDimWall.java | 2 +- .../mod_pocketDim/items/ItemRiftBlade.java | 16 +- .../items/ItemRiftSignature.java | 4 +- .../items/ItemStabilizedRiftSignature.java | 6 +- .../mod_pocketDim/mod_pocketDim.java | 2 +- .../saving/DimDataProcessor.java | 2 - .../mod_pocketDim/ticking/MobMonolith.java | 12 +- .../tileentities/TileEntityRift.java | 4 +- .../world/CustomSkyProvider.java | 7 +- .../mod_pocketDimClient/RenderDimDoor.java | 5 +- .../mod_pocketDimClient/RenderMobObelisk.java | 11 +- .../RenderTransTrapdoor.java | 5 +- build.xml | 192 ++++++++++-------- mcmod.info | 6 +- 31 files changed, 234 insertions(+), 158 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/EventHookContainer.java b/StevenDimDoors/mod_pocketDim/EventHookContainer.java index 26fe6871..d68ecd43 100644 --- a/StevenDimDoors/mod_pocketDim/EventHookContainer.java +++ b/StevenDimDoors/mod_pocketDim/EventHookContainer.java @@ -36,15 +36,15 @@ public class EventHookContainer @ForgeSubscribe public void onSoundLoad(SoundLoadEvent event) { - event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/monk.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/monk.ogg"))); - event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/crack.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/crack.ogg"))); - event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/tearing.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/tearing.ogg"))); - event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/rift.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/rift.ogg"))); - event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftStart.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftStart.ogg"))); - event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftEnd.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftEnd.ogg"))); - event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftClose.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftClose.ogg"))); - event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftDoor.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftDoor.ogg"))); - event.manager.soundPoolMusic.addSound("mods/DimDoors/sfx/creepy.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/creepy.ogg"))); + event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/monk.ogg"); + event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/crack.ogg"); + event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/tearing.ogg"); + event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/rift.ogg"); + event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftStart.ogg"); + event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftEnd.ogg"); + event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftClose.ogg"); + event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftDoor.ogg"); + event.manager.soundPoolMusic.addSound("mods/DimDoors/sfx/creepy.ogg"); } @SideOnly(Side.CLIENT) @@ -96,7 +96,7 @@ public class EventHookContainer ChunkCoordinates coords = LimboProvider.getLimboSkySpawn(player.worldObj.rand); Point4D destination = new Point4D((int) (coords.posX+entity.posX), coords.posY, (int) (coords.posZ+entity.posZ ), mod_pocketDim.properties.LimboDimensionID); DDTeleporter.teleportEntity(player, destination, false); - player.setEntityHealth(player.getMaxHealth()); + player.setHealth(player.getMaxHealth()); event.setCanceled(true); return false; } @@ -119,7 +119,7 @@ public class EventHookContainer SoundSystem sndSystem = FMLClientHandler.instance().getClient().sndManager.sndSystem; sndSystem.stop("BgMusic"); SoundPoolEntry soundPoolEntry = FMLClientHandler.instance().getClient().sndManager.soundPoolMusic.getRandomSoundFromSoundPool("mods.DimDoors.sfx.creepy"); - sndSystem.backgroundMusic("LimboMusic", soundPoolEntry.soundUrl, soundPoolEntry.soundName, false); + sndSystem.backgroundMusic("LimboMusic", soundPoolEntry.getSoundUrl(), soundPoolEntry.getSoundName(), false); sndSystem.play("LimboMusic"); } else if(world.isRemote && !(world.provider instanceof LimboProvider)) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java b/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java index 6537d859..c2f43c4d 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java @@ -42,8 +42,8 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn public void registerIcons(IconRegister par1IconRegister) { - this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_top"); - this.blockIconBottom = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_bottom"); + this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5)+"_top"); + this.blockIconBottom = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5)+"_bottom"); } @SideOnly(Side.CLIENT) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java index 6144d4d1..5a39bbb4 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java @@ -59,8 +59,8 @@ public class BlockDimWall extends Block public void registerIcons(IconRegister par1IconRegister) { - this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()); - this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2() + "Perm"); + this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5)); + this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5) + "Perm"); } @SideOnly(Side.CLIENT) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java index c635b7f6..5b3c3d0e 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java @@ -32,7 +32,7 @@ public class BlockDimWallPerm extends Block public void registerIcons(IconRegister par1IconRegister) { - this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()); + this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5)); } public int quantityDropped(Random par1Random) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java b/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java index 5dead11f..f2e4cbe1 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java @@ -33,8 +33,8 @@ public class BlockDoorGold extends BlockDoor public void registerIcons(IconRegister par1IconRegister) { - this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_top"); - this.blockIconBottom = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"_bottom"); + this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5)+"_top"); + this.blockIconBottom = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5)+"_bottom"); } public Icon getIcon(int par1, int par2) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java b/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java index 0ec6bbe3..0593356e 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java @@ -40,7 +40,7 @@ public class BlockLimbo extends Block @Override public void registerIcons(IconRegister iconRegister) { - this.blockIcon = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()); + this.blockIcon = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5)); } @Override diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockRift.java b/StevenDimDoors/mod_pocketDim/blocks/BlockRift.java index 11fe9604..3345c6e9 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockRift.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockRift.java @@ -66,7 +66,7 @@ public class BlockRift extends BlockContainer @Override public void registerIcons(IconRegister par1IconRegister) { - this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()); + this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5)); } //sends a packet informing the client that there is a link present so it renders properly. (when placed) diff --git a/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java b/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java index 7c629238..1884d305 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java @@ -32,7 +32,7 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit @Override public void registerIcons(IconRegister par1IconRegister) { - this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()); + this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().substring(5)); } //Teleports the player to the exit link of that dimension, assuming it is a pocket diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java b/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java index 7b24c72a..23f40135 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.commands; import java.util.Collection; +import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.MathHelper; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -30,6 +31,13 @@ public class CommandCreateDungeonRift extends DDCommandBase return instance; } + @Override + public String getCommandUsage(ICommandSender sender) { + return "Usage: /dd-rift \r\n" + + " /dd-rift list\r\n" + + " /dd-rift random"; + } + @Override protected DDCommandResult processCommand(EntityPlayer sender, String[] command) { @@ -54,9 +62,9 @@ public class CommandCreateDungeonRift extends DDCommandBase Collection dungeonNames = dungeonHelper.getDungeonNames(); for (String name : dungeonNames) { - sender.sendChatToPlayer(name); + sender.addChatMessage(name); } - sender.sendChatToPlayer(""); + sender.addChatMessage(""); } else { @@ -74,7 +82,7 @@ public class CommandCreateDungeonRift extends DDCommandBase link = dimension.createLink(x, y + 1, z, LinkTypes.DUNGEON,orientation); sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3); - sender.sendChatToPlayer("Created a rift to a random dungeon."); + sender.addChatMessage("Created a rift to a random dungeon."); } else { @@ -93,7 +101,7 @@ public class CommandCreateDungeonRift extends DDCommandBase PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result); sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID,0,3); - sender.sendChatToPlayer("Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ")."); + sender.addChatMessage("Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ")."); } else { diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java b/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java index 5360cff7..b94e46c0 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java @@ -1,5 +1,6 @@ package StevenDimDoors.mod_pocketDim.commands; +import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; @@ -20,6 +21,11 @@ public class CommandCreatePocket extends DDCommandBase return instance; } + @Override + public String getCommandUsage(ICommandSender sender) { + return "Usage: /dd-create"; + } + @Override protected DDCommandResult processCommand(EntityPlayer sender, String[] command) { @@ -41,7 +47,7 @@ public class CommandCreatePocket extends DDCommandBase DungeonHelper.instance().createCustomDungeonDoor(sender.worldObj, x, y, z); //Notify the player - sender.sendChatToPlayer("Created a door to a pocket dimension. Please build your dungeon there."); + sender.addChatMessage("Created a door to a pocket dimension. Please build your dungeon there."); } return DDCommandResult.SUCCESS; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java index 4b2cf423..2f674a66 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.commands; import java.util.ArrayList; +import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; @@ -26,6 +27,11 @@ public class CommandDeleteAllLinks extends DDCommandBase return instance; } + @Override + public String getCommandUsage(ICommandSender sender) { + return "Usage: /dd-deletelinks "; + } + @Override protected DDCommandResult processCommand(EntityPlayer sender, String[] command) { @@ -41,7 +47,7 @@ public class CommandDeleteAllLinks extends DDCommandBase { targetDim=0; shouldGo=false; - sender.sendChatToPlayer("Error-Invalid argument, delete_all_links "); + sender.addChatMessage("Error-Invalid argument, delete_all_links "); } if(shouldGo) @@ -59,7 +65,7 @@ public class CommandDeleteAllLinks extends DDCommandBase linksRemoved++; } - sender.sendChatToPlayer("Removed " + linksRemoved + " links."); + sender.addChatMessage("Removed " + linksRemoved + " links."); } return DDCommandResult.SUCCESS; //TEMPORARY HACK diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java index 61668d70..88905b54 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.commands; import java.util.ArrayList; +import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -26,6 +27,11 @@ public class CommandDeleteRifts extends DDCommandBase return instance; } + @Override + public String getCommandUsage(ICommandSender sender) { + return "Usage: /dd-??? "; + } + @Override protected DDCommandResult processCommand(EntityPlayer sender, String[] command) { @@ -41,7 +47,7 @@ public class CommandDeleteRifts extends DDCommandBase { targetDim=0; shouldGo=false; - sender.sendChatToPlayer("Error-Invalid argument, delete_all_links "); + sender.addChatMessage("Error-Invalid argument, delete_all_links "); } if(shouldGo) @@ -61,7 +67,7 @@ public class CommandDeleteRifts extends DDCommandBase dim.deleteLink(link); } } - sender.sendChatToPlayer("Removed " + linksRemoved + " rifts."); + sender.addChatMessage("Removed " + linksRemoved + " rifts."); } return DDCommandResult.SUCCESS; //TEMPORARY HACK diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandExportDungeon.java b/StevenDimDoors/mod_pocketDim/commands/CommandExportDungeon.java index 8968d11c..14ba9985 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandExportDungeon.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandExportDungeon.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.commands; import java.io.File; +import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; @@ -25,6 +26,13 @@ public class CommandExportDungeon extends DDCommandBase return instance; } + @Override + public String getCommandUsage(ICommandSender sender) { + return "Usage: /dd-export open \r\n" + + " /dd-export closed \r\n" + + " /dd-export override"; + } + @Override protected DDCommandResult processCommand(EntityPlayer sender, String[] command) { @@ -132,7 +140,7 @@ public class CommandExportDungeon extends DDCommandBase String exportPath = properties.CustomSchematicDirectory + File.separator + name + ".schematic"; if (dungeonHelper.exportDungeon(player.worldObj, x, y, z, exportPath)) { - player.sendChatToPlayer("Saved dungeon schematic in " + exportPath); + player.addChatMessage("Saved dungeon schematic in " + exportPath); dungeonHelper.registerDungeon(exportPath, dungeonHelper.getDungeonPack("ruins"), false, true); return DDCommandResult.SUCCESS; } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandResetDungeons.java b/StevenDimDoors/mod_pocketDim/commands/CommandResetDungeons.java index d4353fe1..f9084695 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandResetDungeons.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandResetDungeons.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.commands; import java.util.ArrayList; +import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.DimensionManager; import StevenDimDoors.mod_pocketDim.core.DimLink; @@ -26,6 +27,11 @@ public class CommandResetDungeons extends DDCommandBase return instance; } + @Override + public String getCommandUsage(ICommandSender sender) { + return "/dd-resetdungeons"; + } + @Override protected DDCommandResult processCommand(EntityPlayer sender, String[] command) { @@ -84,7 +90,7 @@ public class CommandResetDungeons extends DDCommandBase //TODO- for some reason the parent field of loaded dimenions get reset to null if I call .setParentToRoot() before I delete the pockets. //TODO implement blackList //Notify the user of the results - sender.sendChatToPlayer("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset."); + sender.addChatMessage("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset."); return DDCommandResult.SUCCESS; } } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandTeleportPlayer.java b/StevenDimDoors/mod_pocketDim/commands/CommandTeleportPlayer.java index c91286ca..8d0780e6 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandTeleportPlayer.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandTeleportPlayer.java @@ -11,6 +11,7 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; import StevenDimDoors.mod_pocketDim.util.Point4D; +import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.World; @@ -36,6 +37,11 @@ public class CommandTeleportPlayer extends DDCommandBase return instance; } + @Override + public String getCommandUsage(ICommandSender sender) { + return "Usage: /dd-tp "; + } + /** * TODO- Change to accept variety of input, like just coords, just dim ID, or two player names. */ diff --git a/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java b/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java index 9a7c5343..d7b9c697 100644 --- a/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java +++ b/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java @@ -63,10 +63,10 @@ public abstract class DDCommandBase extends CommandBase //Send the argument formats for this command for (String format : formats) { - player.sendChatToPlayer("Usage: " + name + " " + format); + player.addChatMessage("Usage: " + name + " " + format); } } - player.sendChatToPlayer(result.getMessage()); + player.addChatMessage(result.getMessage()); } } } diff --git a/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java b/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java index c9e9c66a..2dd76516 100644 --- a/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java +++ b/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java @@ -357,13 +357,13 @@ public class DDTeleporter oldWorld.getChunkFromChunkCoords(entX, entZ).isModified = true; } // Memory concerns. - oldWorld.releaseEntitySkin(entity); + oldWorld.onEntityRemoved(entity); if (player == null) // Are we NOT working with a player? { NBTTagCompound entityNBT = new NBTTagCompound(); entity.isDead = false; - entity.addEntityID(entityNBT); + entity.writeMountToNBT(entityNBT); entity.isDead = true; entity = EntityList.createEntityFromNBT(entityNBT, newWorld); diff --git a/StevenDimDoors/mod_pocketDim/items/ItemBlockDimWall.java b/StevenDimDoors/mod_pocketDim/items/ItemBlockDimWall.java index 572f506b..9fd7b23f 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemBlockDimWall.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemBlockDimWall.java @@ -28,6 +28,6 @@ public class ItemBlockDimWall extends ItemBlock public String getUnlocalizedName(ItemStack par1ItemStack) { - return subNames[getItemDamageFromStack(par1ItemStack)]; + return subNames[this.getDamage(par1ItemStack)]; } } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java b/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java index b51950c7..fa1521a4 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java @@ -2,11 +2,15 @@ package StevenDimDoors.mod_pocketDim.items; import java.util.List; +import com.google.common.collect.Multimap; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.EnumToolMaterial; @@ -60,10 +64,12 @@ public class ItemRiftBlade extends ItemSword } @Override - public int getDamageVsEntity(Entity par1Entity) - { - return 7; - } + public Multimap getItemAttributeModifiers() + { + Multimap multimap = super.getItemAttributeModifiers(); + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)7, 0)); + return multimap; + } @Override @SideOnly(Side.CLIENT) @@ -73,7 +79,7 @@ public class ItemRiftBlade extends ItemSword } @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLiving, EntityLivingBase par3EntityLiving) { par1ItemStack.damageItem(1, par3EntityLiving); return true; diff --git a/StevenDimDoors/mod_pocketDim/items/ItemRiftSignature.java b/StevenDimDoors/mod_pocketDim/items/ItemRiftSignature.java index 578a71f1..5e26c52e 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemRiftSignature.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemRiftSignature.java @@ -98,14 +98,14 @@ public class ItemRiftSignature extends Item stack.stackSize--; } clearSource(stack); - player.sendChatToPlayer("Rift Created"); + player.addChatMessage("Rift Created"); world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftEnd", 0.6f, 1); } else { //The link signature has not been used. Store its current target as the first location. setSource(stack, x, adjustedY, z,orientation, PocketManager.getDimensionData(world)); - player.sendChatToPlayer("Location Stored in Rift Signature"); + player.addChatMessage("Location Stored in Rift Signature"); world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftStart", 0.6f, 1); } return true; diff --git a/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java b/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java index fca2c24e..a676a4fa 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java @@ -56,7 +56,7 @@ public class ItemStabilizedRiftSignature extends ItemRiftSignature // or if the player can pay an Ender Pearl to create a rift. if (!player.capabilities.isCreativeMode && !player.inventory.hasItem(Item.enderPearl.itemID)) { - player.sendChatToPlayer("You don't have any Ender Pearls!"); + player.addChatMessage("You don't have any Ender Pearls!"); return true; } @@ -86,14 +86,14 @@ public class ItemStabilizedRiftSignature extends ItemRiftSignature { player.inventory.consumeInventoryItem(Item.enderPearl.itemID); } - player.sendChatToPlayer("Rift Created"); + player.addChatMessage("Rift Created"); world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftEnd", 0.6f, 1); } else { //The link signature has not been used. Store its current target as the first location. setSource(stack, x, adjustedY, z, orientation, PocketManager.getDimensionData(world)); - player.sendChatToPlayer("Location Stored in Rift Signature"); + player.addChatMessage("Location Stored in Rift Signature"); world.playSoundAtEntity(player,"mods.DimDoors.sfx.riftStart", 0.6f, 1); } return true; diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 77828bae..2a66f509 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -94,7 +94,7 @@ serverPacketHandlerSpec = public class mod_pocketDim { - public static final String version = "1.5.2R2.0.1RC1"; + public static final String version = "$VERSION$"; public static final String modid = "DimDoors"; //need to clean up diff --git a/StevenDimDoors/mod_pocketDim/saving/DimDataProcessor.java b/StevenDimDoors/mod_pocketDim/saving/DimDataProcessor.java index 55a01d9a..c539396c 100644 --- a/StevenDimDoors/mod_pocketDim/saving/DimDataProcessor.java +++ b/StevenDimDoors/mod_pocketDim/saving/DimDataProcessor.java @@ -11,8 +11,6 @@ import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; -import scala.Char; - import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; diff --git a/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java index 928877f8..6a185346 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java +++ b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityFlying; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -36,7 +37,7 @@ public class MobMonolith extends EntityFlying implements IMob public MobMonolith(World par1World) { super(par1World); - this.texture="/mods/DimDoors/textures/mobs/Monolith0.png"; + this.getDataWatcher().addObject(16,0); this.setSize(3F, 9.0F); this.noClip=true; this.scaleFactor= (float) ((rand.nextDouble()/2)+1); @@ -55,10 +56,10 @@ public class MobMonolith extends EntityFlying implements IMob } @Override - public int getMaxHealth() + protected void applyEntityAttributes() { - // TODO Auto-generated method stub - return 20; + super.applyEntityAttributes(); + this.getAttributeMap().func_111150_b(SharedMonsterAttributes.maxHealth).setAttribute(20); } public boolean canBePushed() @@ -93,9 +94,6 @@ public class MobMonolith extends EntityFlying implements IMob this.setDead(); } - byte b0 = this.dataWatcher.getWatchableObjectByte(16); - - this.texture="/mods/DimDoors/textures/mobs/Monolith"+b0+".png"; super.onEntityUpdate(); if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock()) diff --git a/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java b/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java index ce3e0c6b..5ae69c6d 100644 --- a/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java +++ b/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java @@ -350,13 +350,13 @@ public class TileEntityRift extends TileEntity NBTTagCompound nbt = new NBTTagCompound(); writeToNBT(nbt); - packet.customParam1 = nbt; + packet.data = nbt; return packet; } @Override public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) { - readFromNBT(pkt.customParam1); + readFromNBT(pkt.data); } } diff --git a/StevenDimDoors/mod_pocketDim/world/CustomSkyProvider.java b/StevenDimDoors/mod_pocketDim/world/CustomSkyProvider.java index c88377c1..3a6b24dd 100644 --- a/StevenDimDoors/mod_pocketDim/world/CustomSkyProvider.java +++ b/StevenDimDoors/mod_pocketDim/world/CustomSkyProvider.java @@ -1,5 +1,6 @@ package StevenDimDoors.mod_pocketDim.world; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; @@ -43,7 +44,7 @@ public class CustomSkyProvider extends IRenderHandler GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.disableStandardItemLighting(); GL11.glDepthMask(false); - mc.renderEngine.bindTexture("/misc/tunnel.png"); + mc.renderEngine.bindTexture(new ResourceLocation("/misc/tunnel.png")); Tessellator tessellator = Tessellator.instance; if (mc.theWorld.provider.isSurfaceWorld()) @@ -136,7 +137,7 @@ public class CustomSkyProvider extends IRenderHandler GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(par1) * 360.0F, 1.0F, 0.0F, 0.0F); f10 = 30.0F; - mc.renderEngine.bindTexture(this.getSunRenderPath()); + mc.renderEngine.bindTexture(new ResourceLocation(this.getSunRenderPath())); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV((double)(-f10), 100.0D, (double)(-f10), 0.0D, 0.0D); tessellator1.addVertexWithUV((double)f10, 100.0D, (double)(-f10), 1.0D, 0.0D); @@ -144,7 +145,7 @@ public class CustomSkyProvider extends IRenderHandler tessellator1.addVertexWithUV((double)(-f10), 100.0D, (double)f10, 0.0D, 1.0D); tessellator1.draw(); f10 = 20.0F; - mc.renderEngine.bindTexture(this.getMoonRenderPath()); + mc.renderEngine.bindTexture(new ResourceLocation(this.getMoonRenderPath())); int k = world.getMoonPhase(); int l = k % 4; int i1 = k / 4 % 2; diff --git a/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java b/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java index 1374baf9..c46bf013 100644 --- a/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java +++ b/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java @@ -9,6 +9,7 @@ import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import StevenDimDoors.mod_pocketDim.DDProperties; @@ -65,7 +66,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer if (count == 0) { - this.bindTextureByName("/RIFT.png"); + this.bindTexture(new ResourceLocation("/RIFT.png")); var17 = 0.1F; var15 = 25.0F; var16 = 0.125F; @@ -75,7 +76,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer if (count == 1) { - this.bindTextureByName("/WARP.png"); + this.bindTexture(new ResourceLocation("/WARP.png")); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); var16 = .5F; diff --git a/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java b/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java index 2bbdbad2..6795c1d2 100644 --- a/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java +++ b/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java @@ -3,6 +3,8 @@ package StevenDimDoors.mod_pocketDimClient; import net.minecraft.client.renderer.entity.RenderLiving; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public class RenderMobObelisk extends RenderLiving @@ -16,6 +18,11 @@ protected ModelMobObelisk obeliskModel; } - - + + @Override + public ResourceLocation getEntityTexture(Entity entity) { + int watchByte = entity.getDataWatcher().getWatchableObjectByte(16); + + return new ResourceLocation("/mods/DimDoors/textures/mobs/Monolith"+watchByte+".png"); + } } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDimClient/RenderTransTrapdoor.java b/StevenDimDoors/mod_pocketDimClient/RenderTransTrapdoor.java index 68fe35c4..93fd8c65 100644 --- a/StevenDimDoors/mod_pocketDimClient/RenderTransTrapdoor.java +++ b/StevenDimDoors/mod_pocketDimClient/RenderTransTrapdoor.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import StevenDimDoors.mod_pocketDim.DDProperties; @@ -62,7 +63,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer if (count == 0) { - this.bindTextureByName("/RIFT.png"); + this.bindTexture(new ResourceLocation("/RIFT.png")); var17 = 0.1F; var15 = 25.0F; var16 = 0.125F; @@ -72,7 +73,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer if (count == 1) { - this.bindTextureByName("/WARP.png"); + this.bindTexture(new ResourceLocation("/WARP.png")); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); var16 = .5F; diff --git a/build.xml b/build.xml index 13e1c3c8..c66dd2e7 100644 --- a/build.xml +++ b/build.xml @@ -1,64 +1,93 @@ - - - - + + + + + + + + + + + + - - + + + + - - - - - - + - - + - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - + @@ -67,27 +96,16 @@ - - - - + + + - - - - - - - - - - - + + - - + @@ -99,19 +117,40 @@ - + - + - - + + + + + + + + + + + + + + + + + + + + + + + @@ -121,7 +160,7 @@ - + @@ -132,16 +171,10 @@ - - + - - - - - @@ -151,29 +184,12 @@ - - - - - - - - - - - - + - - @@ -186,11 +202,10 @@ - + - - @@ -216,5 +231,4 @@ - - + \ No newline at end of file diff --git a/mcmod.info b/mcmod.info index 89eaa2b0..15572905 100644 --- a/mcmod.info +++ b/mcmod.info @@ -1,9 +1,12 @@ +{ +"modinfoversion":2, +"modlist": [ { "modid": "DimDoors", "name": "Dimensional Doors", "description": "Bend and twist reality itself, creating pocket dimensions, rifts, and much more", -"version": "1.5.2R1.4.1RC1", +"version": "1.6.4R2.1.2RC1", "credits": "Created by StevenRS11, Coded by StevenRS11 and SenseiKiwi, Logo and Testing by Jaitsu", "logoFile": "/dimdoors_logo.png", "mcversion": "", @@ -15,3 +18,4 @@ "dependencies": [ "Forge"] } ] +} \ No newline at end of file From 7dc51a8e568210445718b0593f87422a91250198 Mon Sep 17 00:00:00 2001 From: CannibalVox Date: Fri, 6 Dec 2013 21:14:20 -0600 Subject: [PATCH 09/13] Fixed some merge issues. --- .../mod_pocketDim/ConnectionHandler.java | 34 ------------------- .../mod_pocketDim/commands/DDCommandBase.java | 8 +++++ .../mod_pocketDim/ticking/MobMonolith.java | 1 + 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java index ccaea91c..7af69f41 100644 --- a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java +++ b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java @@ -41,28 +41,6 @@ public class ConnectionHandler implements IConnectionHandler return null; } - @Override - public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) - { - - } - - @Override - public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager) - { - - } - - @Override - public void connectionClosed(INetworkManager manager) - { - if(PocketManager.isConnected) - { - PocketManager.unload(); - } - return null; - } - @Override public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) { } @@ -87,16 +65,4 @@ public class ConnectionHandler implements IConnectionHandler //Send information about all the registered dimensions and links to the client } - - @Override - public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) - { - return; - } - - @Override - public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) - { - - } } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java b/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java index 5a7b73bb..20902cdc 100644 --- a/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java +++ b/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java @@ -72,4 +72,12 @@ public abstract class DDCommandBase extends CommandBase sendChat(player,(result.getMessage())); } } + + public static void sendChat(EntityPlayer player, String message) + { + ChatMessageComponent cmp = new ChatMessageComponent(); + cmp.addText(message); + player.sendChatToPlayer(cmp); + + } } diff --git a/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java index 62d82bf8..9875a3de 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java +++ b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java @@ -6,6 +6,7 @@ import net.minecraft.entity.DataWatcher; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityFlying; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; From 1e6a4a8b4ad9314f2a4457340b10f56c5fa1ab2a Mon Sep 17 00:00:00 2001 From: CannibalVox Date: Fri, 6 Dec 2013 21:48:16 -0600 Subject: [PATCH 10/13] A few build fixes --- build.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/build.xml b/build.xml index 5f86e3ad..fdf5d447 100644 --- a/build.xml +++ b/build.xml @@ -14,7 +14,7 @@ - + @@ -144,10 +144,6 @@ - - - - From 1205e858618674d4b568652d605c795088522295 Mon Sep 17 00:00:00 2001 From: CannibalVox Date: Sat, 7 Dec 2013 00:36:54 -0600 Subject: [PATCH 11/13] Remove unnecessary watcher value set command. --- StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java index 9875a3de..1cbb356e 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java +++ b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java @@ -50,7 +50,6 @@ public class MobMonolith extends EntityFlying implements IMob public MobMonolith(World par1World) { super(par1World); - this.getDataWatcher().addObject(16,0); this.setSize(3F, 9.0F); this.noClip=true; this.scaleFactor= (float) ((rand.nextDouble()/2)+1); @@ -72,7 +71,7 @@ public class MobMonolith extends EntityFlying implements IMob protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getAttributeMap().func_111150_b(SharedMonsterAttributes.maxHealth).setAttribute(20); + this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setAttribute(20); } public boolean canBePushed() From d9609ea60b3346933c0a25f6a9a5e1eb78fde2b6 Mon Sep 17 00:00:00 2001 From: CannibalVox Date: Sat, 7 Dec 2013 01:18:44 -0600 Subject: [PATCH 12/13] Fix SMP issue in DD 1.6.4 --- StevenDimDoors/mod_pocketDim/helpers/Compactor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/StevenDimDoors/mod_pocketDim/helpers/Compactor.java b/StevenDimDoors/mod_pocketDim/helpers/Compactor.java index fcff7738..1f3d0c99 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/Compactor.java +++ b/StevenDimDoors/mod_pocketDim/helpers/Compactor.java @@ -39,6 +39,7 @@ public class Compactor for (DimLink link : dimension.links()) { Point4D.write(link.source(), output); + output.writeInt(link.orientation()); } } From 81cc7053de35b0196efc2bae6548b1edfe7221c1 Mon Sep 17 00:00:00 2001 From: CannibalVox Date: Sat, 7 Dec 2013 02:16:50 -0600 Subject: [PATCH 13/13] Clarified network code & set linkdata to always be written to network together. --- .../mod_pocketDim/ServerPacketHandler.java | 11 +++--- .../mod_pocketDim/core/DDTeleporter.java | 10 ++--- .../mod_pocketDim/core/DimLink.java | 38 +++++++++++-------- .../mod_pocketDim/core/NewDimData.java | 33 ++++++++-------- .../mod_pocketDim/core/PocketManager.java | 12 +++--- .../mod_pocketDim/watcher/ClientDimData.java | 4 +- .../mod_pocketDim/watcher/ClientLinkData.java | 4 +- 7 files changed, 62 insertions(+), 50 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/ServerPacketHandler.java b/StevenDimDoors/mod_pocketDim/ServerPacketHandler.java index e8eb51ad..47357124 100644 --- a/StevenDimDoors/mod_pocketDim/ServerPacketHandler.java +++ b/StevenDimDoors/mod_pocketDim/ServerPacketHandler.java @@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; +import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload; import StevenDimDoors.mod_pocketDim.core.PocketManager; @@ -40,16 +41,16 @@ public class ServerPacketHandler implements IPacketHandler } } - private static class LinkWatcher implements IUpdateWatcher + private static class LinkWatcher implements IUpdateWatcher { @Override - public void onCreated(Point4D message) + public void onCreated(ClientLinkData message) { sendLinkPacket(PacketConstants.CREATE_LINK_PACKET_ID, message); } @Override - public void onDeleted(Point4D message) + public void onDeleted(ClientLinkData message) { sendLinkPacket(PacketConstants.DELETE_LINK_PACKET_ID, message); } @@ -77,7 +78,7 @@ public class ServerPacketHandler implements IPacketHandler } } - private static void sendLinkPacket(byte id, Point4D data) + private static void sendLinkPacket(byte id, ClientLinkData message) { try { @@ -85,7 +86,7 @@ public class ServerPacketHandler implements IPacketHandler ByteArrayOutputStream buffer = new ByteArrayOutputStream(); DataOutputStream writer = new DataOutputStream(buffer); writer.writeByte(id); - Point4D.write(data, writer); + message.write(writer); writer.close(); packet.channel = PacketConstants.CHANNEL_NAME; packet.data = buffer.toByteArray(); diff --git a/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java b/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java index bd67f063..4d78abf7 100644 --- a/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java +++ b/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java @@ -469,7 +469,7 @@ public class DDTeleporter { if(PocketManager.isBlackListed(link.destination().getDimension())) { - link=PocketManager.getDimensionData(link.source().getDimension()).createLink(link.source,LinkTypes.SAFE_EXIT,link.orientation); + link=PocketManager.getDimensionData(link.source().getDimension()).createLink(link.link.point,LinkTypes.SAFE_EXIT,link.link.orientation); } else { @@ -545,7 +545,7 @@ public class DDTeleporter // To avoid loops, don't generate a destination if the player is // already in a non-pocket dimension. - NewDimData current = PocketManager.getDimensionData(link.source.getDimension()); + NewDimData current = PocketManager.getDimensionData(link.link.point.getDimension()); if (current.isPocketDimension()) { Point4D source = link.source(); @@ -569,7 +569,7 @@ public class DDTeleporter { World startWorld = PocketManager.loadDimension(link.source().getDimension()); World destWorld = PocketManager.loadDimension(link.destination().getDimension()); - TileEntity doorTE = startWorld.getBlockTileEntity(link.source().getX(), link.source().getY(), link.source.getZ()); + TileEntity doorTE = startWorld.getBlockTileEntity(link.source().getX(), link.source().getY(), link.link.point.getZ()); if(doorTE instanceof TileEntityDimDoor) { if((TileEntityDimDoor.class.cast(doorTE).hasGennedPair)) @@ -599,7 +599,7 @@ public class DDTeleporter } private static boolean generateSafeExit(DimLink link, DDProperties properties) { - NewDimData current = PocketManager.getDimensionData(link.source.getDimension()); + NewDimData current = PocketManager.getDimensionData(link.link.point.getDimension()); return generateSafeExit(current.root(), link, properties); } @@ -608,7 +608,7 @@ public class DDTeleporter // A dungeon exit acts the same as a safe exit, but has the chance of // taking the user to any non-pocket dimension, excluding Limbo and The End. - NewDimData current = PocketManager.getDimensionData(link.source.getDimension()); + NewDimData current = PocketManager.getDimensionData(link.link.point.getDimension()); ArrayList roots = PocketManager.getRootDimensions(); int shiftChance = START_ROOT_SHIFT_CHANCE + ROOT_SHIFT_CHANCE_PER_LEVEL * (current.packDepth() - 1); diff --git a/StevenDimDoors/mod_pocketDim/core/DimLink.java b/StevenDimDoors/mod_pocketDim/core/DimLink.java index 0b89b30e..7b0d18ad 100644 --- a/StevenDimDoors/mod_pocketDim/core/DimLink.java +++ b/StevenDimDoors/mod_pocketDim/core/DimLink.java @@ -4,46 +4,56 @@ import java.util.LinkedList; import java.util.List; import StevenDimDoors.mod_pocketDim.util.Point4D; +import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; + public abstract class DimLink { - protected Point4D source; + protected ClientLinkData link; protected DimLink parent; protected LinkTail tail; - protected int orientation; protected List children; - protected DimLink(Point4D source, DimLink parent, int orientation) + protected DimLink(ClientLinkData link, DimLink parent) { - if (parent.source.getDimension() != source.getDimension()) + if (parent.link.point.getDimension() != link.point.getDimension()) { // Ban having children in other dimensions to avoid serialization issues with cross-dimensional tails throw new IllegalArgumentException("source and parent.source must have the same dimension."); } - this.orientation=orientation; this.parent = parent; - this.source = source; + this.link = link; this.tail = parent.tail; this.children = new LinkedList(); parent.children.add(this); } - protected DimLink(Point4D source, int linkType, int orientation) + protected DimLink(ClientLinkData link, int linkType) { if ((linkType < LinkTypes.ENUM_MIN || linkType > LinkTypes.ENUM_MAX) && linkType != LinkTypes.CLIENT_SIDE) { throw new IllegalArgumentException("The specified link type is invalid."); } - this.orientation = orientation; + this.parent = null; - this.source = source; + this.link = link; this.tail = new LinkTail(linkType, null); this.children = new LinkedList(); } public Point4D source() { - return source; + return link.point; + } + + public int orientation() + { + return link.orientation; + } + + public ClientLinkData link() + { + return link; } public Point4D destination() @@ -52,7 +62,7 @@ public abstract class DimLink } public int getDestinationOrientation() { - return PocketManager.getLink(source.getX(), source.getY(), source.getZ(), source.getDimension()).orientation(); + return PocketManager.getLink(link.point.getX(), link.point.getY(), link.point.getZ(), link.point.getDimension()).link().orientation; } public boolean hasDestination() { @@ -78,13 +88,9 @@ public abstract class DimLink { return tail.getLinkType(); } - public int orientation() - { - return orientation; - } public String toString() { - return source + " -> " + (hasDestination() ? destination() : ""); + return link.point + " -> " + (hasDestination() ? destination() : ""); } } diff --git a/StevenDimDoors/mod_pocketDim/core/NewDimData.java b/StevenDimDoors/mod_pocketDim/core/NewDimData.java index 8cf98a79..2311584f 100644 --- a/StevenDimDoors/mod_pocketDim/core/NewDimData.java +++ b/StevenDimDoors/mod_pocketDim/core/NewDimData.java @@ -6,6 +6,7 @@ import java.util.Map; import java.util.Random; import java.util.TreeMap; +import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.Point3D; @@ -21,12 +22,12 @@ public abstract class NewDimData { public InnerDimLink(Point4D source, DimLink parent,int orientation) { - super(source, parent,orientation); + super(new ClientLinkData(source, orientation), parent); } public InnerDimLink(Point4D source, int linkType, int orientation) { - super(source, linkType,orientation); + super(new ClientLinkData(source, orientation), linkType); } public void setDestination(int x, int y, int z, NewDimData dimension) @@ -50,7 +51,7 @@ public abstract class NewDimData } parent = null; - source = null; + link = null; tail = new LinkTail(0, null); } @@ -65,7 +66,7 @@ public abstract class NewDimData //Ignore this request silently return false; } - if (nextParent.source.getDimension() != source.getDimension()) + if (nextParent.link.point.getDimension() != link.point.getDimension()) { // Ban having children in other dimensions to avoid serialization issues with cross-dimensional tails throw new IllegalArgumentException("source and parent.source must have the same dimension."); @@ -88,7 +89,7 @@ public abstract class NewDimData parent = nextParent; tail = nextParent.tail; nextParent.children.add(this); - this.orientation=orientation; + this.link.orientation=orientation; return true; } @@ -111,7 +112,7 @@ public abstract class NewDimData parent = null; tail = new LinkTail(linkType, null); //Set new orientation - this.orientation=orientation; + this.link.orientation=orientation; } } @@ -130,10 +131,10 @@ public abstract class NewDimData protected Point4D origin; protected int orientation; protected DungeonData dungeon; - protected IUpdateWatcher linkWatcher; + protected IUpdateWatcher linkWatcher; protected NewDimData(int id, NewDimData parent, boolean isPocket, boolean isDungeon, - IUpdateWatcher linkWatcher) + IUpdateWatcher linkWatcher) { // The isPocket flag is redundant. It's meant as an integrity safeguard. if (isPocket && (parent == null)) @@ -267,7 +268,7 @@ public abstract class NewDimData //Link created! if(linkType!=LinkTypes.CLIENT_SIDE) { - linkWatcher.onCreated(link.source); + linkWatcher.onCreated(link.link); } return link; } @@ -290,19 +291,19 @@ public abstract class NewDimData InnerDimLink link = linkMapping.get(source); if (link == null) { - link = new InnerDimLink(source, parent, parent.orientation); + link = new InnerDimLink(source, parent, parent.link.orientation); linkMapping.put(source, link); linkList.add(link); //Link created! - linkWatcher.onCreated(link.source); + linkWatcher.onCreated(link.link); } else { - if (link.overwrite(parent, parent.orientation)) + if (link.overwrite(parent, parent.link.orientation)) { //Link created! - linkWatcher.onCreated(link.source); + linkWatcher.onCreated(link.link); } } return link; @@ -319,7 +320,7 @@ public abstract class NewDimData { linkList.remove(target); //Raise deletion event - linkWatcher.onDeleted(target.source); + linkWatcher.onDeleted(target.link); target.clear(); } return (target != null); @@ -334,9 +335,9 @@ public abstract class NewDimData linkList.remove(target); //Raise deletion event //TODO why is source null here? - if(target.source!=null) + if(target.link!=null) { - linkWatcher.onDeleted(target.source); + linkWatcher.onDeleted(target.link); } target.clear(); } diff --git a/StevenDimDoors/mod_pocketDim/core/PocketManager.java b/StevenDimDoors/mod_pocketDim/core/PocketManager.java index 4dd6c1c7..f24e4f34 100644 --- a/StevenDimDoors/mod_pocketDim/core/PocketManager.java +++ b/StevenDimDoors/mod_pocketDim/core/PocketManager.java @@ -47,7 +47,7 @@ public class PocketManager // that any link destinations must be real dimensions controlled by PocketManager. public InnerDimData(int id, InnerDimData parent, boolean isPocket, boolean isDungeon, - IUpdateWatcher linkWatcher) + IUpdateWatcher linkWatcher) { super(id, parent, isPocket, isDungeon, linkWatcher); } @@ -119,7 +119,7 @@ public class PocketManager Point3D parentPoint = new Point3D(-1,-1,-1); if(link.parent!=null) { - parentPoint=link.parent.source.toPoint3D(); + parentPoint=link.parent.link.point.toPoint3D(); } for(DimLink childLink : link.children) @@ -127,7 +127,7 @@ public class PocketManager children.add(childLink.source().toPoint3D()); } PackedLinkTail tail = new PackedLinkTail(link.tail.getDestination(),link.tail.getLinkType()); - Links.add(new PackedLinkData(link.source,parentPoint,tail,link.orientation,children)); + Links.add(new PackedLinkData(link.link.point,parentPoint,tail,link.link.orientation,children)); PackedLinkTail tempTail = new PackedLinkTail(link.tail.getDestination(),link.tail.getLinkType()); if(Tails.contains(tempTail)) @@ -212,7 +212,7 @@ public class PocketManager * Set as true if we are a client that has connected to a dedicated server */ public static volatile boolean isConnected = false; - private static final UpdateWatcherProxy linkWatcher = new UpdateWatcherProxy(); + private static final UpdateWatcherProxy linkWatcher = new UpdateWatcherProxy(); private static final UpdateWatcherProxy dimWatcher = new UpdateWatcherProxy(); private static ArrayList rootDimensions = null; @@ -650,12 +650,12 @@ public class PocketManager return dimWatcher.unregisterReceiver(watcher); } - public static void registerLinkWatcher(IUpdateWatcher watcher) + public static void registerLinkWatcher(IUpdateWatcher watcher) { linkWatcher.registerReceiver(watcher); } - public static boolean unregisterLinkWatcher(IUpdateWatcher watcher) + public static boolean unregisterLinkWatcher(IUpdateWatcher watcher) { return linkWatcher.unregisterReceiver(watcher); } diff --git a/StevenDimDoors/mod_pocketDim/watcher/ClientDimData.java b/StevenDimDoors/mod_pocketDim/watcher/ClientDimData.java index 7614a109..c0df886c 100644 --- a/StevenDimDoors/mod_pocketDim/watcher/ClientDimData.java +++ b/StevenDimDoors/mod_pocketDim/watcher/ClientDimData.java @@ -32,6 +32,8 @@ public class ClientDimData public static ClientDimData read(DataInputStream input) throws IOException { - return new ClientDimData(input.readInt(), input.readInt()); + int id = input.readInt(); + int rootId = input.readInt(); + return new ClientDimData(id, rootId); } } diff --git a/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java b/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java index 1b9fac19..5670542a 100644 --- a/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java +++ b/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java @@ -32,7 +32,9 @@ public class ClientLinkData public static ClientLinkData read(DataInputStream input) throws IOException { - return new ClientLinkData(Point4D.read(input), input.readInt()); + Point4D point = Point4D.read(input); + int orientation = input.readInt(); + return new ClientLinkData(point, orientation); } }