diff --git a/build.gradle b/build.gradle index 1555934..1929d0d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,45 +5,61 @@ buildscript { name = "forge" url = "http://files.minecraftforge.net/maven" } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' } } - apply plugin: 'forge' -version = "2.2.4-" + System.getenv("BUILD_NUMBER") +version = "2.2.5-" + System.getenv("BUILD_NUMBER") group = "com.stevenrs11.dimdoors" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "DimensionalDoors" minecraft { - version = "1.6.4-9.11.1.964" - - replaceIn "mod_pocketDim.java" - replace "@VERSION@", project.version + version = "1.7.10-10.13.2.1307-1.7.10" + runDir = "eclipse" } targetCompatibility = '1.6' sourceCompatibility = '1.6' processResources -{ - // Replace stuff $version and $mcversion in mcmod.info - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // Replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // Copy everything else - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' + { + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + } + +afterEvaluate { + allprojects { project -> + if (project.plugins.hasPlugin("idea")) + { + idea { module { inheritOutputDirs = true } } + } } } jar { - destinationDir = new File("build/dist/") + manifest { + attributes 'FMLAT': 'DimDoors_at.cfg' + } } diff --git a/src/main/java/StevenDimDoors/experimental/MazeBuilder.java b/src/main/java/StevenDimDoors/experimental/MazeBuilder.java index 9e31e9a..60455d2 100644 --- a/src/main/java/StevenDimDoors/experimental/MazeBuilder.java +++ b/src/main/java/StevenDimDoors/experimental/MazeBuilder.java @@ -3,6 +3,7 @@ package StevenDimDoors.experimental; import java.util.Random; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.storage.ExtendedBlockStorage; @@ -16,7 +17,7 @@ public class MazeBuilder { MazeDesign design = MazeDesigner.generate(random); Point3D offset = new Point3D(x - design.width() / 2, y - design.height() - 1, z - design.length() / 2); - SphereDecayOperation decay = new SphereDecayOperation(random, 0, 0, Block.stoneBrick.blockID, 2); + SphereDecayOperation decay = new SphereDecayOperation(random, Blocks.air, 0, Blocks.stonebrick, 2); buildRooms(design.getRoomGraph(), world, offset); carveDoorways(design.getRoomGraph(), world, offset, decay, random); @@ -37,7 +38,7 @@ public class MazeBuilder for (IGraphNode node : roomGraph.nodes()) { PartitionNode room = node.data(); - buildBox(world, offset, room.minCorner(), room.maxCorner(), Block.stoneBrick.blockID, 0); + buildBox(world, offset, room.minCorner(), room.maxCorner(), Blocks.stonebrick, 0); } } @@ -146,28 +147,28 @@ public class MazeBuilder private static void carveDoorAlongX(World world, int x, int y, int z) { - setBlockDirectly(world, x, y, z, 0, 0); - setBlockDirectly(world, x, y + 1, z, 0, 0); - setBlockDirectly(world, x + 1, y, z, 0, 0); - setBlockDirectly(world, x + 1, y + 1, z, 0, 0); + setBlockDirectly(world, x, y, z, Blocks.air, 0); + setBlockDirectly(world, x, y + 1, z, Blocks.air, 0); + setBlockDirectly(world, x + 1, y, z, Blocks.air, 0); + setBlockDirectly(world, x + 1, y + 1, z, Blocks.air, 0); } private static void carveDoorAlongZ(World world, int x, int y, int z) { - setBlockDirectly(world, x, y, z, 0, 0); - setBlockDirectly(world, x, y + 1, z, 0, 0); - setBlockDirectly(world, x, y, z + 1, 0, 0); - setBlockDirectly(world, x, y + 1, z + 1, 0, 0); + setBlockDirectly(world, x, y, z, Blocks.air, 0); + setBlockDirectly(world, x, y + 1, z, Blocks.air, 0); + setBlockDirectly(world, x, y, z + 1, Blocks.air, 0); + setBlockDirectly(world, x, y + 1, z + 1, Blocks.air, 0); } private static void carveHole(World world, int x, int y, int z) { - setBlockDirectly(world, x, y, z, 0, 0); - setBlockDirectly(world, x, y + 1, z, 0, 0); + setBlockDirectly(world, x, y, z, Blocks.air, 0); + setBlockDirectly(world, x, y + 1, z, Blocks.air, 0); } - private static void buildBox(World world, Point3D offset, Point3D minCorner, Point3D maxCorner, int blockID, int metadata) + private static void buildBox(World world, Point3D offset, Point3D minCorner, Point3D maxCorner, Block block, int metadata) { int minX = minCorner.getX() + offset.getX(); int minY = minCorner.getY() + offset.getY(); @@ -183,35 +184,30 @@ public class MazeBuilder { for (z = minZ; z <= maxZ; z++) { - setBlockDirectly(world, x, minY, z, blockID, metadata); - setBlockDirectly(world, x, maxY, z, blockID, metadata); + setBlockDirectly(world, x, minY, z, block, metadata); + setBlockDirectly(world, x, maxY, z, block, metadata); } } for (x = minX; x <= maxX; x++) { for (y = minY; y <= maxY; y++) { - setBlockDirectly(world, x, y, minZ, blockID, metadata); - setBlockDirectly(world, x, y, maxZ, blockID, metadata); + setBlockDirectly(world, x, y, minZ, block, metadata); + setBlockDirectly(world, x, y, maxZ, block, metadata); } } for (z = minZ; z <= maxZ; z++) { for (y = minY; y <= maxY; y++) { - setBlockDirectly(world, minX, y, z, blockID, metadata); - setBlockDirectly(world, maxX, y, z, blockID, metadata); + setBlockDirectly(world, minX, y, z, block, metadata); + setBlockDirectly(world, maxX, y, z, block, metadata); } } } - private static void setBlockDirectly(World world, int x, int y, int z, int blockID, int metadata) + private static void setBlockDirectly(World world, int x, int y, int z, Block block, int metadata) { - if (blockID != 0 && Block.blocksList[blockID] == null) - { - return; - } - int cX = x >> 4; int cZ = z >> 4; int cY = y >> 4; @@ -228,7 +224,7 @@ public class MazeBuilder extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky); chunk.getBlockStorageArray()[cY] = extBlockStorage; } - extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID); + extBlockStorage.func_150818_a(localX, y & 15, localZ, block); extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata); chunk.setChunkModified(); } diff --git a/src/main/java/StevenDimDoors/experimental/SphereDecayOperation.java b/src/main/java/StevenDimDoors/experimental/SphereDecayOperation.java index 0af0bac..c6fa3d7 100644 --- a/src/main/java/StevenDimDoors/experimental/SphereDecayOperation.java +++ b/src/main/java/StevenDimDoors/experimental/SphereDecayOperation.java @@ -29,18 +29,18 @@ public class SphereDecayOperation extends WorldOperation private double centerX; private double centerY; private double centerZ; - private int primaryBlockID; + private Block primaryBlock; private int primaryMetadata; - private int secondaryBlockID; + private Block secondaryBlock; private int secondaryMetadata; - public SphereDecayOperation(Random random, int primaryBlockID, int primaryMetadata, int secondaryBlockID, int secondaryMetadata) + public SphereDecayOperation(Random random, Block primaryBlock, int primaryMetadata, Block secondaryBlock, int secondaryMetadata) { super("SphereDecayOperation"); this.random = random; - this.primaryBlockID = primaryBlockID; + this.primaryBlock = primaryBlock; this.primaryMetadata = primaryMetadata; - this.secondaryBlockID = secondaryBlockID; + this.secondaryBlock = secondaryBlock; this.secondaryMetadata = secondaryMetadata; } @@ -72,11 +72,11 @@ public class SphereDecayOperation extends WorldOperation if (squareDistance < 0.5 || random.nextDouble() < scaling / squareDistance) { - world.setBlock(x, y, z, primaryBlockID, primaryMetadata, 1); + world.setBlock(x, y, z, primaryBlock, primaryMetadata, 1); } else if (random.nextDouble() < scaling / squareDistance) { - world.setBlock(x, y, z, secondaryBlockID, secondaryMetadata, 1); + world.setBlock(x, y, z, secondaryBlock, secondaryMetadata, 1); } } return true; diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/CommonProxy.java b/src/main/java/StevenDimDoors/mod_pocketDim/CommonProxy.java index 5f48227..cdd81d9 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/CommonProxy.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/CommonProxy.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim; import java.io.File; import java.io.FileOutputStream; import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor; +import StevenDimDoors.mod_pocketDim.config.DDProperties; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor; import net.minecraft.entity.Entity; @@ -12,6 +13,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.network.IGuiHandler; +import net.minecraftforge.common.MinecraftForge; + public class CommonProxy implements IGuiHandler { public static String BLOCK_PNG = "/PocketBlockTextures.png"; @@ -134,18 +137,19 @@ public class CommonProxy implements IGuiHandler } public void updateDoorTE(BaseDimDoor door, World world, int x, int y, int z) { - TileEntity tile = world.getBlockTileEntity(x, y, z); + TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof TileEntityDimDoor) { int metadata = world.getBlockMetadata(x, y, z); TileEntityDimDoor dimTile = (TileEntityDimDoor) tile; dimTile.openOrClosed = door.isDoorOnRift(world, x, y, z)&&door.isUpperDoorBlock(metadata); - dimTile.orientation = door.getFullMetadata(world, x, y, z) & 7; + dimTile.orientation = door.func_150012_g(world, x,y,z) & 7; dimTile.lockStatus = door.getLockStatus(world, x, y, z); } } - - + public void registerSidedHooks(DDProperties properties) { + new ServerPacketHandler(); + } } \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/ConnectionHandler.java b/src/main/java/StevenDimDoors/mod_pocketDim/ConnectionHandler.java index 156ecce..a978b54 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/ConnectionHandler.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/ConnectionHandler.java @@ -1,66 +1,56 @@ package StevenDimDoors.mod_pocketDim; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.NetLoginHandler; -import net.minecraft.network.packet.NetHandler; -import net.minecraft.network.packet.Packet1Login; -import net.minecraft.network.packet.Packet250CustomPayload; +import StevenDimDoors.mod_pocketDim.network.ClientJoinPacket; +import StevenDimDoors.mod_pocketDim.network.DimDoorsNetwork; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; +import cpw.mods.fml.common.network.FMLEmbeddedChannel; +import cpw.mods.fml.common.network.FMLNetworkEvent; +import cpw.mods.fml.common.network.FMLOutboundHandler; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.network.Packet; import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.network.ForgePacket; -import net.minecraftforge.common.network.packet.DimensionRegisterPacket; import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.watcher.ClientDimData; -import cpw.mods.fml.common.network.IConnectionHandler; -import cpw.mods.fml.common.network.Player; +import net.minecraftforge.common.network.ForgeMessage; +import net.minecraftforge.common.network.ForgeNetworkHandler; -public class ConnectionHandler implements IConnectionHandler +public class ConnectionHandler { - @Override - public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager) + @SubscribeEvent + public void serverConnectionFromClientEvent(FMLNetworkEvent.ServerConnectionFromClientEvent event) { + if (FMLCommonHandler.instance().getSide() == Side.SERVER) { + NetHandlerPlayServer server = ((NetHandlerPlayServer)event.handler); + FMLEmbeddedChannel channel = NetworkRegistry.INSTANCE.getChannel("FORGE", Side.SERVER); + for (NewDimData data : PocketManager.getDimensions()) { + try { + if (data.isPocketDimension() || data.id() == mod_pocketDim.properties.LimboDimensionID) { + channel.writeOutbound(new ForgeMessage.DimensionRegisterMessage(data.id(), DimensionManager.getProviderType(data.id()))); + } + + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } + + @SubscribeEvent + public void connectionClosed(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { - for(NewDimData data : PocketManager.getDimensions()) - { - try - { - if(data.isPocketDimension()||data.id()==mod_pocketDim.properties.LimboDimensionID) - { - Packet250CustomPayload[] pkt = ForgePacket.makePacketSet(new DimensionRegisterPacket(data.id(), DimensionManager.getProviderType(data.id()))); - manager.addToSendQueue(pkt[0]); - } - } - catch(Exception E) - { - E.printStackTrace(); - } - } - return null; + PocketManager.tryUnload(); } - @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) + @SubscribeEvent + public void playerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { - 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) - { - // Hax... please don't do this! >_< - PocketManager.getDimwatcher().onCreated(new ClientDimData(PocketManager.createDimensionDataDangerously(0))); + // Hax... please don't do this! >_< + DimDoorsNetwork.sendToPlayer(new ClientJoinPacket(), event.player); } } \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/CraftingManager.java b/src/main/java/StevenDimDoors/mod_pocketDim/CraftingManager.java index cc48470..da7c10c 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/CraftingManager.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/CraftingManager.java @@ -1,9 +1,13 @@ package StevenDimDoors.mod_pocketDim; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; import net.minecraft.block.Block; import net.minecraft.block.BlockDispenser; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -12,10 +16,9 @@ import StevenDimDoors.mod_pocketDim.config.DDProperties; import StevenDimDoors.mod_pocketDim.core.DDLock; import StevenDimDoors.mod_pocketDim.items.ItemDDKey; import StevenDimDoors.mod_pocketDim.items.behaviors.DispenserBehaviorStabilizedRS; -import cpw.mods.fml.common.ICraftingHandler; import cpw.mods.fml.common.registry.GameRegistry; -public class CraftingManager implements ICraftingHandler +public class CraftingManager { CraftingManager() { } @@ -27,19 +30,19 @@ public class CraftingManager implements ICraftingHandler { case 1: GameRegistry.addShapelessRecipe(new ItemStack(mod_pocketDim.itemStableFabric, 1), - Item.enderPearl, mod_pocketDim.itemWorldThread); + Items.ender_pearl, mod_pocketDim.itemWorldThread); break; case 2: GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStableFabric, 1), - "yxy", 'x', Item.enderPearl, 'y', mod_pocketDim.itemWorldThread); + "yxy", 'x', Items.ender_pearl, 'y', mod_pocketDim.itemWorldThread); break; case 3: GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStableFabric, 1), - " y ", "yxy", " y ", 'x', Item.enderPearl, 'y', mod_pocketDim.itemWorldThread); + " y ", "yxy", " y ", 'x', Items.ender_pearl, 'y', mod_pocketDim.itemWorldThread); break; default: GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStableFabric, 1), - "yyy", "yxy", "yyy", 'x', Item.enderPearl, 'y', mod_pocketDim.itemWorldThread); + "yyy", "yxy", "yyy", 'x', Items.ender_pearl, 'y', mod_pocketDim.itemWorldThread); break; } } @@ -47,47 +50,47 @@ public class CraftingManager implements ICraftingHandler if (properties.CraftingDimensionalDoorAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDimensionalDoor, 1), - "yxy", 'x', mod_pocketDim.itemStableFabric, 'y', Item.doorIron); + "yxy", 'x', mod_pocketDim.itemStableFabric, 'y', Items.iron_door); } if (properties.CraftingUnstableDoorAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemUnstableDoor, 1), - "yxy", 'x', Item.eyeOfEnder, 'y', mod_pocketDim.itemDimensionalDoor); + "yxy", 'x', Items.ender_eye, 'y', mod_pocketDim.itemDimensionalDoor); } if (properties.CraftingWarpDoorAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemWarpDoor, 1), - "yxy", 'x', Item.enderPearl, 'y', Item.doorWood); + "yxy", 'x', Items.ender_pearl, 'y', Items.wooden_door); } if (properties.CraftingTransTrapdoorAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.transTrapdoor, 1), - "y", "x", "y", 'x', Item.enderPearl, 'y', Block.trapdoor); + "y", "x", "y", 'x', Items.ender_pearl, 'y', Blocks.trapdoor); } if (properties.CraftingRiftSignatureAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemRiftSignature, 1), - " y ", "yxy", " y ", 'x', Item.enderPearl, 'y', Item.ingotIron); + " y ", "yxy", " y ", 'x', Items.ender_pearl, 'y', Items.iron_ingot); } if (properties.CraftingRiftRemoverAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemRiftRemover, 1), - "yyy", "yxy", "yyy", 'x', Item.enderPearl, 'y', Item.ingotGold); + "yyy", "yxy", "yyy", 'x', Items.ender_pearl, 'y', Items.gold_ingot); } if (properties.CraftingRiftBladeAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemRiftBlade, 1), - "x", "x", "y", 'x', mod_pocketDim.itemStableFabric, 'y', Item.blazeRod); + "x", "x", "y", 'x', mod_pocketDim.itemStableFabric, 'y', Items.blaze_rod); } if (properties.CraftingStabilizedRiftSignatureAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemStabilizedRiftSignature, 1), - " y ", "yxy", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Item.ingotIron); + " y ", "yxy", " y ", 'x', mod_pocketDim.itemStableFabric, 'y', Items.iron_ingot); } if (properties.CraftingGoldenDimensionalDoorAllowed) { @@ -97,12 +100,12 @@ public class CraftingManager implements ICraftingHandler if (properties.CraftingGoldenDoorAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemGoldenDoor, 1), - "yy", "yy", "yy", 'y', Item.ingotGold); + "yy", "yy", "yy", 'y', Items.gold_ingot); } if (properties.CraftingPersonalDimDoorAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemPersonalDoor,1), - "yxy", 'y', mod_pocketDim.itemGoldenDoor, 'x', mod_pocketDim.itemStableFabric); + "yxy", 'y', mod_pocketDim.itemQuartzDoor, 'x', mod_pocketDim.itemStableFabric); } if (properties.CraftingQuartzDoorAllowed) { @@ -114,26 +117,26 @@ public class CraftingManager implements ICraftingHandler if (properties.CraftingDDKeysAllowed) { GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1), - " z", " y ", "y ", 'y', Item.ingotGold, 'z', Item.enderPearl); + " z", " y ", "y ", 'y', Items.gold_ingot, 'z', Items.ender_pearl); GameRegistry.addRecipe(new ItemStack(mod_pocketDim.itemDDKey, 1), "z", "z", 'z', mod_pocketDim.itemDDKey); } } - @Override - public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) + @SubscribeEvent + public void onCrafting(PlayerEvent.ItemCraftedEvent event) { - if(item.getItem() instanceof ItemDDKey) + if(event.crafting.getItem() instanceof ItemDDKey) { - ItemDDKey keyItem = (ItemDDKey) item.getItem(); + ItemDDKey keyItem = (ItemDDKey) event.crafting.getItem(); ItemStack topKey = null; ItemStack bottomKey = null; int topKeySlot = 0; - for(int i = 0; i items = new ArrayList(); - addContent(true, items, Item.ingotIron.itemID, 160, 1, 3); - addContent(true, items, Item.coal.itemID, 120, 1, 3); - addContent(true, items, Item.netherQuartz.itemID, 120, 1, 3); - addContent(true, items, Item.enchantedBook.itemID, 100); - addContent(true, items, Item.ingotGold.itemID, 80, 1, 3); - addContent(true, items, Item.diamond.itemID, 40, 1, 2); - addContent(true, items, Item.emerald.itemID, 20, 1, 2); - addContent(true, items, Item.appleGold.itemID, 10); + addContent(true, items, Items.iron_ingot, 160, 1, 3); + addContent(true, items, Items.coal, 120, 1, 3); + addContent(true, items, Items.quartz, 120, 1, 3); + addContent(true, items, Items.book, 100); + addContent(true, items, Items.gold_ingot, 80, 1, 3); + addContent(true, items, Items.diamond, 40, 1, 2); + addContent(true, items, Items.emerald, 20, 1, 2); + addContent(true, items, Items.golden_apple, 10); - addContent(properties.FabricOfRealityLootEnabled, items, mod_pocketDim.blockDimWall.blockID, 20, 16, 64); - addContent(properties.WorldThreadLootEnabled, items, mod_pocketDim.itemWorldThread.itemID, 80, 2, 12); + addContent(properties.FabricOfRealityLootEnabled, items, Item.getItemFromBlock(mod_pocketDim.blockDimWall), 20, 16, 64); + addContent(properties.WorldThreadLootEnabled, items, mod_pocketDim.itemWorldThread, 80, 2, 12); // Add all the items to our dungeon chest addItemsToContainer(DungeonChestInfo, items); } private static void addContent(boolean include, ArrayList items, - int itemID, int weight) + Item item, int weight) { if (include) - items.add(new WeightedRandomChestContent(itemID, 0, 1, 1, weight)); + items.add(new WeightedRandomChestContent(item, 0, 1, 1, weight)); } private static void addContent(boolean include, ArrayList items, - int itemID, int weight, int minAmount, int maxAmount) + Item item, int weight, int minAmount, int maxAmount) { if (include) - items.add(new WeightedRandomChestContent(itemID, 0, minAmount, maxAmount, weight)); + items.add(new WeightedRandomChestContent(item, 0, minAmount, maxAmount, weight)); } private static void addItemsToContainer(ChestGenHooks container, ArrayList items) @@ -156,25 +157,25 @@ public class DDLoot { count = MathHelper.getRandomIntegerInRange(random, 2, 5); for (k = 0; k < count; k++) { - stacks.add( new ItemStack(Item.bone, 1) ); + stacks.add( new ItemStack(Items.bone, 1) ); } count = MathHelper.getRandomIntegerInRange(random, 2, 4); for (k = 0; k < count; k++) { - stacks.add( new ItemStack(Item.rottenFlesh, 1) ); + stacks.add( new ItemStack(Items.rotten_flesh, 1) ); } // Insert tools // 30% chance of adding a pickaxe if (random.nextInt(100) < 30) { - addModifiedTool(Item.pickaxeIron, stacks, random); + addModifiedTool(Items.iron_pickaxe, stacks, random); } // 30% chance of adding a bow and some arrows if (random.nextInt(100) < 30) { addModifiedBow(stacks, random); - stacks.add( new ItemStack(Item.arrow, MathHelper.getRandomIntegerInRange(random, 8, 32)) ); + stacks.add( new ItemStack(Items.arrow, MathHelper.getRandomIntegerInRange(random, 8, 32)) ); } // 10% chance of adding a Rift Blade (no enchants) if (properties.RiftBladeLootEnabled && random.nextInt(100) < 10) @@ -184,25 +185,25 @@ public class DDLoot { else { // 20% of adding an iron sword, 10% of adding a stone sword - addModifiedSword( getRandomItem(Item.swordIron, Item.swordStone, null, 20, 10, random) , stacks, random); + addModifiedSword( getRandomItem(Items.iron_sword, Items.stone_sword, null, 20, 10, random) , stacks, random); } // Insert equipment // For each piece, 25% of an iron piece, 10% of a chainmail piece - addModifiedEquipment( getRandomItem(Item.helmetIron, Item.helmetChain, null, 25, 10, random) , stacks, random); - addModifiedEquipment( getRandomItem(Item.plateIron, Item.plateChain, null, 25, 10, random) , stacks, random); - addModifiedEquipment( getRandomItem(Item.legsIron, Item.legsChain, null, 25, 10, random) , stacks, random); - addModifiedEquipment( getRandomItem(Item.bootsIron, Item.bootsChain, null, 25, 10, random) , stacks, random); + addModifiedEquipment( getRandomItem(Items.iron_helmet, Items.chainmail_helmet, null, 25, 10, random) , stacks, random); + addModifiedEquipment( getRandomItem(Items.iron_chestplate, Items.chainmail_chestplate, null, 25, 10, random) , stacks, random); + addModifiedEquipment( getRandomItem(Items.iron_leggings, Items.chainmail_leggings, null, 25, 10, random) , stacks, random); + addModifiedEquipment( getRandomItem(Items.iron_boots, Items.iron_boots, null, 25, 10, random) , stacks, random); // Insert other random stuff // 40% chance for a name tag, 35% chance for a glass bottle // 30% chance for an ender pearl, 5% chance for record 11 // 30% chance for a ghast tear - addItemWithChance(stacks, random, 40, Item.nameTag, 1); - addItemWithChance(stacks, random, 35, Item.glassBottle, 1); - addItemWithChance(stacks, random, 30, Item.enderPearl, 1); - addItemWithChance(stacks, random, 30, Item.ghastTear, 1); - addItemWithChance(stacks, random, 5, Item.record11, 1); + addItemWithChance(stacks, random, 40, Items.name_tag, 1); + addItemWithChance(stacks, random, 35, Items.glass_bottle, 1); + addItemWithChance(stacks, random, 30, Items.ender_pearl, 1); + addItemWithChance(stacks, random, 30, Items.ghast_tear, 1); + addItemWithChance(stacks, random, 5, Items.record_11, 1); // Finally, there is a 5% chance of adding a player head if (random.nextInt(100) < 5) @@ -239,7 +240,7 @@ public class DDLoot { private static void addModifiedBow(ArrayList stacks, Random random) { - stacks.add( getModifiedItem(Item.bow, random, new Enchantment[] { Enchantment.flame, Enchantment.power, Enchantment.punch }) ); + stacks.add( getModifiedItem(Items.bow, random, new Enchantment[] { Enchantment.flame, Enchantment.power, Enchantment.punch }) ); } private static ItemStack getModifiedItem(Item item, Random random, Enchantment[] enchantments) @@ -289,7 +290,7 @@ public class DDLoot { { skullOwner = deathTracker.getRandomUsername(random); } - ItemStack skull = new ItemStack(Item.skull, 1, PLAYER_SKULL_METADATA); + ItemStack skull = new ItemStack(Items.skull, 1, PLAYER_SKULL_METADATA); skull.stackTagCompound = new NBTTagCompound(); skull.stackTagCompound.setString("SkullOwner", skullOwner); stacks.add(skull); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/DimData.java b/src/main/java/StevenDimDoors/mod_pocketDim/DimData.java index cd57285..4fb7bfe 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/DimData.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/DimData.java @@ -64,7 +64,7 @@ public class DimData implements Serializable { while (k { @Override public void onCreated(ClientDimData message) { - sendDimPacket(PacketConstants.CREATE_DIM_PACKET_ID, message); + DimDoorsNetwork.sendToAllPlayers(new CreateDimensionPacket(message)); } @Override public void onDeleted(ClientDimData message) { - sendDimPacket(PacketConstants.DELETE_DIM_PACKET_ID, message); + DimDoorsNetwork.sendToAllPlayers(new DeleteDimensionPacket(message)); } @Override @@ -53,89 +47,19 @@ public class ServerPacketHandler implements IPacketHandler @Override public void onCreated(ClientLinkData message) { - sendLinkPacket(PacketConstants.CREATE_LINK_PACKET_ID, message); + DimDoorsNetwork.sendToAllPlayers(new CreateLinkPacket(message)); } @Override public void onDeleted(ClientLinkData message) { - sendLinkPacket(PacketConstants.DELETE_LINK_PACKET_ID, message); + DimDoorsNetwork.sendToAllPlayers(new DeleteLinkPacket(message)); } @Override public void update(ClientLinkData message) { - sendLinkPacket(PacketConstants.UPDATE_LINK_PACKET_ID, message); - } - } - - public static Packet250CustomPayload createLinkPacket(ClientLinkData data) - { - try - { - Packet250CustomPayload packet = new Packet250CustomPayload(); - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - DataOutputStream writer = new DataOutputStream(buffer); - writer.writeByte(PacketConstants.CREATE_LINK_PACKET_ID); - data.write(writer); - writer.close(); - packet.channel = PacketConstants.CHANNEL_NAME; - packet.data = buffer.toByteArray(); - packet.length = packet.data.length; - return packet; - } - catch (IOException e) - { - //This shouldn't happen... - e.printStackTrace(); - return null; - } - - - } - - - private static void sendDimPacket(byte id, ClientDimData data) - { - try - { - Packet250CustomPayload packet = new Packet250CustomPayload(); - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - DataOutputStream writer = new DataOutputStream(buffer); - writer.writeByte(id); - data.write(writer); - writer.close(); - packet.channel = PacketConstants.CHANNEL_NAME; - packet.data = buffer.toByteArray(); - packet.length = packet.data.length; - PacketDispatcher.sendPacketToAllPlayers(packet); - } - catch (IOException e) - { - //This shouldn't happen... - e.printStackTrace(); - } - } - - private static void sendLinkPacket(byte id, ClientLinkData message) - { - try - { - Packet250CustomPayload packet = new Packet250CustomPayload(); - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - DataOutputStream writer = new DataOutputStream(buffer); - writer.writeByte(id); - message.write(writer); - writer.close(); - packet.channel = PacketConstants.CHANNEL_NAME; - packet.data = buffer.toByteArray(); - packet.length = packet.data.length; - PacketDispatcher.sendPacketToAllPlayers(packet); - } - catch (IOException e) - { - //This shouldn't happen... - e.printStackTrace(); + DimDoorsNetwork.sendToAllPlayers(new UpdateLinkPacket(message)); } } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java index b6d24e5..4333d66 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BaseDimDoor.java @@ -1,20 +1,24 @@ package StevenDimDoors.mod_pocketDim.blocks; import java.util.Random; + +import StevenDimDoors.mod_pocketDim.core.LinkType; import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.IconFlipped; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemDoor; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -32,23 +36,23 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn protected final DDProperties properties; @SideOnly(Side.CLIENT) - protected Icon[] upperTextures; + protected IIcon[] upperTextures; @SideOnly(Side.CLIENT) - protected Icon[] lowerTextures; + protected IIcon[] lowerTextures; - public BaseDimDoor(int blockID, Material material, DDProperties properties) + public BaseDimDoor(Material material, DDProperties properties) { - super(blockID, material); + super(material); this.properties = properties; } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) + public void registerBlockIcons(IIconRegister iconRegister) { - upperTextures = new Icon[2]; - lowerTextures = new Icon[2]; + upperTextures = new IIcon[2]; + lowerTextures = new IIcon[2]; upperTextures[0] = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "_upper"); lowerTextures[0] = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "_lower"); upperTextures[1] = new IconFlipped(upperTextures[0], true, false); @@ -60,9 +64,9 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn */ @Override @SideOnly(Side.CLIENT) - public Icon getIcon(int side, int metadata) + public IIcon getIcon(int side, int metadata) { - return this.upperTextures[0]; + return upperTextures[0]; } @Override @@ -86,33 +90,30 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn return false; } - final int MAGIC_CONSTANT = 1003; - - int metadata = this.getFullMetadata(world, x, y, z); - int lowMeta = metadata & 7; - lowMeta ^= 4; + int metadata = this.func_150012_g(world, x, y, z); + int newMetadata = metadata & 7; + newMetadata ^= 4; - if (isUpperDoorBlock(metadata)) - { - world.setBlockMetadataWithNotify(x, y - 1, z, lowMeta, 2); - world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z); - } - else - { - world.setBlockMetadataWithNotify(x, y, z, lowMeta, 2); - world.markBlockRangeForRenderUpdate(x, y, z, x, y, z); - } + if ((metadata & 8) == 0) + { + world.setBlockMetadataWithNotify(x, y, z, newMetadata, 2); + world.markBlockRangeForRenderUpdate(x, y, z, x, y, z); + } + else + { + world.setBlockMetadataWithNotify(x, y - 1, z, newMetadata, 2); + world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z); + } - world.playAuxSFXAtEntity(player, MAGIC_CONSTANT, x, y, z, 0); - - return true; + world.playAuxSFXAtEntity(player, 1003, x, y, z, 0); + return true; } @Override public void onBlockAdded(World world, int x, int y, int z) { this.placeLink(world, x, y, z); - world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world)); + world.setTileEntity(x, y, z, this.createNewTileEntity(world, world.getBlockMetadata(x, y, z))); this.updateAttachedTile(world, x, y, z); } @@ -121,11 +122,11 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn */ @Override @SideOnly(Side.CLIENT) - public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side) + public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { if (side != 1 && side != 0) { - int fullMetadata = this.getFullMetadata(blockAccess, x, y, z); + int fullMetadata = func_150012_g(blockAccess, x, y, z); int orientation = fullMetadata & 3; boolean reversed = false; @@ -186,13 +187,13 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn public BaseDimDoor updateAttachedTile(World world, int x, int y, int z) { mod_pocketDim.proxy.updateDoorTE(this, world, x, y, z); - TileEntity tile = world.getBlockTileEntity(x, y, z); + TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof TileEntityDimDoor) { int metadata = world.getBlockMetadata(x, y, z); TileEntityDimDoor dimTile = (TileEntityDimDoor) tile; dimTile.openOrClosed = isDoorOnRift(world, x, y, z) && isUpperDoorBlock(metadata); - dimTile.orientation = this.getFullMetadata(world, x, y, z) & 7; + dimTile.orientation = this.func_150012_g(world, x, y, z) & 7; } return this; } @@ -242,7 +243,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn @Override public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { - this.setDoorRotation(this.getFullMetadata(par1IBlockAccess, par2, par3, par4)); + this.setDoorRotation(func_150012_g(par1IBlockAccess, par2, par3, par4)); } @@ -334,24 +335,24 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn * their own) Args: x, y, z, neighbor blockID */ @Override - public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID) + public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) { int metadata = world.getBlockMetadata(x, y, z); if (isUpperDoorBlock(metadata)) { - if (world.getBlockId(x, y - 1, z) != this.blockID) + if (world.getBlock(x, y - 1, z) != this) { world.setBlockToAir(x, y, z); } - if (neighborID > 0 && neighborID != this.blockID) + if (!neighbor.isAir(world, x, y, z) && neighbor != this) { - this.onNeighborBlockChange(world, x, y - 1, z, neighborID); + this.onNeighborBlockChange(world, x, y - 1, z, neighbor); } } else { - if (world.getBlockId(x, y + 1, z) != this.blockID) + if (world.getBlock(x, y + 1, z) != this) { world.setBlockToAir(x, y, z); if (!world.isRemote) @@ -362,9 +363,9 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn else if(this.getLockStatus(world, x, y, z)<=1) { boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z); - if ((powered || neighborID > 0 && Block.blocksList[neighborID].canProvidePower()) && neighborID != this.blockID) + if ((powered || !neighbor.isAir(world, x, y, z) && neighbor.canProvidePower()) && neighbor != this) { - this.onPoweredBlockChange(world, x, y, z, powered); + this.func_150014_a(world, x, y, z, powered); } } } @@ -375,24 +376,30 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn */ @Override @SideOnly(Side.CLIENT) - public int idPicked(World world, int x, int y, int z) + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { - return this.getDoorItem(); + return new ItemStack(this.getDoorItem(), 1, 0); } /** * Returns the ID of the items to drop on destruction. */ @Override - public int idDropped(int metadata, Random random, int fortune) + public Item getItemDropped(int metadata, Random random, int fortune) { - return isUpperDoorBlock(metadata) ? 0 : this.getDrops(); + return isUpperDoorBlock(metadata) ? null : this.getDoorItem(); + } + + @Override + @SideOnly(Side.CLIENT) + public Item getItem(World world, int x, int y, int z) { + return this.getDoorItem(); } @Override - public TileEntity createNewTileEntity(World world) + public TileEntity createNewTileEntity(World world, int metadata) { - return new TileEntityDimDoor(); + return new TileEntityDimDoor(); } @Override @@ -405,7 +412,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn } // Check that this is the top block of the door - if (world.getBlockId(x, y - 1, z) == this.blockID) + if (world.getBlock(x, y - 1, z) == this) { int metadata = world.getBlockMetadata(x, y - 1, z); boolean canUse = isDoorOpen(metadata); @@ -418,7 +425,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn { // Teleport the entity through the link, if it exists DimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId); - if (link != null) + if (link != null && (link.linkType() != LinkType.PERSONAL || entity instanceof EntityPlayer)) { try { @@ -433,10 +440,10 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn // Close the door only after the entity goes through // so players don't have it slam in their faces. - this.onPoweredBlockChange(world, x, y, z, false); + this.func_150014_a(world, x, y, z, false); } } - else if (world.getBlockId(x, y + 1, z) == this.blockID) + else if (world.getBlock(x, y + 1, z) == this) { enterDimDoor(world, x, y + 1, z, entity); } @@ -525,20 +532,20 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn @Override public TileEntity initDoorTE(World world, int x, int y, int z) { - TileEntity te = this.createNewTileEntity(world); - world.setBlockTileEntity(x, y, z, te); + TileEntity te = this.createNewTileEntity(world, world.getBlockMetadata(x, y, z)); + world.setTileEntity(x, y, z, te); return te; } @Override - public void breakBlock(World world, int x, int y, int z, int oldBlockID, int oldMeta) + public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta) { // This function runs on the server side after a block is replaced // We MUST call super.breakBlock() since it involves removing tile entities - super.breakBlock(world, x, y, z, oldBlockID, oldMeta); + super.breakBlock(world, x, y, z, oldBlock, oldMeta); // Schedule rift regeneration for this block if it was replaced - if (world.getBlockId(x, y, z) != oldBlockID) + if (world.getBlock(x, y, z) != oldBlock) { mod_pocketDim.riftRegenerator.scheduleFastRegeneration(x, y, z, world); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java index f17ef8e..e627985 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWall.java @@ -6,14 +6,14 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -25,11 +25,11 @@ public class BlockDimWall extends Block { private static final float SUPER_HIGH_HARDNESS = 10000000000000F; private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F; - private Icon[] blockIcon = new Icon[3]; + private IIcon[] blockIcon = new IIcon[3]; - public BlockDimWall(int blockID, int j, Material par2Material) + public BlockDimWall(int j, Material par2Material) { - super(blockID, par2Material); + super(par2Material); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); } @@ -65,7 +65,7 @@ public class BlockDimWall extends Block } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerBlockIcons(IIconRegister par1IconRegister) { this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()); this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName() + "Perm"); @@ -74,7 +74,7 @@ public class BlockDimWall extends Block @SideOnly(Side.CLIENT) @Override - public Icon getIcon(int par1, int par2) + public IIcon getIcon(int par1, int par2) { switch(par2) { @@ -99,7 +99,7 @@ public class BlockDimWall extends Block @Override @SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) - public void getSubBlocks(int unknown, CreativeTabs tab, List subItems) + public void getSubBlocks(Item unknown, CreativeTabs tab, List subItems) { for (int ix = 0; ix < 3; ix++) { @@ -138,10 +138,10 @@ public class BlockDimWall extends Block // SenseiKiwi: Using getBlockID() rather than the raw itemID is critical. // Some mods may override that function and use item IDs outside the range // of the block list. - - int blockID = ((ItemBlock) playerEquip).getBlockID(); - Block block = Block.blocksList[blockID]; - if (!Block.isNormalCube(blockID) || block instanceof BlockContainer || blockID == this.blockID) + + ItemBlock playerEquipItemBlock = (ItemBlock)playerEquip; + Block block = playerEquipItemBlock.field_150939_a; + if (!block.isNormalCube(world, x, y, z) || block instanceof BlockContainer || block == this) { return false; } @@ -151,7 +151,7 @@ public class BlockDimWall extends Block { entityPlayer.getCurrentEquippedItem().stackSize--; } - world.setBlock(x, y, z, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage(), 0); + world.setBlock(x, y, z, block, playerEquipItemBlock.getMetadata(entityPlayer.getCurrentEquippedItem().getItemDamage()), 0); } return true; } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java index d3dac45..e75abe3 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java @@ -4,7 +4,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -22,16 +22,16 @@ public class BlockDimWallPerm extends Block private static final Random random = new Random(); private static DDProperties properties = null; - public BlockDimWallPerm(int i, int j, Material par2Material) + public BlockDimWallPerm(int j, Material par2Material) { - super(i, Material.ground); + super(Material.ground); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); if (properties == null) properties = DDProperties.instance(); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerBlockIcons(IIconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()); } @@ -87,7 +87,7 @@ public class BlockDimWallPerm extends Block if (Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 2 || Math.abs(xc) + Math.abs(zc) < random.nextInt(3) + 3) { - overworld.setBlock(destinationX + xc, destinationY - 1, destinationZ + zc, properties.LimboBlockID); + overworld.setBlock(destinationX + xc, destinationY - 1, destinationZ + zc, mod_pocketDim.blockLimbo); } } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java index f535db3..b7f8fe9 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorGold.java @@ -5,8 +5,9 @@ import java.util.Random; import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.IconFlipped; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.util.Icon; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.Item; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -15,9 +16,9 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockDoorGold extends BlockDoor { - public BlockDoorGold(int par1, Material par2Material) + public BlockDoorGold(Material par2Material) { - super(par1, par2Material); + super( par2Material); } @SideOnly(Side.CLIENT) @@ -26,10 +27,15 @@ public class BlockDoorGold extends BlockDoor return mod_pocketDim.modid + ":" + this.getUnlocalizedName(); } - @Override - public int idDropped(int par1, Random par2Random, int par3) + public Item getItemDropped(int par1, Random par2Random, int par3) { - return (par1 & 8) != 0 ? 0 : mod_pocketDim.itemGoldenDoor.itemID; + return (par1 & 8) != 0 ? null : mod_pocketDim.itemGoldenDoor; + } + + @Override + @SideOnly(Side.CLIENT) + public Item getItem(World world, int x, int y, int z) { + return mod_pocketDim.itemGoldenDoor; } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorQuartz.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorQuartz.java index fb06a00..8abe39e 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorQuartz.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockDoorQuartz.java @@ -6,12 +6,14 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; +import net.minecraft.item.Item; +import net.minecraft.world.World; public class BlockDoorQuartz extends BlockDoor { - public BlockDoorQuartz(int par1, Material par2Material) + public BlockDoorQuartz(Material par2Material) { - super(par1, par2Material); + super(par2Material); } @SideOnly(Side.CLIENT) @@ -21,8 +23,14 @@ public class BlockDoorQuartz extends BlockDoor } @Override - public int idDropped(int par1, Random par2Random, int par3) + public Item getItemDropped(int par1, Random par2Random, int par3) { - return (par1 & 8) != 0 ? 0 : mod_pocketDim.itemGoldenDoor.itemID; + return (par1 & 8) != 0 ? null : mod_pocketDim.itemQuartzDoor; + } + + @Override + @SideOnly(Side.CLIENT) + public Item getItem(World world, int x, int y, int z) { + return mod_pocketDim.itemQuartzDoor; } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java index 22055a9..a4d4e43 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockGoldDimDoor.java @@ -9,21 +9,22 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold; import net.minecraft.block.material.Material; +import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class BlockGoldDimDoor extends BaseDimDoor { - public BlockGoldDimDoor(int blockID, Material material, DDProperties properties) + public BlockGoldDimDoor(Material material, DDProperties properties) { - super(blockID, material, properties); + super( material, properties); } @Override public void placeLink(World world, int x, int y, int z) { - if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID) + if (!world.isRemote && world.getBlock(x, y - 1, z) == this) { NewDimData dimension = PocketManager.createDimensionData(world); DimLink link = dimension.getLink(x, y, z); @@ -35,19 +36,13 @@ public class BlockGoldDimDoor extends BaseDimDoor } @Override - public int getDoorItem() + public Item getDoorItem() { - return mod_pocketDim.itemGoldenDimensionalDoor.itemID; + return mod_pocketDim.itemGoldenDimensionalDoor; } @Override - public int getDrops() - { - return mod_pocketDim.itemGoldenDoor.itemID; - } - - @Override - public TileEntity createNewTileEntity(World world) + public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityDimDoorGold(); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java index 07f1247..87ae7b4 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockLimbo.java @@ -4,8 +4,8 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.util.Icon; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -18,9 +18,9 @@ public class BlockLimbo extends Block private final int limboDimensionID; private final LimboDecay decay; - public BlockLimbo(int i, int j, Material par2Material, int limboDimensionID, LimboDecay decay) + public BlockLimbo(int j, Material par2Material, int limboDimensionID, LimboDecay decay) { - super(i, Material.ground); + super(Material.ground); this.limboDimensionID = limboDimensionID; this.decay = decay; this.setTickRandomly(true); @@ -32,19 +32,19 @@ public class BlockLimbo extends Block */ @SideOnly(Side.CLIENT) @Override - public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side) + public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { return this.getIcon(side, blockAccess.getBlockMetadata(x, y, z)); } @Override - public void registerIcons(IconRegister iconRegister) + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()); } @Override - public Icon getIcon(int par1, int par2) + public IIcon getIcon(int par1, int par2) { return this.blockIcon; } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockRift.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockRift.java index 5890b49..1409227 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockRift.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/BlockRift.java @@ -7,15 +7,18 @@ import java.util.Queue; import java.util.Random; import net.minecraft.block.Block; -import net.minecraft.block.BlockFlowing; -import net.minecraft.block.BlockFluid; +import net.minecraft.block.BlockLiquid; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.IFluidBlock; @@ -47,48 +50,48 @@ public class BlockRift extends Block implements ITileEntityProvider public static final int MAX_WORLD_THREAD_DROP_CHANCE = 1000; private final DDProperties properties; - private final ArrayList blocksImmuneToRift; // List of Vanilla blocks immune to rifts - private final ArrayList modBlocksImmuneToRift; // List of DD blocks immune to rifts + private final ArrayList blocksImmuneToRift; // List of Vanilla blocks immune to rifts + private final ArrayList modBlocksImmuneToRift; // List of DD blocks immune to rifts - public BlockRift(int i, int j, Material par2Material, DDProperties properties) + public BlockRift(Material par2Material, DDProperties properties) { - super(i, par2Material); + super(par2Material); this.setTickRandomly(true); this.properties = properties; - this.modBlocksImmuneToRift = new ArrayList(); - this.modBlocksImmuneToRift.add(properties.FabricBlockID); - this.modBlocksImmuneToRift.add(properties.PermaFabricBlockID); - this.modBlocksImmuneToRift.add(properties.DimensionalDoorID); - this.modBlocksImmuneToRift.add(properties.WarpDoorID); - this.modBlocksImmuneToRift.add(properties.TransTrapdoorID); - this.modBlocksImmuneToRift.add(properties.UnstableDoorID); - this.modBlocksImmuneToRift.add(properties.RiftBlockID); - this.modBlocksImmuneToRift.add(properties.TransientDoorID); - this.modBlocksImmuneToRift.add(properties.GoldenDimensionalDoorID); - this.modBlocksImmuneToRift.add(properties.GoldenDoorID); + this.modBlocksImmuneToRift = new ArrayList(); + this.modBlocksImmuneToRift.add(mod_pocketDim.blockDimWall); + this.modBlocksImmuneToRift.add(mod_pocketDim.blockDimWallPerm); + this.modBlocksImmuneToRift.add(mod_pocketDim.dimensionalDoor); + this.modBlocksImmuneToRift.add(mod_pocketDim.warpDoor); + this.modBlocksImmuneToRift.add(mod_pocketDim.transTrapdoor); + this.modBlocksImmuneToRift.add(mod_pocketDim.unstableDoor); + this.modBlocksImmuneToRift.add(mod_pocketDim.blockRift); + this.modBlocksImmuneToRift.add(mod_pocketDim.transientDoor); + this.modBlocksImmuneToRift.add(mod_pocketDim.goldenDimensionalDoor); + this.modBlocksImmuneToRift.add(mod_pocketDim.goldenDoor); - this.blocksImmuneToRift = new ArrayList(); + this.blocksImmuneToRift = new ArrayList(); - this.blocksImmuneToRift.add(properties.FabricBlockID); - this.blocksImmuneToRift.add(properties.PermaFabricBlockID); - this.blocksImmuneToRift.add(properties.DimensionalDoorID); - this.blocksImmuneToRift.add(properties.WarpDoorID); - this.blocksImmuneToRift.add(properties.TransTrapdoorID); - this.blocksImmuneToRift.add(properties.UnstableDoorID); - this.blocksImmuneToRift.add(properties.RiftBlockID); - this.blocksImmuneToRift.add(properties.TransientDoorID); - this.blocksImmuneToRift.add(properties.GoldenDimensionalDoorID); - this.blocksImmuneToRift.add(properties.GoldenDoorID); - this.blocksImmuneToRift.add(properties.PersonalDimDoorID); - this.blocksImmuneToRift.add(Block.blockLapis.blockID); - this.blocksImmuneToRift.add(Block.blockIron.blockID); - this.blocksImmuneToRift.add(Block.blockGold.blockID); - this.blocksImmuneToRift.add(Block.blockDiamond.blockID); - this.blocksImmuneToRift.add(Block.blockEmerald.blockID); + this.blocksImmuneToRift.add(mod_pocketDim.blockDimWall); + this.blocksImmuneToRift.add(mod_pocketDim.blockDimWallPerm); + this.blocksImmuneToRift.add(mod_pocketDim.dimensionalDoor); + this.blocksImmuneToRift.add(mod_pocketDim.warpDoor); + this.blocksImmuneToRift.add(mod_pocketDim.transTrapdoor); + this.blocksImmuneToRift.add(mod_pocketDim.unstableDoor); + this.blocksImmuneToRift.add(mod_pocketDim.blockRift); + this.blocksImmuneToRift.add(mod_pocketDim.transientDoor); + this.blocksImmuneToRift.add(mod_pocketDim.goldenDimensionalDoor); + this.blocksImmuneToRift.add(mod_pocketDim.goldenDoor); + this.blocksImmuneToRift.add(mod_pocketDim.personalDimDoor); + this.blocksImmuneToRift.add(Blocks.lapis_block); + this.blocksImmuneToRift.add(Blocks.iron_block); + this.blocksImmuneToRift.add(Blocks.gold_block); + this.blocksImmuneToRift.add(Blocks.diamond_block); + this.blocksImmuneToRift.add(Blocks.emerald_block); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerBlockIcons(IIconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()); } @@ -128,11 +131,7 @@ public class BlockRift extends Block implements ITileEntityProvider public int getRenderType() { // This doesn't do anything yet - if (mod_pocketDim.isPlayerWearingGoogles) - { - return 0; - } - return 8; + return 0; } /** @@ -166,7 +165,7 @@ public class BlockRift extends Block implements ITileEntityProvider //Randomly decide whether to search for blocks to destroy. This reduces the frequency of search operations, //moderates performance impact, and controls the apparent speed of block destruction. if (random.nextInt(MAX_BLOCK_SEARCH_CHANCE) < BLOCK_SEARCH_CHANCE && - ((TileEntityRift) world.getBlockTileEntity(x, y, z)).updateNearestRift() ) + ((TileEntityRift) world.getTileEntity(x, y, z)).updateNearestRift() ) { destroyNearbyBlocks(world, x, y, z, random); } @@ -184,8 +183,8 @@ public class BlockRift extends Block implements ITileEntityProvider { if (random.nextInt(MAX_BLOCK_DESTRUCTION_CHANCE) < BLOCK_DESTRUCTION_CHANCE) { - dropWorldThread(world.getBlockId(target.getX(), target.getY(), target.getZ()), world, x, y, z, random); - world.destroyBlock(target.getX(), target.getY(), target.getZ(), false); + dropWorldThread(world.getBlock(target.getX(), target.getY(), target.getZ()), world, x, y, z, random); + world.func_147480_a(target.getX(), target.getY(), target.getZ(), false); } } } @@ -231,12 +230,11 @@ public class BlockRift extends Block implements ITileEntityProvider return targets; } - public void dropWorldThread(int blockID, World world, int x, int y, int z, Random random) + public void dropWorldThread(Block block, World world, int x, int y, int z, Random random) { - if (blockID != 0 && (random.nextInt(MAX_WORLD_THREAD_DROP_CHANCE) < properties.WorldThreadDropChance) - && !(Block.blocksList[blockID] instanceof BlockFlowing || - Block.blocksList[blockID] instanceof BlockFluid || - Block.blocksList[blockID] instanceof IFluidBlock)) + if (!block.isAir(world, x, y, z) && (random.nextInt(MAX_WORLD_THREAD_DROP_CHANCE) < properties.WorldThreadDropChance) + && !(block instanceof BlockLiquid || + block instanceof IFluidBlock)) { ItemStack thread = new ItemStack(mod_pocketDim.itemWorldThread, 1); world.spawnEntityInWorld(new EntityItem(world, x, y, z, thread)); @@ -265,7 +263,8 @@ public class BlockRift extends Block implements ITileEntityProvider public boolean spreadRift(NewDimData dimension, DimLink parent, World world, Random random) { - int x, y, z, blockID; + int x, y, z; + Block block = null; Point4D source = parent.source(); // Find reachable blocks that are vulnerable to rift damage and include air @@ -281,11 +280,11 @@ public class BlockRift extends Block implements ITileEntityProvider z = target.getZ(); // Create a child, replace the block with a rift, and consider dropping World Thread - blockID = world.getBlockId(x, y, z); - if (world.setBlock(x, y, z, properties.RiftBlockID)) + block = world.getBlock(x, y, z); + if (world.setBlock(x, y, z, mod_pocketDim.blockRift)) { dimension.createChildLink(x, y, z, parent); - dropWorldThread(blockID, world, x, y, z, random); + dropWorldThread(block, world, x, y, z, random); return true; } } @@ -314,15 +313,14 @@ public class BlockRift extends Block implements ITileEntityProvider ArrayList targets=findReachableBlocks(world, x, y, z, 2, false); - TileEntityRift tile = (TileEntityRift)world.getBlockTileEntity(x, y, z); + TileEntityRift tile = (TileEntityRift)world.getTileEntity(x, y, z); - if(rand.nextBoolean()) - { + //renders an extra little blob on top of the actual rift location so its easier to find. Eventually will only render if the player has the goggles. FMLClientHandler.instance().getClient().effectRenderer.addEffect(new GoggleRiftFX(world,x+.5, y+.5, z+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer)); - } - if(tile.shouldClose) + + if(tile.shouldClose) { //renders an opposite color effect if it is being closed by the rift remover FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(world,x+.5, y+.5, z+.5, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, FMLClientHandler.instance().getClient().effectRenderer)); @@ -335,14 +333,14 @@ public class BlockRift extends Block implements ITileEntityProvider { if (world != null && !isBlockImmune(world, x, y, z)) { - return world.setBlock(x, y, z, mod_pocketDim.blockRift.blockID); + return world.setBlock(x, y, z, mod_pocketDim.blockRift); } return false; } public boolean isBlockImmune(World world, int x, int y, int z) { - Block block = Block.blocksList[world.getBlockId(x, y, z)]; + Block block = world.getBlock(x, y, z); if (block != null) { // SenseiKiwi: I've switched to using the block's blast resistance instead of its @@ -352,8 +350,8 @@ public class BlockRift extends Block implements ITileEntityProvider // I've set this to access blockResistance directly. Might need changing later. return (block.blockResistance >= MIN_IMMUNE_RESISTANCE || - modBlocksImmuneToRift.contains(block.blockID) || - blocksImmuneToRift.contains(block.blockID)); + modBlocksImmuneToRift.contains(block) || + blocksImmuneToRift.contains(block)); } return false; } @@ -362,41 +360,41 @@ public class BlockRift extends Block implements ITileEntityProvider { // Check whether the block at the specified location is one of the // rift-resistant blocks from DD. - Block block = Block.blocksList[world.getBlockId(x, y, z)]; + Block block = world.getBlock(x, y, z); if (block != null) { - return modBlocksImmuneToRift.contains(block.blockID); + return modBlocksImmuneToRift.contains(block); } return false; } @Override - public int idPicked(World par1World, int par2, int par3, int par4) + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) + { + return null; + } + + @Override + public Item getItemDropped(int par1, Random par2Random, int par3) { - return 0; + return null; } @Override - public int idDropped(int par1, Random par2Random, int par3) - { - return 0; - } - - @Override - public TileEntity createNewTileEntity(World world) + public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityRift(); } @Override - public void breakBlock(World world, int x, int y, int z, int oldBlockID, int oldMeta) + public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta) { // This function runs on the server side after a block is replaced // We MUST call super.breakBlock() since it involves removing tile entities - super.breakBlock(world, x, y, z, oldBlockID, oldMeta); + super.breakBlock(world, x, y, z, oldBlock, oldMeta); // Schedule rift regeneration for this block if it was changed - if (world.getBlockId(x, y, z) != oldBlockID) + if (world.getBlock(x, y, z) != oldBlock) { mod_pocketDim.riftRegenerator.scheduleSlowRegeneration(x, y, z, world); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java index 8416f5f..65cc4a8 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/DimensionalDoor.java @@ -12,15 +12,15 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager; public class DimensionalDoor extends BaseDimDoor { - public DimensionalDoor(int blockID, Material material, DDProperties properties) + public DimensionalDoor(Material material, DDProperties properties) { - super(blockID, material, properties); + super(material, properties); } @Override public void placeLink(World world, int x, int y, int z) { - if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID) + if (!world.isRemote && world.getBlock(x, y - 1, z) == this) { NewDimData dimension = PocketManager.createDimensionData(world); DimLink link = dimension.getLink(x, y, z); @@ -32,14 +32,8 @@ public class DimensionalDoor extends BaseDimDoor } @Override - public int getDoorItem() + public Item getDoorItem() { - return mod_pocketDim.itemDimensionalDoor.itemID; - } - - @Override - public int getDrops() - { - return Item.doorIron.itemID; + return mod_pocketDim.itemDimensionalDoor; } } \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/IDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/IDimDoor.java index 608eeb3..dfe7f83 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/IDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/IDimDoor.java @@ -1,6 +1,7 @@ package StevenDimDoors.mod_pocketDim.blocks; import net.minecraft.entity.Entity; +import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -25,9 +26,7 @@ public interface IDimDoor */ public void placeLink(World world, int x, int y, int z); - public int getDrops(); - - public int getDoorItem(); + public Item getDoorItem(); public TileEntity initDoorTE(World world, int x, int y, int z); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/PersonalDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/PersonalDimDoor.java index 4dfb501..9c7f297 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/PersonalDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/PersonalDimDoor.java @@ -1,6 +1,8 @@ package StevenDimDoors.mod_pocketDim.blocks; +import StevenDimDoors.mod_pocketDim.world.PersonalPocketProvider; import net.minecraft.block.material.Material; +import net.minecraft.item.Item; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.config.DDProperties; @@ -12,36 +14,33 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager; public class PersonalDimDoor extends BaseDimDoor { - public PersonalDimDoor(int blockID, Material material, DDProperties properties) + public PersonalDimDoor(Material material, DDProperties properties) { - super(blockID, material, properties); + super( material, properties); // TODO Auto-generated constructor stub } @Override public void placeLink(World world, int x, int y, int z) { - if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID) + if (!world.isRemote && world.getBlock(x, y - 1, z) == this) { NewDimData dimension = PocketManager.getDimensionData(world); DimLink link = dimension.getLink(x, y, z); if (link == null) { - dimension.createLink(x, y, z, LinkType.PERSONAL, world.getBlockMetadata(x, y - 1, z)); + if (world.provider instanceof PersonalPocketProvider) + dimension.createLink(x, y, z, LinkType.LIMBO, world.getBlockMetadata(x, y-1, z)); + else + dimension.createLink(x, y, z, LinkType.PERSONAL, world.getBlockMetadata(x, y - 1, z)); } } } @Override - public int getDrops() + public Item getDoorItem() { - return mod_pocketDim.itemQuartzDoor.itemID; - } - - @Override - public int getDoorItem() - { - return mod_pocketDim.itemPersonalDoor.itemID; + return mod_pocketDim.itemPersonalDoor; } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java index 453569b..a3da637 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransTrapdoor.java @@ -9,11 +9,15 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockTrapDoor; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.core.DDTeleporter; @@ -27,14 +31,14 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor; public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider { - public TransTrapdoor(int blockID, Material material) + public TransTrapdoor(Material material) { - super(blockID, material); + super(material); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerBlockIcons(IIconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName()); } @@ -92,20 +96,20 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit { if(this.checkCanOpen(par1World, par2, par3, par4)) { - super.onPoweredBlockChange(par1World, par2, par3, par4, par5); + super.func_150120_a(par1World, par2, par3, par4, par5); } } @Override public void enterDimDoor(World world, int x, int y, int z, Entity entity) { - if (!world.isRemote && isTrapdoorOpen(world.getBlockMetadata(x, y, z))) + if (!world.isRemote && func_150118_d(world.getBlockMetadata(x, y, z))) { DimLink link = PocketManager.getLink(x, y, z, world); - if (link != null) + if (link != null && (link.linkType() != LinkType.PERSONAL || entity instanceof EntityPlayer)) { DDTeleporter.traverseDimDoor(world, link, entity,this); } - super.onPoweredBlockChange(world, x, y, z, false); + super.func_150120_a(world, x, y, z, false); } } @@ -113,11 +117,11 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit public void onBlockAdded(World world, int x, int y, int z) { this.placeLink(world, x, y, z); - world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world)); + world.setTileEntity(x, y, z, this.createNewTileEntity(world, world.getBlockMetadata(x, y, z))); } @Override - public TileEntity createNewTileEntity(World world) + public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityTransTrapdoor(); } @@ -138,28 +142,22 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit @Override @SideOnly(Side.CLIENT) - public int idPicked(World world, int x, int y, int z) + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { - return this.getDoorItem(); + return new ItemStack(this.getDoorItem(), 1, 0); } @Override - public int idDropped(int metadata, Random random, int fortuneLevel) + public Item getItemDropped(int metadata, Random random, int fortuneLevel) { - return this.getDrops(); + return Item.getItemFromBlock(Blocks.trapdoor); } @Override - public int getDoorItem() + public Item getDoorItem() { - return mod_pocketDim.transTrapdoor.blockID; + return Item.getItemFromBlock(mod_pocketDim.transTrapdoor); } - - @Override - public int getDrops() - { - return Block.trapdoor.blockID; - } public static boolean isTrapdoorSetLow(int metadata) { @@ -169,8 +167,8 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit @Override public TileEntity initDoorTE(World world, int x, int y, int z) { - TileEntity te = this.createNewTileEntity(world); - world.setBlockTileEntity(x, y, z, te); + TileEntity te = this.createNewTileEntity(world, world.getBlockMetadata(x, y, z)); + world.setTileEntity(x, y, z, te); return te; } @@ -181,14 +179,14 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit } @Override - public void breakBlock(World world, int x, int y, int z, int oldBlockID, int oldMeta) + public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta) { // This function runs on the server side after a block is replaced // We MUST call super.breakBlock() since it involves removing tile entities - super.breakBlock(world, x, y, z, oldBlockID, oldMeta); + super.breakBlock(world, x, y, z, oldBlock, oldMeta); // Schedule rift regeneration for this block if it was replaced - if (world.getBlockId(x, y, z) != oldBlockID) + if (world.getBlock(x, y, z) != oldBlock) { mod_pocketDim.riftRegenerator.scheduleFastRegeneration(x, y, z, world); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java index 8364733..0d45171 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/TransientDoor.java @@ -1,9 +1,11 @@ package StevenDimDoors.mod_pocketDim.blocks; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.config.DDProperties; @@ -15,9 +17,9 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager; public class TransientDoor extends BaseDimDoor { - public TransientDoor(int blockID, Material material, DDProperties properties) + public TransientDoor(Material material, DDProperties properties) { - super(blockID, material, properties); + super(material, properties); } @Override @@ -30,7 +32,7 @@ public class TransientDoor extends BaseDimDoor } // Check that this is the top block of the door - if (world.getBlockId(x, y - 1, z) == this.blockID) + if (world.getBlock(x, y - 1, z) == this) { boolean canUse = true; int metadata = world.getBlockMetadata(x, y - 1, z); @@ -45,15 +47,17 @@ public class TransientDoor extends BaseDimDoor DimLink link = PocketManager.getLink(x, y, z, world.provider.dimensionId); if (link != null) { - DDTeleporter.traverseDimDoor(world, link, entity, this); - // Turn the door into a rift AFTER teleporting the player. - // The door's orientation may be necessary for the teleport. - world.setBlock(x, y, z, properties.RiftBlockID); - world.setBlockToAir(x, y - 1, z); + if (link.linkType() != LinkType.PERSONAL || entity instanceof EntityPlayer) { + DDTeleporter.traverseDimDoor(world, link, entity, this); + // Turn the door into a rift AFTER teleporting the player. + // The door's orientation may be necessary for the teleport. + world.setBlock(x, y, z, mod_pocketDim.blockRift); + world.setBlockToAir(x, y - 1, z); + } } } } - else if (world.getBlockId(x, y + 1, z) == this.blockID) + else if (world.getBlock(x, y + 1, z) == this) { enterDimDoor(world, x, y + 1, z, entity); } @@ -62,7 +66,7 @@ public class TransientDoor extends BaseDimDoor @Override public void placeLink(World world, int x, int y, int z) { - if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID) + if (!world.isRemote && world.getBlock(x, y - 1, z) == this) { NewDimData dimension = PocketManager.createDimensionData(world); DimLink link = dimension.getLink(x, y, z); @@ -74,15 +78,9 @@ public class TransientDoor extends BaseDimDoor } @Override - public int getDoorItem() + public Item getDoorItem() { - return 0; - } - - @Override - public int getDrops() - { - return 0; + return null; } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/UnstableDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/UnstableDoor.java index 76b9911..a780e2d 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/UnstableDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/UnstableDoor.java @@ -1,7 +1,9 @@ package StevenDimDoors.mod_pocketDim.blocks; import net.minecraft.block.material.Material; +import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.config.DDProperties; @@ -9,17 +11,20 @@ import StevenDimDoors.mod_pocketDim.core.LinkType; import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.PocketManager; +import java.util.ArrayList; +import java.util.Random; + public class UnstableDoor extends BaseDimDoor { - public UnstableDoor(int blockID, Material material, DDProperties properties) + public UnstableDoor(Material material, DDProperties properties) { - super(blockID, material, properties); + super(material, properties); } @Override public void placeLink(World world, int x, int y, int z) { - if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID) + if (!world.isRemote && world.getBlock(x, y - 1, z) == this) { NewDimData dimension = PocketManager.getDimensionData(world); dimension.createLink(x, y, z, LinkType.RANDOM,world.getBlockMetadata(x, y - 1, z)); @@ -27,14 +32,14 @@ public class UnstableDoor extends BaseDimDoor } @Override - public int getDoorItem() + public Item getDoorItem() { - return mod_pocketDim.itemUnstableDoor.itemID; + return mod_pocketDim.itemUnstableDoor; } @Override - public int getDrops() + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - return Item.doorIron.itemID; + return Items.iron_door; } } \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java index 45357e9..df10fac 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/blocks/WarpDoor.java @@ -12,15 +12,15 @@ import StevenDimDoors.mod_pocketDim.core.PocketManager; public class WarpDoor extends BaseDimDoor { - public WarpDoor(int blockID, Material material, DDProperties properties) + public WarpDoor(Material material, DDProperties properties) { - super(blockID, material, properties); + super(material, properties); } @Override public void placeLink(World world, int x, int y, int z) { - if (!world.isRemote && world.getBlockId(x, y - 1, z) == this.blockID) + if (!world.isRemote && world.getBlock(x, y - 1, z) == this) { NewDimData dimension = PocketManager.createDimensionData(world); DimLink link = dimension.getLink(x, y, z); @@ -32,14 +32,8 @@ public class WarpDoor extends BaseDimDoor } @Override - public int getDoorItem() + public Item getDoorItem() { - return mod_pocketDim.itemWarpDoor.itemID; - } - - @Override - public int getDrops() - { - return Item.doorWood.itemID; + return mod_pocketDim.itemWarpDoor; } } \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java b/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java index 4fa55a3..8c8d486 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java @@ -67,7 +67,7 @@ public class CommandCreateDungeonRift extends DDCommandBase if (PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result)) { // Create a rift to our selected dungeon and notify the player - sender.worldObj.setBlock(x, y + 1, z, mod_pocketDim.blockRift.blockID, 0, 3); + sender.worldObj.setBlock(x, y + 1, z, mod_pocketDim.blockRift, 0, 3); sendChat(sender, "Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ")."); } else diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandCreateRandomRift.java b/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandCreateRandomRift.java index 0c6672f..56d5c26 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandCreateRandomRift.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandCreateRandomRift.java @@ -56,7 +56,7 @@ public class CommandCreateRandomRift extends DDCommandBase dimension = PocketManager.getDimensionData(sender.worldObj); link = dimension.createLink(x, y + 1, z, LinkType.DUNGEON, orientation); - sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift.blockID, 0, 3); + sender.worldObj.setBlock(x, y + 1, z,mod_pocketDim.blockRift, 0, 3); sendChat(sender, "Created a rift to a random dungeon."); } else @@ -76,7 +76,7 @@ public class CommandCreateRandomRift extends DDCommandBase if (PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, result)) { // Create a rift to our selected dungeon and notify the player - sender.worldObj.setBlock(x, y + 1, z, mod_pocketDim.blockRift.blockID, 0, 3); + sender.worldObj.setBlock(x, y + 1, z, mod_pocketDim.blockRift, 0, 3); sendChat(sender, "Created a rift to \"" + result.schematicName() + "\" dungeon (Dimension ID = " + link.destination().getDimension() + ")."); } else diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java b/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java index 9a50857..a21d56a 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java @@ -71,7 +71,7 @@ public class CommandDeleteRifts extends DDCommandBase x = location.getX(); y = location.getY(); z = location.getZ(); - if (world.getBlockId(x, y, z) == mod_pocketDim.blockRift.blockID) + if (world.getBlock(x, y, z) == mod_pocketDim.blockRift) { // Remove the rift and its link world.setBlockToAir(x, y, z); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandTeleportPlayer.java b/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandTeleportPlayer.java index b001c7a..fa1300b 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandTeleportPlayer.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/commands/CommandTeleportPlayer.java @@ -62,7 +62,7 @@ public class CommandTeleportPlayer extends DDCommandBase } } // Check if the target player is logged in - targetPlayer = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(command[0]); + targetPlayer = MinecraftServer.getServer().getConfigurationManager().func_152612_a(command[0]); if (targetPlayer == null) { return DDCommandResult.PLAYER_OFFLINE; diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java b/src/main/java/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java index badb0a2..fe6ac2e 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/commands/DDCommandBase.java @@ -4,7 +4,7 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ChatMessageComponent; +import net.minecraft.util.ChatComponentText; /* * An abstract base class for our Dimensional Doors commands. This cleans up the code a little and provides @@ -85,9 +85,8 @@ public abstract class DDCommandBase extends CommandBase public static void sendChat(EntityPlayer player, String message) { - ChatMessageComponent cmp = new ChatMessageComponent(); - cmp.addText(message); - player.sendChatToPlayer(cmp); + ChatComponentText text = new ChatComponentText(message); + player.addChatMessage(text); } /* diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/config/DDProperties.java b/src/main/java/StevenDimDoors/mod_pocketDim/config/DDProperties.java index 4996764..3816a6d 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/config/DDProperties.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/config/DDProperties.java @@ -2,56 +2,14 @@ package StevenDimDoors.mod_pocketDim.config; import java.io.File; -import net.minecraftforge.common.Configuration; import StevenDimDoors.mod_pocketDim.blocks.BlockRift; import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator; import StevenDimDoors.mod_pocketDim.world.fortresses.DDStructureNetherBridgeStart; import StevenDimDoors.mod_pocketDim.world.gateways.GatewayGenerator; +import net.minecraftforge.common.config.Configuration; public class DDProperties { - /** - * Block IDs - */ - - public final int UnstableDoorID; - public final int DimensionalDoorID; - public final int GoldenDoorID; - public final int GoldenDimensionalDoorID; - public final int WarpDoorID; - public final int TransTrapdoorID; - public final int TransientDoorID; - public final int FabricBlockID; - public final int RiftBlockID; - public final int QuartzDoorID; - public final int PersonalDimDoorID; - - - /** - * World Generation Block IDs - */ - - public final int LimboBlockID; - public final int PermaFabricBlockID; - - /** - * Item IDs - */ - - public final int RiftBladeItemID; - public final int RiftSignatureItemID; - public final int GoldenDimensionalDoorItemID; - public final int GoldenDoorItemID; - public final int RiftRemoverItemID; - public final int StableFabricItemID; - public final int StabilizedRiftSignatureItemID; - public final int DimensionalDoorItemID; - public final int UnstableDoorItemID; - public final int WarpDoorItemID; - public final int WorldThreadItemID; - public final int DDKeyItemID; - public final int ItemQuartzDoorID; - public final int ItemPersonalDimDoorID; /** * Other IDs @@ -106,7 +64,7 @@ public class DDProperties public final boolean DoorRenderingEnabled; public final boolean TNFREAKINGT_Enabled; public final boolean MonolithTeleportationEnabled; - + public final boolean DangerousLimboMonolithsDisabled; /** * Other @@ -123,7 +81,6 @@ public class DDProperties public final int WorldThreadRequirementLevel; public final String CustomSchematicDirectory; - //Singleton instance private static DDProperties instance = null; //Path for custom dungeons within configuration directory @@ -195,38 +152,6 @@ public class DDProperties DoorRenderEntityID = config.get(CATEGORY_ENTITY, "Door Render Entity ID", 89).getInt(); MonolithEntityID = config.get(CATEGORY_ENTITY, "Monolith Entity ID", 125).getInt(); - DimensionalDoorID = config.getBlock("Dimensional Door Block ID", 1970).getInt(); - TransTrapdoorID = config.getBlock("Transdimensional Trapdoor Block ID", 1971).getInt(); - FabricBlockID =config.getBlock("Fabric Of Reality Block ID", 1973).getInt(); - WarpDoorID = config.getBlock("Warp Door Block ID", 1975).getInt(); - RiftBlockID = config.getBlock("Rift Block ID", 1977).getInt(); - UnstableDoorID = config.getBlock("Unstable Door Block ID", 1978).getInt(); - TransientDoorID = config.getBlock("Transient Door Block ID", 1979).getInt(); - GoldenDoorID = config.getBlock("Gold Door Block ID", 1980).getInt(); - GoldenDimensionalDoorID = config.getBlock("Gold Dim Door Block ID", 1981).getInt(); - QuartzDoorID = config.getBlock("Quartz Door Block ID", 1982).getInt(); - PersonalDimDoorID = config.getBlock("Personal Dim Door ID", 1983).getInt(); - - WarpDoorItemID = config.getItem("Warp Door Item ID", 5670).getInt(); - RiftRemoverItemID = config.getItem("Rift Remover Item ID", 5671).getInt(); - StableFabricItemID = config.getItem("Stable Fabric Item ID", 5672).getInt(); - UnstableDoorItemID = config.getItem("Unstable Door Item ID", 5673).getInt(); - DimensionalDoorItemID = config.getItem("Dimensional Door Item ID", 5674).getInt(); - RiftSignatureItemID = config.getItem("Rift Signature Item ID", 5675).getInt(); - RiftBladeItemID = config.getItem("Rift Blade Item ID", 5676).getInt(); - StabilizedRiftSignatureItemID = config.getItem("Stabilized Rift Signature Item ID", 5677).getInt(); - GoldenDoorItemID = config.getItem("Gold Door Item ID", 5678).getInt(); - GoldenDimensionalDoorItemID = config.getItem("Gold Dim Door Item ID", 5679).getInt(); - WorldThreadItemID = config.getItem("World Thread Item ID", 5680).getInt(); - DDKeyItemID = config.getItem("Rift Key Item ID", 5681).getInt(); - ItemQuartzDoorID = config.getItem("Quartz Door Item ID", 5681).getInt(); - ItemPersonalDimDoorID = config.getItem("Personal Dim Door ID", 5681).getInt(); - - LimboBlockID = config.getTerrainBlock("World Generation Block IDs - must be less than 256", "Limbo Block ID", 217, - "Blocks used for the terrain in Limbo").getInt(); - PermaFabricBlockID = config.getTerrainBlock("World Generation Block IDs - must be less than 256", - "Perma Fabric Block ID", 220, "Blocks used for enclosing pocket dimensions").getInt(); - LimboDimensionID = config.get(CATEGORY_DIMENSION, "Limbo Dimension ID", -23).getInt(); PocketProviderID = config.get(CATEGORY_PROVIDER, "Pocket Provider ID", 124).getInt(); LimboProviderID = config.get(CATEGORY_PROVIDER, "Limbo Provider ID", 113).getInt(); @@ -234,6 +159,9 @@ public class DDProperties MonolithTeleportationEnabled = config.get(Configuration.CATEGORY_GENERAL, "Enable Monolith Teleportation", true, "Sets whether Monoliths can teleport players").getBoolean(true); + + DangerousLimboMonolithsDisabled = config.get(Configuration.CATEGORY_GENERAL, "Docile Monoliths in Limbo", true, + "Sets whether monoliths in Limbo stare at the player rather than attack").getBoolean(true); MonolithSpawningChance = config.get(Configuration.CATEGORY_GENERAL, "Monolith Spawning Chance", 28, "Sets the chance (out of " + CustomLimboPopulator.MAX_MONOLITH_SPAWNING_CHANCE + ") that Monoliths will " + @@ -256,17 +184,9 @@ public class DDProperties "drop World Thread when it destroys a block. The default chance is 50.").getInt(); LimboBiomeID = config.get(CATEGORY_BIOME, "Limbo Biome ID", 148).getInt(); - PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 149).getInt(); + PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 147).getInt(); config.save(); - - // Unfortunately, there are users out there who have been misconfiguring the worldgen blocks to have IDs above 255. - // This leads to disastrous and cryptic errors in other areas of Minecraft. To prevent headaches, we'll throw - // an exception here if the blocks have invalid IDs. - if (LimboBlockID > 255 || PermaFabricBlockID > 255) - { - throw new IllegalStateException("World generation blocks MUST have block IDs less than 256. Fix your configuration!"); - } } public static DDProperties initialize(File configFile) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/config/DDWorldProperties.java b/src/main/java/StevenDimDoors/mod_pocketDim/config/DDWorldProperties.java index b2a4569..be2f642 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/config/DDWorldProperties.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/config/DDWorldProperties.java @@ -1,8 +1,8 @@ package StevenDimDoors.mod_pocketDim.config; -import java.io.File; +import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.Configuration; +import java.io.File; public class DDWorldProperties { diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java b/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java index 3096f35..398c9c7 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java @@ -2,17 +2,22 @@ package StevenDimDoors.mod_pocketDim.core; import java.util.ArrayList; import java.util.Random; + +import StevenDimDoors.mod_pocketDim.world.LimboProvider; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.gameevent.PlayerEvent; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemDoor; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.packet.Packet41EntityEffect; -import net.minecraft.network.packet.Packet43Experience; -import net.minecraft.network.packet.Packet9Respawn; +import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.S1DPacketEntityEffect; +import net.minecraft.network.play.server.S1FPacketSetExperience; import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; @@ -34,748 +39,758 @@ import cpw.mods.fml.common.registry.GameRegistry; public class DDTeleporter { - private static final Random random = new Random(); - private static final int NETHER_DIMENSION_ID = -1; - private static final int OVERWORLD_DIMENSION_ID = 0; - private static final int END_DIMENSION_ID = 1; - private static final int MAX_NETHER_EXIT_CHANCE = 100; - private static final int NETHER_EXIT_CHANCE = 20; //20% chance to compensate for frequent exit failures - the Nether often doesn't have enough space for an exit - private static final int MAX_OVERWORLD_EXIT_CHANCE = 100; - private static final int OVERWORLD_EXIT_CHANCE = 15; - private static final int MAX_ROOT_SHIFT_CHANCE = 100; - private static final int START_ROOT_SHIFT_CHANCE = 0; - private static final int ROOT_SHIFT_CHANCE_PER_LEVEL = 5; - private static final String SPIRIT_WORLD_NAME = "Spirit World"; - - public static int cooldown = 0; - - private DDTeleporter() { } - - /** - * Checks if the destination supplied is safe (i.e. filled by any replaceable or non-opaque blocks) - */ - private static boolean checkDestination(WorldServer world, Point4D destination, int orientation) - { - int x = destination.getX(); - int y = destination.getY(); - int z = destination.getZ(); - int blockIDTop; - int blockIDBottom; - Point3D point; - - switch (orientation) - { - case 0: - point = new Point3D(x - 1, y - 1, z); - break; - case 1: - point = new Point3D(x, y - 1, z - 1); - break; - case 2: - point = new Point3D(x + 1, y - 1, z); - break; - case 3: - point = new Point3D(x, y - 1, z + 1); - break; - default: - point = new Point3D(x, y - 1, z); - break; - } - blockIDBottom = world.getBlockId(point.getX(), point.getY(), point.getZ()); - blockIDTop = world.getBlockId(point.getX(), point.getY() + 1, point.getZ()); - - if (Block.blocksList[blockIDBottom] != null) - { - if (!Block.blocksList[blockIDBottom].isBlockReplaceable(world, point.getX(), point.getY(), point.getZ()) && world.isBlockOpaqueCube(point.getX(), point.getY(), point.getZ())) - { - return false; - } - } - if (Block.blocksList[blockIDTop] != null) - { - if (!Block.blocksList[blockIDTop].isBlockReplaceable(world, point.getX(), point.getY() + 1, point.getZ())) - { - return false; - } - } - return true; - } - - private static void placeInPortal(Entity entity, WorldServer world, Point4D destination, DDProperties properties, boolean checkOrientation) - { - int x = destination.getX(); - int y = destination.getY(); - int z = destination.getZ(); + private static final Random random = new Random(); + private static final int NETHER_DIMENSION_ID = -1; + private static final int OVERWORLD_DIMENSION_ID = 0; + private static final int END_DIMENSION_ID = 1; + private static final int MAX_NETHER_EXIT_CHANCE = 100; + private static final int NETHER_EXIT_CHANCE = 20; //20% chance to compensate for frequent exit failures - the Nether often doesn't have enough space for an exit + private static final int MAX_OVERWORLD_EXIT_CHANCE = 100; + private static final int OVERWORLD_EXIT_CHANCE = 15; + private static final int MAX_ROOT_SHIFT_CHANCE = 100; + private static final int START_ROOT_SHIFT_CHANCE = 0; + private static final int ROOT_SHIFT_CHANCE_PER_LEVEL = 5; + private static final String SPIRIT_WORLD_NAME = "Spirit World"; - int orientation; - if (checkOrientation) - { - orientation = getDestinationOrientation(destination, properties); - entity.rotationYaw = (orientation * 90) + 90; - } - else - { - // Teleport the entity to the precise destination point - orientation = -1; - } - - if (entity instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer) entity; - if (checkDestination(world, destination, orientation)) - { - switch (orientation) - { - case 0: - player.setPositionAndUpdate(x - 0.5, y - 1, z + 0.5); - break; - case 1: - player.setPositionAndUpdate(x + 0.5, y - 1, z - 0.5); - break; - case 2: - player.setPositionAndUpdate(x + 1.5, y - 1, z + 0.5); - break; - case 3: - player.setPositionAndUpdate(x + 0.5, y - 1, z + 1.5); - break; - default: - player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); - break; - } - } - else - { - player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); - } - } - else if (entity instanceof EntityMinecart) - { - entity.motionX = 0; - entity.motionZ = 0; - entity.motionY = 0; - switch (orientation) - { - case 0: - DDTeleporter.setEntityPosition(entity, x - 0.5, y, z + 0.5); - entity.motionX = -0.39; - entity.worldObj.updateEntityWithOptionalForce(entity, false); - break; - case 1: - DDTeleporter.setEntityPosition(entity, x + 0.5, y, z - 0.5); - entity.motionZ = -0.39; - entity.worldObj.updateEntityWithOptionalForce(entity, false); - break; - case 2: - DDTeleporter.setEntityPosition(entity, x + 1.5, y, z + 0.5); - entity.motionX = 0.39; - entity.worldObj.updateEntityWithOptionalForce(entity, false); - break; - case 3: - DDTeleporter.setEntityPosition(entity, x + 0.5, y, z + 1.5); - entity.motionZ = 0.39; - entity.worldObj.updateEntityWithOptionalForce(entity, false); - break; - default: - DDTeleporter.setEntityPosition(entity, x + 0.5, y, z + 0.5); - entity.worldObj.updateEntityWithOptionalForce(entity, false); - break; - } - } - else - { - switch (orientation) - { - case 0: - setEntityPosition(entity, x - 0.5, y, z + 0.5); - break; - case 1: - setEntityPosition(entity, x + 0.5, y, z - 0.5); - break; - case 2: - setEntityPosition(entity, x + 1.5, y, z + 0.5); - break; - case 3: - setEntityPosition(entity, x + 0.5, y, z + 1.5); - break; - default: - setEntityPosition(entity, x + 0.5, y, z + 0.5); - break; - } - } - } + public static int cooldown = 0; - private static void setEntityPosition(Entity entity, double x, double y, double z) - { - entity.lastTickPosX = entity.prevPosX = entity.posX = x; - entity.lastTickPosY = entity.prevPosY = entity.posY = y + entity.yOffset; - entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z; - entity.setPosition(x, y, z); - } - - private static int getDestinationOrientation(Point4D door, DDProperties properties) - { - World world = DimensionManager.getWorld(door.getDimension()); - if (world == null) - { - throw new IllegalStateException("The destination world should be loaded!"); - } - - //Check if the block below that point is actually a door - Block block = Block.blocksList[world.getBlockId(door.getX(), door.getY() - 1, door.getZ())]; - if (block==null || !(block instanceof IDimDoor)) - { - //Return the pocket's orientation instead - return PocketManager.createDimensionData(world).orientation(); - } - - - //Return the orientation portion of its metadata - return world.getBlockMetadata(door.getX(), door.getY() - 1, door.getZ()) & 3; - } - - public static Entity teleportEntity(Entity entity, Point4D destination, boolean checkOrientation) - { - if (entity == null) - { - throw new IllegalArgumentException("entity cannot be null."); - } - if (destination == null) - { - throw new IllegalArgumentException("destination cannot be null."); - } - //This beautiful teleport method is based off of xCompWiz's teleport function. + private DDTeleporter() { } - WorldServer oldWorld = (WorldServer) entity.worldObj; - WorldServer newWorld; - EntityPlayerMP player = (entity instanceof EntityPlayerMP) ? (EntityPlayerMP) entity : null; - DDProperties properties = DDProperties.instance(); + /** + * Checks if the destination supplied is safe (i.e. filled by any replaceable or non-opaque blocks) + */ + private static boolean checkDestination(WorldServer world, Point4D destination, int orientation) + { + int x = destination.getX(); + int y = destination.getY(); + int z = destination.getZ(); + Block blockTop; + Block blockBottom; + Point3D point; - // Is something riding? Handle it first. - if (entity.riddenByEntity != null) - { - return teleportEntity(entity.riddenByEntity, destination, checkOrientation); - } + switch (orientation) + { + case 0: + point = new Point3D(x - 1, y - 1, z); + break; + case 1: + point = new Point3D(x, y - 1, z - 1); + break; + case 2: + point = new Point3D(x + 1, y - 1, z); + break; + case 3: + point = new Point3D(x, y - 1, z + 1); + break; + default: + point = new Point3D(x, y - 1, z); + break; + } + blockBottom = world.getBlock(point.getX(), point.getY(), point.getZ()); + blockTop = world.getBlock(point.getX(), point.getY() + 1, point.getZ()); - // Are we riding something? Dismount and tell the mount to go first. - Entity cart = entity.ridingEntity; - if (cart != null) - { - entity.mountEntity(null); - cart = teleportEntity(cart, destination, checkOrientation); - // We keep track of both so we can remount them on the other side. - } + if (blockBottom != null) + { + if (!blockBottom.isReplaceable(world, point.getX(), point.getY(), point.getZ()) && world.isBlockNormalCubeDefault(point.getX(), point.getY(), point.getZ(), false)) + { + return false; + } + } + if (blockTop != null) + { + if (!blockTop.isReplaceable(world, point.getX(), point.getY() + 1, point.getZ())) + { + return false; + } + } + return true; + } - // Determine if our destination is in another realm. - boolean difDest = entity.dimension != destination.getDimension(); - if (difDest) - { - // Destination isn't loaded? Then we need to load it. - newWorld = PocketManager.loadDimension(destination.getDimension()); - } - else - { - newWorld = oldWorld; - } - + private static void placeInPortal(Entity entity, WorldServer world, Point4D destination, DDProperties properties, boolean checkOrientation) + { + int x = destination.getX(); + int y = destination.getY(); + int z = destination.getZ(); - // GreyMaria: What is this even accomplishing? We're doing the exact same thing at the end of this all. - // TODO Check to see if this is actually vital. - DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation); + int orientation; + if (checkOrientation) + { + orientation = getDestinationOrientation(destination, properties); + entity.rotationYaw = (orientation * 90) + 90; + } + else + { + // Teleport the entity to the precise destination point + orientation = -1; + } - if (difDest) // Are we moving our target to a new dimension? - { - if(player != null) // Are we working with a player? - { - // We need to do all this special stuff to move a player between dimensions. - //Give the client the dimensionData for the destination - - // FIXME: This violates the way we assume PocketManager works. DimWatcher should not be exposed - // to prevent us from doing bad things. Moreover, no dimension is being created, so if we ever - // tie code to that, it could cause confusing bugs. - // No hacky for you! ~SenseiKiwi - PocketManager.getDimwatcher().onCreated(new ClientDimData(PocketManager.createDimensionData(newWorld))); - - // Set the new dimension and inform the client that it's moving to a new world. - player.dimension = destination.getDimension(); - player.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(player.dimension, (byte)player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), newWorld.getHeight(), player.theItemInWorldManager.getGameType())); + if (entity instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) entity; + if (checkDestination(world, destination, orientation)) + { + switch (orientation) + { + case 0: + player.setPositionAndUpdate(x - 0.5, y - 1, z + 0.5); + break; + case 1: + player.setPositionAndUpdate(x + 0.5, y - 1, z - 0.5); + break; + case 2: + player.setPositionAndUpdate(x + 1.5, y - 1, z + 0.5); + break; + case 3: + player.setPositionAndUpdate(x + 0.5, y - 1, z + 1.5); + break; + default: + player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); + break; + } + } + else + { + player.setPositionAndUpdate(x + 0.5, y - 1, z + 0.5); + } + } + else if (entity instanceof EntityMinecart) + { + entity.motionX = 0; + entity.motionZ = 0; + entity.motionY = 0; + switch (orientation) + { + case 0: + DDTeleporter.setEntityPosition(entity, x - 0.5, y, z + 0.5); + entity.motionX = -0.39; + entity.worldObj.updateEntityWithOptionalForce(entity, false); + break; + case 1: + DDTeleporter.setEntityPosition(entity, x + 0.5, y, z - 0.5); + entity.motionZ = -0.39; + entity.worldObj.updateEntityWithOptionalForce(entity, false); + break; + case 2: + DDTeleporter.setEntityPosition(entity, x + 1.5, y, z + 0.5); + entity.motionX = 0.39; + entity.worldObj.updateEntityWithOptionalForce(entity, false); + break; + case 3: + DDTeleporter.setEntityPosition(entity, x + 0.5, y, z + 1.5); + entity.motionZ = 0.39; + entity.worldObj.updateEntityWithOptionalForce(entity, false); + break; + default: + DDTeleporter.setEntityPosition(entity, x + 0.5, y, z + 0.5); + entity.worldObj.updateEntityWithOptionalForce(entity, false); + break; + } + } + else + { + switch (orientation) + { + case 0: + setEntityPosition(entity, x - 0.5, y, z + 0.5); + break; + case 1: + setEntityPosition(entity, x + 0.5, y, z - 0.5); + break; + case 2: + setEntityPosition(entity, x + 1.5, y, z + 0.5); + break; + case 3: + setEntityPosition(entity, x + 0.5, y, z + 1.5); + break; + default: + setEntityPosition(entity, x + 0.5, y, z + 0.5); + break; + } + } + } - // GreyMaria: Used the safe player entity remover before. - // This should fix an apparently unreported bug where - // the last non-sleeping player leaves the Overworld - // for a pocket dimension, causing all sleeping players - // to remain asleep instead of progressing to day. - ((WorldServer)entity.worldObj).getPlayerManager().removePlayer(player); - oldWorld.removePlayerEntityDangerously(player); - player.isDead = false; + private static void setEntityPosition(Entity entity, double x, double y, double z) + { + entity.lastTickPosX = entity.prevPosX = entity.posX = x; + entity.lastTickPosY = entity.prevPosY = entity.posY = y + entity.yOffset; + entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z; + entity.setPosition(x, y, z); + } - // Creates sanity by ensuring that we're only known to exist where we're supposed to be known to exist. - oldWorld.getPlayerManager().removePlayer(player); - newWorld.getPlayerManager().addPlayer(player); + private static int getDestinationOrientation(Point4D door, DDProperties properties) + { + World world = DimensionManager.getWorld(door.getDimension()); + if (world == null) + { + throw new IllegalStateException("The destination world should be loaded!"); + } - player.theItemInWorldManager.setWorld(newWorld); + //Check if the block below that point is actually a door + Block block = world.getBlock(door.getX(), door.getY() - 1, door.getZ()); + if (block==null || !(block instanceof IDimDoor)) + { + //Return the pocket's orientation instead + return PocketManager.createDimensionData(world).orientation(); + } - // Synchronize with the server so the client knows what time it is and what it's holding. - player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, newWorld); - player.mcServer.getConfigurationManager().syncPlayerInventory(player); - for(Object potionEffect : player.getActivePotionEffects()) - { - PotionEffect effect = (PotionEffect)potionEffect; - player.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(player.entityId, effect)); - } - player.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(player.experience, player.experienceTotal, player.experienceLevel)); - } + //Return the orientation portion of its metadata + return world.getBlockMetadata(door.getX(), door.getY() - 1, door.getZ()) & 3; + } - // Creates sanity by removing the entity from its old location's chunk entity list, if applicable. - int entX = entity.chunkCoordX; - int entZ = entity.chunkCoordZ; - if ((entity.addedToChunk) && (oldWorld.getChunkProvider().chunkExists(entX, entZ))) - { - oldWorld.getChunkFromChunkCoords(entX, entZ).removeEntity(entity); - oldWorld.getChunkFromChunkCoords(entX, entZ).isModified = true; - } - // Memory concerns. - oldWorld.onEntityRemoved(entity); + public static Entity teleportEntity(Entity entity, Point4D destination, boolean checkOrientation) + { + if (entity == null) + { + throw new IllegalArgumentException("entity cannot be null."); + } + if (destination == null) + { + throw new IllegalArgumentException("destination cannot be null."); + } + //This beautiful teleport method is based off of xCompWiz's teleport function. - if (player == null) // Are we NOT working with a player? - { - NBTTagCompound entityNBT = new NBTTagCompound(); - entity.isDead = false; - entity.writeMountToNBT(entityNBT); - if(entityNBT.hasNoTags()) - { - return entity; - } - entity.isDead = true; - entity = EntityList.createEntityFromNBT(entityNBT, newWorld); + WorldServer oldWorld = (WorldServer) entity.worldObj; + WorldServer newWorld; + EntityPlayerMP player = (entity instanceof EntityPlayerMP) ? (EntityPlayerMP) entity : null; + DDProperties properties = DDProperties.instance(); - if (entity == null) - { - // TODO FIXME IMPLEMENT NULL CHECKS THAT ACTUALLY DO SOMETHING. + // Is something riding? Handle it first. + if (entity.riddenByEntity != null) + { + return teleportEntity(entity.riddenByEntity, destination, checkOrientation); + } + + // Are we riding something? Dismount and tell the mount to go first. + Entity cart = entity.ridingEntity; + if (cart != null) + { + entity.mountEntity(null); + cart = teleportEntity(cart, destination, checkOrientation); + // We keep track of both so we can remount them on the other side. + } + + // Determine if our destination is in another realm. + boolean difDest = entity.dimension != destination.getDimension(); + if (difDest) + { + // Destination isn't loaded? Then we need to load it. + newWorld = PocketManager.loadDimension(destination.getDimension()); + } + else + { + newWorld = oldWorld; + } + + + // GreyMaria: What is this even accomplishing? We're doing the exact same thing at the end of this all. + // TODO Check to see if this is actually vital. + DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation); + + if (difDest) // Are we moving our target to a new dimension? + { + if(player != null) // Are we working with a player? + { + // We need to do all this special stuff to move a player between dimensions. + //Give the client the dimensionData for the destination + + // FIXME: This violates the way we assume PocketManager works. DimWatcher should not be exposed + // to prevent us from doing bad things. Moreover, no dimension is being created, so if we ever + // tie code to that, it could cause confusing bugs. + // No hacky for you! ~SenseiKiwi + PocketManager.getDimwatcher().onCreated(new ClientDimData(PocketManager.createDimensionData(newWorld))); + + // Set the new dimension and inform the client that it's moving to a new world. + player.dimension = destination.getDimension(); + player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType())); + + // GreyMaria: Used the safe player entity remover before. + // This should fix an apparently unreported bug where + // the last non-sleeping player leaves the Overworld + // for a pocket dimension, causing all sleeping players + // to remain asleep instead of progressing to day. + ((WorldServer)entity.worldObj).getPlayerManager().removePlayer(player); + oldWorld.removePlayerEntityDangerously(player); + player.isDead = false; + + // Creates sanity by ensuring that we're only known to exist where we're supposed to be known to exist. + oldWorld.getPlayerManager().removePlayer(player); + newWorld.getPlayerManager().addPlayer(player); + + player.theItemInWorldManager.setWorld(newWorld); + + // Synchronize with the server so the client knows what time it is and what it's holding. + player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, newWorld); + player.mcServer.getConfigurationManager().syncPlayerInventory(player); + for(Object potionEffect : player.getActivePotionEffects()) + { + PotionEffect effect = (PotionEffect)potionEffect; + player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), effect)); + } + + player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); + } + + // Creates sanity by removing the entity from its old location's chunk entity list, if applicable. + int entX = entity.chunkCoordX; + int entZ = entity.chunkCoordZ; + if ((entity.addedToChunk) && (oldWorld.getChunkProvider().chunkExists(entX, entZ))) + { + oldWorld.getChunkFromChunkCoords(entX, entZ).removeEntity(entity); + oldWorld.getChunkFromChunkCoords(entX, entZ).isModified = true; + } + // Memory concerns. + oldWorld.onEntityRemoved(entity); + + if (player == null) // Are we NOT working with a player? + { + NBTTagCompound entityNBT = new NBTTagCompound(); + entity.isDead = false; + entity.writeMountToNBT(entityNBT); + if(entityNBT.hasNoTags()) + { + return entity; + } + entity.isDead = true; + entity = EntityList.createEntityFromNBT(entityNBT, newWorld); + + if (entity == null) + { + // TODO FIXME IMPLEMENT NULL CHECKS THAT ACTUALLY DO SOMETHING. /* * shit ourselves in an organized fashion, preferably * in a neat pile instead of all over our users' games */ - } + } - } + } - // Finally, respawn the entity in its new home. - newWorld.spawnEntityInWorld(entity); - entity.setWorld(newWorld); - } - entity.worldObj.updateEntityWithOptionalForce(entity, false); + // Finally, respawn the entity in its new home. + newWorld.spawnEntityInWorld(entity); + entity.setWorld(newWorld); + } + entity.worldObj.updateEntityWithOptionalForce(entity, false); - // Hey, remember me? It's time to remount. - if (cart != null) - { - // Was there a player teleported? If there was, it's important that we update shit. - if (player != null) - { - entity.worldObj.updateEntityWithOptionalForce(entity, true); - } - entity.mountEntity(cart); - } + // Hey, remember me? It's time to remount. + if (cart != null) + { + // Was there a player teleported? If there was, it's important that we update shit. + if (player != null) + { + entity.worldObj.updateEntityWithOptionalForce(entity, true); + } + entity.mountEntity(cart); + } - // Did we teleport a player? Load the chunk for them. - if (player != null) - { - newWorld.getChunkProvider().loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4); - // Tell Forge we're moving its players so everyone else knows. - // Let's try doing this down here in case this is what's killing NEI. - GameRegistry.onPlayerChangedDimension((EntityPlayer)entity); - } - DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation); - return entity; - } + // Did we teleport a player? Load the chunk for them. + if (player != null) + { + newWorld.getChunkProvider().loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4); + // Tell Forge we're moving its players so everyone else knows. + // Let's try doing this down here in case this is what's killing NEI. + FMLCommonHandler.instance().firePlayerChangedDimensionEvent((EntityPlayer) entity, oldWorld.provider.dimensionId, newWorld.provider.dimensionId); + } + DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation); + return entity; + } - /** - * Primary function used to teleport the player using doors. Performs numerous null checks, and also generates the destination door/pocket if it has not done so already. - * Also ensures correct orientation relative to the door. - * @param world - world the player is currently in - * @param link - the link the player is using to teleport; sends the player to its destination - * @param player - the instance of the player to be teleported - */ - public static void traverseDimDoor(World world, DimLink link, Entity entity, Block door) - { - if (world == null) - { - throw new IllegalArgumentException("world cannot be null."); - } - if (link == null) - { - throw new IllegalArgumentException("link cannot be null."); - } - if (entity == null) - { - throw new IllegalArgumentException("entity cannot be null."); - } - if (world.isRemote) - { - return; - } - - if (cooldown == 0 || entity instanceof EntityPlayer) - { - // According to Steven, we increase the cooldown by a random amount so that if someone - // makes a loop with doors and throws items in them, the slamming sounds won't all - // sync up and be very loud. The cooldown itself prevents server-crashing madness. - cooldown = 2 + random.nextInt(2); - } - else - { - return; - } + /** + * Primary function used to teleport the player using doors. Performs numerous null checks, and also generates the destination door/pocket if it has not done so already. + * Also ensures correct orientation relative to the door. + * @param world - world the player is currently in + * @param link - the link the player is using to teleport; sends the player to its destination + * @param entity - the instance of the player to be teleported + */ + public static void traverseDimDoor(World world, DimLink link, Entity entity, Block door) + { + if (world == null) + { + throw new IllegalArgumentException("world cannot be null."); + } + if (link == null) + { + throw new IllegalArgumentException("link cannot be null."); + } + if (entity == null) + { + throw new IllegalArgumentException("entity cannot be null."); + } + if (world.isRemote) + { + return; + } - if (!initializeDestination(link, DDProperties.instance(),entity,door)) - { - return; - } - if (link.linkType() == LinkType.RANDOM) - { - Point4D randomDestination = getRandomDestination(); - if (randomDestination != null) - { - entity = teleportEntity(entity, randomDestination, true); - entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F); - } - } - else - { - buildExitDoor(door, link, DDProperties.instance()); - entity = teleportEntity(entity, link.destination(), link.linkType() != LinkType.UNSAFE_EXIT); - entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F); - } - } + if (cooldown == 0 || entity instanceof EntityPlayer) + { + // According to Steven, we increase the cooldown by a random amount so that if someone + // makes a loop with doors and throws items in them, the slamming sounds won't all + // sync up and be very loud. The cooldown itself prevents server-crashing madness. + cooldown = 2 + random.nextInt(2); + } + else + { + return; + } - private static boolean initializeDestination(DimLink link, DDProperties properties, Entity entity, Block door) - { - if (link.hasDestination()&&link.linkType()!=LinkType.PERSONAL) - { - if (PocketManager.isBlackListed(link.destination().getDimension())) - { + if (!initializeDestination(link, DDProperties.instance(),entity,door)) + { + return; + } + if (link.linkType() == LinkType.RANDOM) + { + Point4D randomDestination = getRandomDestination(); + if (randomDestination != null) + { + entity = teleportEntity(entity, randomDestination, true); + entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F); + } + } + else + { + buildExitDoor(door, link, DDProperties.instance()); + entity = teleportEntity(entity, link.destination(), link.linkType() != LinkType.UNSAFE_EXIT); + entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F); + } + } - // This link leads to a dimension that has been blacklisted. - // That means that it was a pocket and it was deleted. - // Depending on the link type, we must overwrite it or cancel - // the teleport operation. We don't need to assign 'link' with - // a different value. NewDimData will overwrite it in-place. - NewDimData start = PocketManager.getDimensionData(link.source().getDimension()); - if (link.linkType() == LinkType.DUNGEON) - { - // Ovewrite the link into a dungeon link with no destination - start.createLink(link.source(), LinkType.DUNGEON, link.orientation(), null); - } - else - { - if (start.isPocketDimension()) - { - // Ovewrite the link into a safe exit link, because - // this could be the only way out from a pocket. - start.createLink(link.source(), LinkType.SAFE_EXIT, link.orientation(), null); - } - else - { - // Cancel the teleport attempt - return false; - } - } - } - else - { - return true; - } - } + private static boolean initializeDestination(DimLink link, DDProperties properties, Entity entity, Block door) + { + if (link.hasDestination()&&link.linkType()!=LinkType.PERSONAL) + { + if (PocketManager.isBlackListed(link.destination().getDimension())) + { - // Check the destination type and respond accordingly - switch (link.linkType()) - { - case DUNGEON: - return PocketBuilder.generateNewDungeonPocket(link, properties); - case POCKET: - return PocketBuilder.generateNewPocket(link, properties, door, DimensionType.POCKET); - case PERSONAL: - return setupPersonalLink(link, properties, entity, door); - case SAFE_EXIT: - return generateSafeExit(link, properties); - case DUNGEON_EXIT: - return generateDungeonExit(link, properties); - case UNSAFE_EXIT: - return generateUnsafeExit(link); - case NORMAL: - case REVERSE: - case RANDOM: - return true; - default: - throw new IllegalArgumentException("link has an unrecognized link type."); - } - } - - private static boolean setupPersonalLink(DimLink link, DDProperties properties,Entity player, Block door) - { - if(!(player instanceof EntityPlayer)) - { - return false; - } - - NewDimData dim = PocketManager.getPersonalDimensionForPlayer(player.getEntityName()); - if(dim == null) - { - return PocketBuilder.generateNewPersonalPocket(link, properties, player, door); - } - - DimLink personalHomeLink = dim.getLink(dim.origin()); - if(personalHomeLink!=null) - { - PocketManager.getDimensionData(link.source().getDimension()).setLinkDestination(personalHomeLink, link.source().getX(), link.source().getY(), link.source().getZ()); - } - - dim.setLinkDestination(link, dim.origin.getX(), dim.origin.getY(), dim.origin.getZ()); - return true; - } + // This link leads to a dimension that has been blacklisted. + // That means that it was a pocket and it was deleted. + // Depending on the link type, we must overwrite it or cancel + // the teleport operation. We don't need to assign 'link' with + // a different value. NewDimData will overwrite it in-place. + NewDimData start = PocketManager.getDimensionData(link.source().getDimension()); + if (link.linkType() == LinkType.DUNGEON) + { + // Ovewrite the link into a dungeon link with no destination + start.createLink(link.source(), LinkType.DUNGEON, link.orientation(), null); + } + else + { + if (start.isPocketDimension()) + { + // Ovewrite the link into a safe exit link, because + // this could be the only way out from a pocket. + start.createLink(link.source(), LinkType.SAFE_EXIT, link.orientation(), null); + } + else + { + // Cancel the teleport attempt + return false; + } + } + } + else + { + return true; + } + } - private static Point4D getRandomDestination() - { - // Our aim is to return a random link's source point - // so that a link of type RANDOM can teleport a player there. - - // Restrictions: - // 1. Ignore links with their source inside a pocket dimension. - // 2. Ignore links with link type RANDOM. - - // Iterate over the root dimensions. Pocket dimensions cannot be roots. - // Don't just pick a random root and a random link within that root - // because we want to have unbiased selection among all links. - ArrayList matches = new ArrayList(); - for (NewDimData dimension : PocketManager.getRootDimensions()) - { - for (DimLink link : dimension.getAllLinks()) - { - if (link.linkType() != LinkType.RANDOM) - { - matches.add(link.source()); - } - } - } - - // Pick a random point, if any is available - if (!matches.isEmpty()) - { - return matches.get( random.nextInt(matches.size()) ); - } - return null; - } - - private static boolean generateUnsafeExit(DimLink link) - { - // An unsafe exit teleports the user to the first available air space - // in the pocket's root dimension. X and Z are kept roughly the same - // as the source location, but Y is set by searching down. We don't - // place a platform at the destination. We also don't place a reverse - // link at the destination, so it's a one-way trip. Good luck! - - // To avoid loops, don't generate a destination if the player is - // already in a non-pocket dimension. - - NewDimData current = PocketManager.getDimensionData(link.point.getDimension()); + // Check the destination type and respond accordingly + switch (link.linkType()) + { + case DUNGEON: + return PocketBuilder.generateNewDungeonPocket(link, properties); + case POCKET: + return PocketBuilder.generateNewPocket(link, properties, door, DimensionType.POCKET); + case PERSONAL: + return setupPersonalLink(link, properties, entity, door); + case SAFE_EXIT: + return generateSafeExit(link, properties); + case DUNGEON_EXIT: + return generateDungeonExit(link, properties); + case UNSAFE_EXIT: + return generateUnsafeExit(link); + case LIMBO: + if(!(entity instanceof EntityPlayer)) + { + return false; + } - if (current.isPocketDimension()) - { - Point4D source = link.source(); - World world = PocketManager.loadDimension(current.root().id()); - if (world == null) - { - return false; - } - - Point3D destination = yCoordHelper.findDropPoint(world, source.getX(), source.getY() + 1, source.getZ()); - if (destination != null) - { - current.root().setLinkDestination(link, destination.getX(), destination.getY(), destination.getZ()); - return true; - } - } - return false; - } + Point4D dest = LimboProvider.getLimboSkySpawn((EntityPlayer)entity, DDProperties.instance()); + link.tail.setDestination(dest); + return true; + case NORMAL: + case REVERSE: + case RANDOM: + return true; + default: + throw new IllegalArgumentException("link has an unrecognized link type."); + } + } - private static void buildExitDoor(Block door,DimLink link, DDProperties prop) - { - 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.point.getZ()); - if(doorTE instanceof TileEntityDimDoor) - { - if((TileEntityDimDoor.class.cast(doorTE).hasGennedPair)) - { - return; - } - TileEntityDimDoor.class.cast(doorTE).hasGennedPair=true; - Block blockToReplace = Block.blocksList[destWorld.getBlockId(link.destination().getX(), link.destination().getY(), link.destination().getZ())]; - - if(!destWorld.isAirBlock(link.destination().getX(), link.destination().getY(), link.destination().getZ())) - { - if(!blockToReplace.isBlockReplaceable(destWorld, link.destination().getX(), link.destination().getY(), link.destination().getZ())) - { - return; - } - } - - ItemDoor.placeDoorBlock(destWorld, link.destination().getX(), link.destination().getY()-1, link.destination().getZ(),link.getDestinationOrientation(), door); + private static boolean setupPersonalLink(DimLink link, DDProperties properties,Entity entity, Block door) + { + if(!(entity instanceof EntityPlayer)) + { + return false; + } - TileEntity doorDestTE = ((BaseDimDoor)door).initDoorTE(destWorld, link.destination().getX(), link.destination().getY(), link.destination().getZ()); + EntityPlayer player = (EntityPlayer)entity; + NewDimData dim = PocketManager.getPersonalDimensionForPlayer(player.getGameProfile().getId().toString()); + if(dim == null) + { + return PocketBuilder.generateNewPersonalPocket(link, properties, player, door); + } - - if(doorDestTE instanceof TileEntityDimDoor) - { - TileEntityDimDoor.class.cast(doorDestTE).hasGennedPair=true; - - } - } - } - - private static boolean generateSafeExit(DimLink link, DDProperties properties) - { - NewDimData current = PocketManager.getDimensionData(link.point.getDimension()); - return generateSafeExit(current.root(), link, properties); - } - - private static boolean generateDungeonExit(DimLink link, DDProperties properties) - { - // 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. - // There is a chance of choosing the Nether first before other root dimensions - // to compensate for servers with many Mystcraft ages or other worlds. - - NewDimData current = PocketManager.getDimensionData(link.point.getDimension()); + DimLink personalHomeLink = dim.getLink(dim.origin()); + if(personalHomeLink!=null) + { + link.tail.setDestination(personalHomeLink.source()); + PocketManager.getDimensionData(link.source().getDimension()).setLinkDestination(personalHomeLink, link.source().getX(), link.source().getY(), link.source().getZ()); + } - ArrayList roots = PocketManager.getRootDimensions(); - int shiftChance = START_ROOT_SHIFT_CHANCE + ROOT_SHIFT_CHANCE_PER_LEVEL * (current.packDepth() - 1); + return true; + } - if (random.nextInt(MAX_ROOT_SHIFT_CHANCE) < shiftChance) - { - if (current.root().id() != OVERWORLD_DIMENSION_ID && random.nextInt(MAX_OVERWORLD_EXIT_CHANCE) < OVERWORLD_EXIT_CHANCE) - { - return generateSafeExit(PocketManager.createDimensionDataDangerously(OVERWORLD_DIMENSION_ID), link, properties); - } - if (current.root().id() != NETHER_DIMENSION_ID && random.nextInt(MAX_NETHER_EXIT_CHANCE) < NETHER_EXIT_CHANCE) - { - return generateSafeExit(PocketManager.createDimensionDataDangerously(NETHER_DIMENSION_ID), link, properties); - } - for (int attempts = 0; attempts < 10; attempts++) - { - NewDimData selection = roots.get( random.nextInt(roots.size()) ); - if (selection != current.root() && isValidForDungeonExit(selection, properties)) - { - return generateSafeExit(selection, link, properties); - } - } - } - - // Yes, this could lead you back into Limbo. That's intentional. - return generateSafeExit(current.root(), link, properties); - } - - private static boolean isValidForDungeonExit(NewDimData destination, DDProperties properties) - { - // Prevent exits to The End and Limbo - if (destination.id() == END_DIMENSION_ID || destination.id() == properties.LimboDimensionID) - { - return false; - } - // Prevent exits to Witchery's Spirit World; we need to load the dimension to retrieve its name. - // This is okay because the dimension would have to be loaded subsequently by generateSafeExit(). - World world = PocketManager.loadDimension(destination.id()); - return (world != null && !SPIRIT_WORLD_NAME.equals(world.provider.getDimensionName())); - } - - private static boolean generateSafeExit(NewDimData destinationDim, DimLink link, DDProperties properties) - { - // A safe exit attempts to place a Warp Door in a dimension with - // some precautions to protect the player. The X and Z coordinates - // are fixed to match the source (mostly - may be shifted a little), - // but the Y coordinate is chosen by searching for the nearest - // a safe location to place the door. - - Point4D source = link.source(); - World world = PocketManager.loadDimension(destinationDim.id()); - if (world == null) - { - return false; - } - - int startY = source.getY() - 2; - Point3D destination; - Point3D locationUp = yCoordHelper.findSafeCubeUp(world, source.getX(), startY, source.getZ()); - Point3D locationDown = yCoordHelper.findSafeCubeDown(world, source.getX(), startY, source.getZ()); - - if (locationUp == null) - { - destination = locationDown; - } - else if (locationDown == null) - { - destination = locationUp; - } - else if (locationUp.getY() - startY <= startY - locationDown.getY()) - { - destination = locationUp; - } - else - { - destination = locationDown; - } - if (destination != null) - { - // Set up a 3x3 platform at the destination - // Only place fabric of reality if the block is replaceable or air - // Don't cause block updates - int x = destination.getX(); - int y = destination.getY(); - int z = destination.getZ(); - for (int dx = -1; dx <= 1; dx++) - { - for (int dz = -1; dz <= 1; dz++) - { - // Checking if the block is not an opaque solid is equivalent - // checking for a replaceable block, because we only allow - // exits intersecting blocks on those two surfaces. - if (!world.isBlockNormalCube(x + dx, y, z + dz)) - { - world.setBlock(x + dx, y, z + dz, properties.FabricBlockID, 0, 2); - } - } - } - - // Clear out any blocks in the space above the platform layer - // This removes any potential threats like replaceable Poison Ivy from BoP - // Remember to avoid block updates to keep gravel from collapsing - for (int dy = 1; dy <= 2; dy++) - { - for (int dx = -1; dx <= 1; dx++) - { - for (int dz = -1; dz <= 1; dz++) - { - world.setBlock(x + dx, y + dy, z + dz, 0, 0, 2); - } - } - } - - // Create a reverse link for returning - int orientation = getDestinationOrientation(source, properties); - NewDimData sourceDim = PocketManager.getDimensionData(link.source().getDimension()); - DimLink reverse = destinationDim.createLink(x, y + 2, z, LinkType.REVERSE,orientation); + private static Point4D getRandomDestination() + { + // Our aim is to return a random link's source point + // so that a link of type RANDOM can teleport a player there. - sourceDim.setLinkDestination(reverse, source.getX(), source.getY(), source.getZ()); - - // Set up the warp door at the destination - orientation = BlockRotator.transformMetadata(orientation, 2, properties.WarpDoorID); - ItemDoor.placeDoorBlock(world, x, y + 1, z, orientation, mod_pocketDim.warpDoor); - - // Complete the link to the destination - // This comes last so the destination isn't set unless everything else works first - destinationDim.setLinkDestination(link, x, y + 2, z); - } - - return (destination != null); - } + // Restrictions: + // 1. Ignore links with their source inside a pocket dimension. + // 2. Ignore links with link type RANDOM. + + // Iterate over the root dimensions. Pocket dimensions cannot be roots. + // Don't just pick a random root and a random link within that root + // because we want to have unbiased selection among all links. + ArrayList matches = new ArrayList(); + for (NewDimData dimension : PocketManager.getRootDimensions()) + { + for (DimLink link : dimension.getAllLinks()) + { + if (link.linkType() != LinkType.RANDOM) + { + matches.add(link.source()); + } + } + } + + // Pick a random point, if any is available + if (!matches.isEmpty()) + { + return matches.get( random.nextInt(matches.size()) ); + } + return null; + } + + private static boolean generateUnsafeExit(DimLink link) + { + // An unsafe exit teleports the user to the first available air space + // in the pocket's root dimension. X and Z are kept roughly the same + // as the source location, but Y is set by searching down. We don't + // place a platform at the destination. We also don't place a reverse + // link at the destination, so it's a one-way trip. Good luck! + + // To avoid loops, don't generate a destination if the player is + // already in a non-pocket dimension. + + NewDimData current = PocketManager.getDimensionData(link.point.getDimension()); + + if (current.isPocketDimension()) + { + Point4D source = link.source(); + World world = PocketManager.loadDimension(current.root().id()); + if (world == null) + { + return false; + } + + Point3D destination = yCoordHelper.findDropPoint(world, source.getX(), source.getY() + 1, source.getZ()); + if (destination != null) + { + current.root().setLinkDestination(link, destination.getX(), destination.getY(), destination.getZ()); + return true; + } + } + return false; + } + + private static void buildExitDoor(Block door,DimLink link, DDProperties prop) + { + World startWorld = PocketManager.loadDimension(link.source().getDimension()); + World destWorld = PocketManager.loadDimension(link.destination().getDimension()); + TileEntity doorTE = startWorld.getTileEntity(link.source().getX(), link.source().getY(), link.point.getZ()); + if(doorTE instanceof TileEntityDimDoor) + { + if((TileEntityDimDoor.class.cast(doorTE).hasGennedPair)) + { + return; + } + TileEntityDimDoor.class.cast(doorTE).hasGennedPair=true; + Block blockToReplace = destWorld.getBlock(link.destination().getX(), link.destination().getY(), link.destination().getZ()); + + if(!destWorld.isAirBlock(link.destination().getX(), link.destination().getY(), link.destination().getZ())) + { + if(!blockToReplace.isReplaceable(destWorld, link.destination().getX(), link.destination().getY(), link.destination().getZ())) + { + return; + } + } + + ItemDoor.placeDoorBlock(destWorld, link.destination().getX(), link.destination().getY()-1, link.destination().getZ(),link.getDestinationOrientation(), door); + + TileEntity doorDestTE = ((BaseDimDoor)door).initDoorTE(destWorld, link.destination().getX(), link.destination().getY(), link.destination().getZ()); + + + if(doorDestTE instanceof TileEntityDimDoor) + { + TileEntityDimDoor.class.cast(doorDestTE).hasGennedPair=true; + + } + } + } + + private static boolean generateSafeExit(DimLink link, DDProperties properties) + { + NewDimData current = PocketManager.getDimensionData(link.point.getDimension()); + return generateSafeExit(current.root(), link, properties); + } + + private static boolean generateDungeonExit(DimLink link, DDProperties properties) + { + // 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. + // There is a chance of choosing the Nether first before other root dimensions + // to compensate for servers with many Mystcraft ages or other worlds. + + NewDimData current = PocketManager.getDimensionData(link.point.getDimension()); + + ArrayList roots = PocketManager.getRootDimensions(); + int shiftChance = START_ROOT_SHIFT_CHANCE + ROOT_SHIFT_CHANCE_PER_LEVEL * (current.packDepth() - 1); + + if (random.nextInt(MAX_ROOT_SHIFT_CHANCE) < shiftChance) + { + if (current.root().id() != OVERWORLD_DIMENSION_ID && random.nextInt(MAX_OVERWORLD_EXIT_CHANCE) < OVERWORLD_EXIT_CHANCE) + { + return generateSafeExit(PocketManager.createDimensionDataDangerously(OVERWORLD_DIMENSION_ID), link, properties); + } + if (current.root().id() != NETHER_DIMENSION_ID && random.nextInt(MAX_NETHER_EXIT_CHANCE) < NETHER_EXIT_CHANCE) + { + return generateSafeExit(PocketManager.createDimensionDataDangerously(NETHER_DIMENSION_ID), link, properties); + } + for (int attempts = 0; attempts < 10; attempts++) + { + NewDimData selection = roots.get( random.nextInt(roots.size()) ); + if (selection != current.root() && isValidForDungeonExit(selection, properties)) + { + return generateSafeExit(selection, link, properties); + } + } + } + + // Yes, this could lead you back into Limbo. That's intentional. + return generateSafeExit(current.root(), link, properties); + } + + private static boolean isValidForDungeonExit(NewDimData destination, DDProperties properties) + { + // Prevent exits to The End and Limbo + if (destination.id() == END_DIMENSION_ID || destination.id() == properties.LimboDimensionID) + { + return false; + } + // Prevent exits to Witchery's Spirit World; we need to load the dimension to retrieve its name. + // This is okay because the dimension would have to be loaded subsequently by generateSafeExit(). + World world = PocketManager.loadDimension(destination.id()); + return (world != null && !SPIRIT_WORLD_NAME.equals(world.provider.getDimensionName())); + } + + private static boolean generateSafeExit(NewDimData destinationDim, DimLink link, DDProperties properties) + { + // A safe exit attempts to place a Warp Door in a dimension with + // some precautions to protect the player. The X and Z coordinates + // are fixed to match the source (mostly - may be shifted a little), + // but the Y coordinate is chosen by searching for the nearest + // a safe location to place the door. + + Point4D source = link.source(); + World world = PocketManager.loadDimension(destinationDim.id()); + if (world == null) + { + return false; + } + + int startY = source.getY() - 2; + Point3D destination; + Point3D locationUp = yCoordHelper.findSafeCubeUp(world, source.getX(), startY, source.getZ()); + Point3D locationDown = yCoordHelper.findSafeCubeDown(world, source.getX(), startY, source.getZ()); + + if (locationUp == null) + { + destination = locationDown; + } + else if (locationDown == null) + { + destination = locationUp; + } + else if (locationUp.getY() - startY <= startY - locationDown.getY()) + { + destination = locationUp; + } + else + { + destination = locationDown; + } + if (destination != null) + { + // Set up a 3x3 platform at the destination + // Only place fabric of reality if the block is replaceable or air + // Don't cause block updates + int x = destination.getX(); + int y = destination.getY(); + int z = destination.getZ(); + for (int dx = -1; dx <= 1; dx++) + { + for (int dz = -1; dz <= 1; dz++) + { + // Checking if the block is not an opaque solid is equivalent + // checking for a replaceable block, because we only allow + // exits intersecting blocks on those two surfaces. + if (!world.isBlockNormalCubeDefault(x + dx, y, z + dz, false)) + { + world.setBlock(x + dx, y, z + dz, mod_pocketDim.blockDimWall, 0, 2); + } + } + } + + // Clear out any blocks in the space above the platform layer + // This removes any potential threats like replaceable Poison Ivy from BoP + // Remember to avoid block updates to keep gravel from collapsing + for (int dy = 1; dy <= 2; dy++) + { + for (int dx = -1; dx <= 1; dx++) + { + for (int dz = -1; dz <= 1; dz++) + { + world.setBlock(x + dx, y + dy, z + dz, Blocks.air, 0, 2); + } + } + } + + // Create a reverse link for returning + int orientation = getDestinationOrientation(source, properties); + NewDimData sourceDim = PocketManager.getDimensionData(link.source().getDimension()); + DimLink reverse = destinationDim.createLink(x, y + 2, z, LinkType.REVERSE,orientation); + + sourceDim.setLinkDestination(reverse, source.getX(), source.getY(), source.getZ()); + + // Set up the warp door at the destination + orientation = BlockRotator.transformMetadata(orientation, 2, mod_pocketDim.warpDoor); + ItemDoor.placeDoorBlock(world, x, y + 1, z, orientation, mod_pocketDim.warpDoor); + + // Complete the link to the destination + // This comes last so the destination isn't set unless everything else works first + destinationDim.setLinkDestination(link, x, y + 2, z); + } + + return (destination != null); + } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/core/LinkType.java b/src/main/java/StevenDimDoors/mod_pocketDim/core/LinkType.java index 2f0311f..ba9567e 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/core/LinkType.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/core/LinkType.java @@ -14,6 +14,7 @@ public enum LinkType UNSAFE_EXIT(6), REVERSE(7), PERSONAL(8), + LIMBO(9), CLIENT(-1337); LinkType(int index) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/core/NewDimData.java b/src/main/java/StevenDimDoors/mod_pocketDim/core/NewDimData.java index f0b646e..ec76b8c 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/core/NewDimData.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/core/NewDimData.java @@ -8,6 +8,7 @@ import java.util.Random; import java.util.Stack; import java.util.TreeMap; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; import net.minecraft.item.ItemStack; import net.minecraft.world.ChunkCoordIntPair; @@ -251,7 +252,7 @@ public abstract class NewDimData implements IPackable for (k = -range; k <= range; k++) { distance = getAbsoluteSum(i, j, k); - if (distance > 0 && distance < minDistance && world.getBlockId(x + i, y + j, z + k) == properties.RiftBlockID) + if (distance > 0 && distance < minDistance && world.getBlock(x + i, y + j, z + k) == mod_pocketDim.blockRift) { link = getLink(x + i, y + j, z + k); if (link != null) @@ -290,7 +291,7 @@ public abstract class NewDimData implements IPackable for (k = -range; k <= range; k++) { distance = getAbsoluteSum(i, j, k); - if (distance > 0 && world.getBlockId(x + i, y + j, z + k) == properties.RiftBlockID) + if (distance > 0 && world.getBlock(x + i, y + j, z + k) == mod_pocketDim.blockRift) { link = getLink(x + i, y + j, z + k); if (link != null) @@ -427,7 +428,8 @@ public abstract class NewDimData implements IPackable } // Raise deletion event - linkWatcher.onDeleted(new ClientLinkData(link)); + if (linkWatcher != null) + linkWatcher.onDeleted(new ClientLinkData(link)); target.clear(); modified = true; } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/core/PocketManager.java b/src/main/java/StevenDimDoors/mod_pocketDim/core/PocketManager.java index 209c2fc..a476e36 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/core/PocketManager.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/core/PocketManager.java @@ -1,9 +1,6 @@ package StevenDimDoors.mod_pocketDim.core; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.IOException; +import java.io.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -21,7 +18,6 @@ import StevenDimDoors.mod_pocketDim.saving.PackedDimData; 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; import cpw.mods.fml.common.FMLCommonHandler; @@ -60,14 +56,15 @@ public class PocketManager } - private static class ClientLinkWatcher implements IUpdateWatcher + public static class ClientLinkWatcher implements IUpdateWatcher { @Override public void onCreated(ClientLinkData link) { - Point4D source = link.point; - NewDimData dimension = getDimensionData(source.getDimension()); - dimension.createLink(source, LinkType.CLIENT, 0, link.lock); + Point4D source = link.point; + NewDimData dimension = getDimensionData(source.getDimension()); + if (dimension != null && dimension.getLink(source.getX(), source.getY(), source.getZ()) == null) + dimension.createLink(source, LinkType.CLIENT, 0, link.lock); } @Override @@ -75,7 +72,8 @@ public class PocketManager { Point4D source = link.point; NewDimData dimension = getDimensionData(source.getDimension()); - dimension.deleteLink(source.getX(), source.getY(), source.getZ()); + if (dimension != null && dimension.getLink(source.getX(),source.getY(),source.getZ()) != null) + dimension.deleteLink(source.getX(), source.getY(), source.getZ()); } @Override @@ -83,13 +81,14 @@ public class PocketManager { Point4D source = link.point; NewDimData dimension = getDimensionData(source.getDimension()); - DimLink dLink = dimension.getLink(source); - dLink.lock = link.lock; - + if (dimension != null) { + DimLink dLink = dimension.getLink(source); + dLink.lock = link.lock; + } } } - private static class ClientDimWatcher implements IUpdateWatcher + public static class ClientDimWatcher implements IUpdateWatcher { @Override public void onCreated(ClientDimData data) @@ -508,8 +507,7 @@ public class PocketManager * * @param dimensionID * @param parent - * @param isPocket - * @param isDungeon + * @param type * @return */ private static NewDimData registerDimension(int dimensionID, InnerDimData parent, DimensionType type) @@ -571,7 +569,10 @@ public class PocketManager // unfortuantly. I send the dimdata to the client when they // teleport. // Steven - DimensionManager.registerDimension(dimensionID, mod_pocketDim.properties.PocketProviderID); + int providerID = mod_pocketDim.properties.PocketProviderID; + if (type == DimensionType.PERSONAL) + providerID = mod_pocketDim.properties.PersonalPocketProviderID; + DimensionManager.registerDimension(dimensionID,providerID); } return dimension; } @@ -628,6 +629,13 @@ public class PocketManager return (ArrayList) rootDimensions.clone(); } + public static void tryUnload() { + if (isConnected) + unload(); + isLoading = false; + isLoaded = false; + } + public static void unload() { System.out.println("Unloading Pocket Dimensions..."); @@ -689,12 +697,7 @@ public class PocketManager return linkWatcher.unregisterReceiver(watcher); } - public static void getWatchers(IUpdateSource updateSource) - { - updateSource.registerWatchers(new ClientDimWatcher(), new ClientLinkWatcher()); - } - - public static void writePacket(DataOutputStream output) throws IOException + public static void writePacket(DataOutput output) throws IOException { // Write a very compact description of our dimensions and links to be // sent to a client @@ -716,7 +719,7 @@ public class PocketManager } } - public static void readPacket(DataInputStream input) throws IOException + public static void readPacket(DataInput input) throws IOException { // TODO- figure out why this is getting called so frequently if (isLoaded) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java index afcbc0e..a59a5d2 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java @@ -9,8 +9,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Random; import java.util.TreeMap; + +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import net.minecraft.block.Block; import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntitySign; @@ -36,15 +39,6 @@ import StevenDimDoors.mod_pocketDim.util.Point4D; public class DungeonSchematic extends Schematic { - private static final short MAX_VANILLA_BLOCK_ID = 173; - private static final short STANDARD_FABRIC_OF_REALITY_ID = 1973; - private static final short STANDARD_ETERNAL_FABRIC_ID = 220; - private static final short STANDARD_WARP_DOOR_ID = 1975; - private static final short STANDARD_DIMENSIONAL_DOOR_ID = 1970; - private static final short STANDARD_TRANSIENT_DOOR_ID = 1979; - - private static final short MONOLITH_SPAWN_MARKER_ID = (short) Block.endPortalFrame.blockID; - private static final short EXIT_DOOR_MARKER_ID = (short) Block.sandStone.blockID; private static final int NETHER_DIMENSION_ID = -1; private int orientation; @@ -52,18 +46,17 @@ public class DungeonSchematic extends Schematic { private ArrayList exitDoorLocations; private ArrayList dimensionalDoorLocations; private ArrayList monolithSpawnLocations; - - private static final short[] MOD_BLOCK_FILTER_EXCEPTIONS = new short[] { - STANDARD_FABRIC_OF_REALITY_ID, - STANDARD_ETERNAL_FABRIC_ID, - STANDARD_WARP_DOOR_ID, - STANDARD_DIMENSIONAL_DOOR_ID, - STANDARD_TRANSIENT_DOOR_ID - }; - + private ArrayList modBlockFilterExceptions; + private DungeonSchematic(Schematic source) { super(source); + modBlockFilterExceptions = new ArrayList(5); + modBlockFilterExceptions.add(mod_pocketDim.blockDimWall); + modBlockFilterExceptions.add(mod_pocketDim.blockDimWallPerm); + modBlockFilterExceptions.add(mod_pocketDim.warpDoor); + modBlockFilterExceptions.add(mod_pocketDim.dimensionalDoor); + modBlockFilterExceptions.add(mod_pocketDim.transientDoor); } public int getOrientation() @@ -108,12 +101,12 @@ public class DungeonSchematic extends Schematic { public void applyImportFilters(DDProperties properties) { //Search for special blocks (warp doors, dim doors, and end portal frames that mark Monolith spawn points) - SpecialBlockFinder finder = new SpecialBlockFinder(STANDARD_WARP_DOOR_ID, STANDARD_DIMENSIONAL_DOOR_ID, - MONOLITH_SPAWN_MARKER_ID, EXIT_DOOR_MARKER_ID); + SpecialBlockFinder finder = new SpecialBlockFinder(mod_pocketDim.warpDoor, mod_pocketDim.dimensionalDoor, + Blocks.end_portal_frame, Blocks.sandstone); applyFilter(finder); //Flip the entrance's orientation to get the dungeon's orientation - orientation = BlockRotator.transformMetadata(finder.getEntranceOrientation(), 2, Block.doorWood.blockID); + orientation = BlockRotator.transformMetadata(finder.getEntranceOrientation(), 2, Blocks.wooden_door); entranceDoorLocation = finder.getEntranceDoorLocation(); exitDoorLocations = finder.getExitDoorLocations(); @@ -122,19 +115,10 @@ public class DungeonSchematic extends Schematic { //Filter out mod blocks except some of our own CompoundFilter standardizer = new CompoundFilter(); - standardizer.addFilter(new ModBlockFilter(MAX_VANILLA_BLOCK_ID, MOD_BLOCK_FILTER_EXCEPTIONS, - (short) properties.FabricBlockID, (byte) 0)); + standardizer.addFilter(new ModBlockFilter(modBlockFilterExceptions, + mod_pocketDim.blockDimWall, (byte) 0)); //Also convert standard DD block IDs to local versions - Map mapping = getAssignedToStandardIDMapping(properties); - - for (Entry entry : mapping.entrySet()) - { - if (entry.getKey() != entry.getValue()) - { - standardizer.addFilter(new ReplacementFilter(entry.getValue(), entry.getKey())); - } - } applyFilter(standardizer); } @@ -143,36 +127,15 @@ public class DungeonSchematic extends Schematic { //Check if some block IDs assigned by Forge differ from our standard IDs //If so, change the IDs to standard values CompoundFilter standardizer = new CompoundFilter(); - Map mapping = getAssignedToStandardIDMapping(properties); - - for (Entry entry : mapping.entrySet()) - { - if (entry.getKey() != entry.getValue()) - { - standardizer.addFilter(new ReplacementFilter(entry.getKey(), entry.getValue())); - } - } //Filter out mod blocks except some of our own //This comes after ID standardization because the mod block filter relies on standardized IDs - standardizer.addFilter(new ModBlockFilter(MAX_VANILLA_BLOCK_ID, MOD_BLOCK_FILTER_EXCEPTIONS, - STANDARD_FABRIC_OF_REALITY_ID, (byte) 0)); + standardizer.addFilter(new ModBlockFilter(modBlockFilterExceptions, + mod_pocketDim.blockDimWall, (byte) 0)); applyFilter(standardizer); } - - private static Map getAssignedToStandardIDMapping(DDProperties properties) - { - //If we ever need this broadly or support other mods, this should be moved to a separate class - TreeMap mapping = new TreeMap(); - mapping.put((short) properties.FabricBlockID, STANDARD_FABRIC_OF_REALITY_ID); - mapping.put((short) properties.PermaFabricBlockID, STANDARD_ETERNAL_FABRIC_ID); - mapping.put((short) properties.WarpDoorID, STANDARD_WARP_DOOR_ID); - mapping.put((short) properties.DimensionalDoorID, STANDARD_DIMENSIONAL_DOOR_ID); - mapping.put((short) properties.TransientDoorID, STANDARD_TRANSIENT_DOOR_ID); - return mapping; - } - + public static DungeonSchematic copyFromWorld(World world, int x, int y, int z, short width, short height, short length, boolean doCompactBounds) { return new DungeonSchematic(Schematic.copyFromWorld(world, x, y, z, width, height, length, doCompactBounds)); @@ -203,7 +166,7 @@ public class DungeonSchematic extends Schematic { int index; int count; - int blockID; + Block block; int blockMeta; int dx, dy, dz; Point3D pocketPoint = new Point3D(0, 0, 0); @@ -219,12 +182,12 @@ public class DungeonSchematic extends Schematic { pocketPoint.setX(dx); pocketPoint.setY(dy); pocketPoint.setZ(dz); - blockID = blocks[index]; + block = blocks[index]; BlockRotator.transformPoint(pocketPoint, entranceDoorLocation, turnAngle, pocketCenter); - blockMeta = BlockRotator.transformMetadata(metadata[index], turnAngle, blockID); + blockMeta = BlockRotator.transformMetadata(metadata[index], turnAngle, block); //In the future, we might want to make this more efficient by building whole chunks at a time - blockSetter.setBlock(world, pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), blockID, blockMeta); + blockSetter.setBlock(world, pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), block, blockMeta); index++; } } @@ -233,7 +196,7 @@ public class DungeonSchematic extends Schematic { count = tileEntities.tagCount(); for (index = 0; index < count; index++) { - NBTTagCompound tileTag = (NBTTagCompound) tileEntities.tagAt(index); + NBTTagCompound tileTag = (NBTTagCompound) tileEntities.getCompoundTagAt(index); //Rewrite its location to be in world coordinates pocketPoint.setX(tileTag.getInteger("x")); pocketPoint.setY(tileTag.getInteger("y")); @@ -243,7 +206,7 @@ public class DungeonSchematic extends Schematic { tileTag.setInteger("y", pocketPoint.getY()); tileTag.setInteger("z", pocketPoint.getZ()); //Load the tile entity and put it in the world - world.setBlockTileEntity(pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), TileEntity.createAndLoadEntity(tileTag)); + world.setTileEntity(pocketPoint.getX(), pocketPoint.getY(), pocketPoint.getZ(), TileEntity.createAndLoadEntity(tileTag)); } setUpDungeon(PocketManager.createDimensionData(world), world, pocketCenter, turnAngle, entryLink, random, properties, blockSetter); @@ -341,9 +304,9 @@ public class DungeonSchematic extends Schematic { int z = location.getZ(); if (y >= 0) { - int blockID = world.getBlockId(x, y, z); + Block block = world.getBlock(x, y, z); int metadata = world.getBlockMetadata(x, y, z); - blockSetter.setBlock(world, x, y + 1, z, blockID, metadata); + blockSetter.setBlock(world, x, y + 1, z, block, metadata); } initDoorTileEntity(world, location); } @@ -365,7 +328,7 @@ public class DungeonSchematic extends Schematic { Point3D location = point.clone(); BlockRotator.transformPoint(location, entrance, rotation, pocketCenter); //Remove frame block - blockSetter.setBlock(world, location.getX(), location.getY(), location.getZ(), 0, 0); + blockSetter.setBlock(world, location.getX(), location.getY(), location.getZ(), Blocks.air, 0); //Spawn Monolith if (canSpawn) { @@ -377,8 +340,8 @@ public class DungeonSchematic extends Schematic { private static void initDoorTileEntity(World world, Point3D point) { - Block door = Block.blocksList[world.getBlockId(point.getX(), point.getY(), point.getZ())]; - Block door2 = Block.blocksList[world.getBlockId(point.getX(), point.getY() - 1, point.getZ())]; + Block door = world.getBlock(point.getX(), point.getY(), point.getZ()); + Block door2 = world.getBlock(point.getX(), point.getY() - 1, point.getZ()); if (door instanceof IDimDoor && door2 instanceof IDimDoor) { @@ -395,7 +358,8 @@ public class DungeonSchematic extends Schematic { { final int SEARCH_RANGE = 6; - int x, y, z, block; + int x, y, z; + Block block; int dx, dy, dz; for (dy = SEARCH_RANGE; dy >= -SEARCH_RANGE; dy--) @@ -407,12 +371,12 @@ public class DungeonSchematic extends Schematic { x = pocketCenter.getX() + dx; y = pocketCenter.getY() + dy; z = pocketCenter.getZ() + dz; - block = world.getBlockId(x, y, z); - if (block == Block.signWall.blockID || block == Block.signPost.blockID) + block = world.getBlock(x, y, z); + if (block == Blocks.wall_sign || block == Blocks.standing_sign) { TileEntitySign signEntity = new TileEntitySign(); signEntity.signText[1] = "Level " + depth; - world.setBlockTileEntity(x, y, z, signEntity); + world.setTileEntity(x, y, z, signEntity); return; } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/FillContainersOperation.java b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/FillContainersOperation.java index e44a58b..ef39006 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/FillContainersOperation.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/FillContainersOperation.java @@ -33,12 +33,12 @@ public class FillContainersOperation extends WorldOperation @Override protected boolean applyToBlock(World world, int x, int y, int z) { - int blockID = world.getBlockId(x, y, z); + Block block = world.getBlock(x, y, z); // Fill empty chests and dispensers - if (Block.blocksList[blockID] instanceof BlockContainer) + if (block instanceof BlockContainer) { - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + TileEntity tileEntity = world.getTileEntity(x, y, z); // Fill chests if (tileEntity instanceof TileEntityChest) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/ModBlockFilter.java b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/ModBlockFilter.java index c0ab099..11af89f 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/ModBlockFilter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/ModBlockFilter.java @@ -3,40 +3,40 @@ package StevenDimDoors.mod_pocketDim.dungeon; import net.minecraft.block.Block; import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter; +import java.util.List; + public class ModBlockFilter extends SchematicFilter { - private short maxVanillaBlockID; - private short[] exceptions; - private short replacementBlockID; + private List exceptions; + private Block replacementBlock; private byte replacementMetadata; - public ModBlockFilter(short maxVanillaBlockID, short[] exceptions, short replacementBlockID, byte replacementMetadata) + public ModBlockFilter(List exceptions, Block replacementBlock, byte replacementMetadata) { super("ModBlockFilter"); - this.maxVanillaBlockID = maxVanillaBlockID; this.exceptions = exceptions; - this.replacementBlockID = replacementBlockID; + this.replacementBlock = replacementBlock; this.replacementMetadata = replacementMetadata; } @Override - protected boolean applyToBlock(int index, short[] blocks, byte[] metadata) + protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata) { int k; - short currentID = blocks[index]; - if (currentID > maxVanillaBlockID || (currentID != 0 && Block.blocksList[currentID] == null)) + Block current = blocks[index]; + if (!Block.blockRegistry.getNameForObject(current).startsWith("minecraft:")) { //This might be a mod block. Check if an exception exists. - for (k = 0; k < exceptions.length; k++) + for (k = 0; k < exceptions.size(); k++) { - if (currentID == exceptions[k]) + if (current == exceptions.get(k)) { //Exception found, not considered a mod block return false; } } //No matching exception found. Replace the block. - blocks[index] = replacementBlockID; + blocks[index] = replacementBlock; metadata[index] = replacementMetadata; return true; } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/SpecialBlockFinder.java b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/SpecialBlockFinder.java index ff8fffb..3c32e05 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/SpecialBlockFinder.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/SpecialBlockFinder.java @@ -5,13 +5,14 @@ import java.util.ArrayList; import StevenDimDoors.mod_pocketDim.Point3D; import StevenDimDoors.mod_pocketDim.schematic.Schematic; import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter; +import net.minecraft.block.Block; public class SpecialBlockFinder extends SchematicFilter { - private short warpDoorID; - private short dimensionalDoorID; - private short monolithSpawnMarkerID; - private short exitMarkerID; + private Block warpDoor; + private Block dimensionalDoor; + private Block monolithSpawnMarker; + private Block exitMarker; private int entranceOrientation; private Schematic schematic; private Point3D entranceDoorLocation; @@ -19,13 +20,13 @@ public class SpecialBlockFinder extends SchematicFilter { private ArrayList dimensionalDoorLocations; private ArrayList monolithSpawnLocations; - public SpecialBlockFinder(short warpDoorID, short dimensionalDoorID, short monolithSpawnMarkerID, short exitMarkerID) + public SpecialBlockFinder(Block warpDoor, Block dimensionalDoor, Block monolithSpawn, Block exitDoor) { super("SpecialBlockFinder"); - this.warpDoorID = warpDoorID; - this.dimensionalDoorID = dimensionalDoorID; - this.monolithSpawnMarkerID = monolithSpawnMarkerID; - this.exitMarkerID = exitMarkerID; + this.warpDoor = warpDoor; + this.dimensionalDoor = dimensionalDoor; + this.monolithSpawnMarker = monolithSpawn; + this.exitMarker = exitDoor; this.entranceDoorLocation = null; this.entranceOrientation = 0; this.exitDoorLocations = new ArrayList(); @@ -55,27 +56,27 @@ public class SpecialBlockFinder extends SchematicFilter { } @Override - protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata) + protected boolean initialize(Schematic schematic, Block[] blocks, byte[] metadata) { this.schematic = schematic; return true; } @Override - protected boolean applyToBlock(int index, short[] blocks, byte[] metadata) + protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata) { int indexBelow; int indexDoubleBelow; - if (blocks[index] == monolithSpawnMarkerID) + if (blocks[index] == monolithSpawnMarker) { monolithSpawnLocations.add(schematic.calculatePoint(index)); return true; } - if (blocks[index] == dimensionalDoorID) + if (blocks[index] == dimensionalDoor) { indexBelow = schematic.calculateIndexBelow(index); - if (indexBelow >= 0 && blocks[indexBelow] == dimensionalDoorID) + if (indexBelow >= 0 && blocks[indexBelow] == dimensionalDoor) { dimensionalDoorLocations.add(schematic.calculatePoint(index)); return true; @@ -85,13 +86,13 @@ public class SpecialBlockFinder extends SchematicFilter { return false; } } - if (blocks[index] == warpDoorID) + if (blocks[index] == warpDoor) { indexBelow = schematic.calculateIndexBelow(index); - if (indexBelow >= 0 && blocks[indexBelow] == warpDoorID) + if (indexBelow >= 0 && blocks[indexBelow] == warpDoor) { indexDoubleBelow = schematic.calculateIndexBelow(indexBelow); - if (indexDoubleBelow >= 0 && blocks[indexDoubleBelow] == exitMarkerID) + if (indexDoubleBelow >= 0 && blocks[indexDoubleBelow] == exitMarker) { exitDoorLocations.add(schematic.calculatePoint(index)); return true; diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/helpers/BlockRotationHelper.java b/src/main/java/StevenDimDoors/mod_pocketDim/helpers/BlockRotationHelper.java index 814f6f6..c533b10 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/helpers/BlockRotationHelper.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/helpers/BlockRotationHelper.java @@ -3,10 +3,11 @@ package StevenDimDoors.mod_pocketDim.helpers; import java.util.HashMap; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; public class BlockRotationHelper { - public HashMap>> rotationMappings = new HashMap>>(); + public HashMap>> rotationMappings = new HashMap>>(); public BlockRotationHelper() { @@ -15,7 +16,7 @@ public class BlockRotationHelper public void InitializeRotationMap() { - HashMap> orientation0 = new HashMap>(); + HashMap> orientation0 = new HashMap>(); HashMap stairs0 = new HashMap(); @@ -99,7 +100,7 @@ public class BlockRotationHelper railsSpecial0.put(9, 8); - HashMap> orientation1 = new HashMap>(); + HashMap> orientation1 = new HashMap>(); HashMap stairs1 = new HashMap(); @@ -183,7 +184,7 @@ public class BlockRotationHelper railsSpecial1.put(8, 8); railsSpecial1.put(9, 9); - HashMap> orientation2 = new HashMap>(); + HashMap> orientation2 = new HashMap>(); HashMap stairs2 = new HashMap(); @@ -270,122 +271,119 @@ public class BlockRotationHelper - orientation0.put(Block.stairsBrick.blockID, stairs0); - orientation0.put(Block.stairsCobblestone.blockID, stairs0); - orientation0.put(Block.stairsNetherBrick.blockID, stairs0); - orientation0.put(Block.stairsNetherQuartz.blockID, stairs0); - orientation0.put(Block.stairsSandStone.blockID, stairs0); - orientation0.put(Block.stairsStoneBrick.blockID, stairs0); - orientation0.put(Block.stairsWoodBirch.blockID, stairs0); - orientation0.put(Block.stairsWoodJungle.blockID, stairs0); - orientation0.put(Block.stairsWoodOak.blockID, stairs0); - orientation0.put(Block.stairsWoodSpruce.blockID, stairs0); - orientation0.put(Block.stairsBrick.blockID, stairs0); - orientation0.put(Block.vine.blockID, vine0); - orientation0.put(Block.chest.blockID, chestsLadders0); - orientation0.put(Block.chestTrapped.blockID, chestsLadders0); - orientation0.put(Block.ladder.blockID, chestsLadders0); - orientation0.put(Block.lever.blockID, leverButtonTorch0); - orientation0.put(Block.stoneButton.blockID, leverButtonTorch0); - orientation0.put(Block.woodenButton.blockID, leverButtonTorch0); - orientation0.put(Block.torchRedstoneActive.blockID, leverButtonTorch0); - orientation0.put(Block.torchRedstoneIdle.blockID, leverButtonTorch0); - orientation0.put(Block.torchWood.blockID, leverButtonTorch0); - orientation0.put(Block.pistonBase.blockID,pistonDropperDispenser0); - orientation0.put(Block.pistonExtension.blockID,pistonDropperDispenser0); - orientation0.put(Block.pistonMoving.blockID,pistonDropperDispenser0); - orientation0.put(Block.pistonStickyBase.blockID,pistonDropperDispenser0); - orientation0.put(Block.dropper.blockID,pistonDropperDispenser0); - orientation0.put(Block.dispenser.blockID,pistonDropperDispenser0); - orientation0.put(Block.redstoneComparatorActive.blockID,pistonDropperDispenser0); - orientation0.put(Block.redstoneComparatorIdle.blockID,pistonDropperDispenser0); - orientation0.put(Block.redstoneRepeaterActive.blockID,pistonDropperDispenser0); - orientation0.put(Block.redstoneRepeaterIdle.blockID,pistonDropperDispenser0); - orientation0.put(Block.doorWood.blockID,pistonDropperDispenser0); - orientation0.put(Block.doorIron.blockID,pistonDropperDispenser0); - orientation0.put(Block.tripWireSource.blockID,pistonDropperDispenser0); - orientation0.put(Block.railDetector.blockID,railsSpecial0); - orientation0.put(Block.railActivator.blockID,railsSpecial0); - orientation0.put(Block.railPowered.blockID,railsSpecial0); - orientation0.put(Block.rail.blockID,rails0); + orientation0.put(Blocks.brick_stairs, stairs0); + orientation0.put(Blocks.stone_stairs, stairs0); + orientation0.put(Blocks.nether_brick_stairs, stairs0); + orientation0.put(Blocks.quartz_stairs, stairs0); + orientation0.put(Blocks.sandstone_stairs, stairs0); + orientation0.put(Blocks.stone_brick_stairs, stairs0); + orientation0.put(Blocks.birch_stairs, stairs0); + orientation0.put(Blocks.jungle_stairs, stairs0); + orientation0.put(Blocks.oak_stairs, stairs0); + orientation0.put(Blocks.spruce_stairs, stairs0); + orientation0.put(Blocks.brick_stairs, stairs0); + orientation0.put(Blocks.vine, vine0); + orientation0.put(Blocks.chest, chestsLadders0); + orientation0.put(Blocks.trapped_chest, chestsLadders0); + orientation0.put(Blocks.ladder, chestsLadders0); + orientation0.put(Blocks.lever, leverButtonTorch0); + orientation0.put(Blocks.stone_button, leverButtonTorch0); + orientation0.put(Blocks.wooden_button, leverButtonTorch0); + orientation0.put(Blocks.redstone_torch, leverButtonTorch0); + orientation0.put(Blocks.unlit_redstone_torch, leverButtonTorch0); + orientation0.put(Blocks.torch, leverButtonTorch0); + orientation0.put(Blocks.piston,pistonDropperDispenser0); + orientation0.put(Blocks.piston_head,pistonDropperDispenser0); + orientation0.put(Blocks.piston_extension,pistonDropperDispenser0); + orientation0.put(Blocks.sticky_piston,pistonDropperDispenser0); + orientation0.put(Blocks.dropper,pistonDropperDispenser0); + orientation0.put(Blocks.dispenser,pistonDropperDispenser0); + orientation0.put(Blocks.powered_comparator,pistonDropperDispenser0); + orientation0.put(Blocks.unpowered_comparator,pistonDropperDispenser0); + orientation0.put(Blocks.powered_repeater,pistonDropperDispenser0); + orientation0.put(Blocks.unpowered_repeater,pistonDropperDispenser0); + orientation0.put(Blocks.wooden_door,pistonDropperDispenser0); + orientation0.put(Blocks.iron_door,pistonDropperDispenser0); + orientation0.put(Blocks.tripwire_hook,pistonDropperDispenser0); + orientation0.put(Blocks.detector_rail,railsSpecial0); + orientation0.put(Blocks.activator_rail,railsSpecial0); + orientation0.put(Blocks.golden_rail,railsSpecial0); + orientation0.put(Blocks.rail,rails0); - orientation1.put(Block.stairsBrick.blockID, stairs1); - orientation1.put(Block.stairsCobblestone.blockID, stairs1); - orientation1.put(Block.stairsNetherBrick.blockID, stairs1); - orientation1.put(Block.stairsNetherQuartz.blockID, stairs1); - orientation1.put(Block.stairsSandStone.blockID, stairs1); - orientation1.put(Block.stairsStoneBrick.blockID, stairs1); - orientation1.put(Block.stairsWoodBirch.blockID, stairs1); - orientation1.put(Block.stairsWoodJungle.blockID, stairs1); - orientation1.put(Block.stairsWoodOak.blockID, stairs1); - orientation1.put(Block.stairsWoodSpruce.blockID, stairs1); - orientation1.put(Block.stairsBrick.blockID, stairs1); - orientation1.put(Block.vine.blockID, vine1); - orientation1.put(Block.chest.blockID, chestsLadders1); - orientation1.put(Block.chestTrapped.blockID, chestsLadders1); - orientation1.put(Block.ladder.blockID, chestsLadders1); - orientation1.put(Block.lever.blockID, leverButtonTorch1); - orientation1.put(Block.stoneButton.blockID, leverButtonTorch1); - orientation1.put(Block.woodenButton.blockID, leverButtonTorch1); - orientation1.put(Block.torchRedstoneActive.blockID, leverButtonTorch1); - orientation1.put(Block.torchRedstoneIdle.blockID, leverButtonTorch1); - orientation1.put(Block.torchWood.blockID, leverButtonTorch1); - orientation1.put(Block.pistonBase.blockID,pistonDropperDispenser1); - orientation1.put(Block.pistonExtension.blockID,pistonDropperDispenser1); - orientation1.put(Block.pistonMoving.blockID,pistonDropperDispenser1); - orientation1.put(Block.pistonStickyBase.blockID,pistonDropperDispenser1); - orientation1.put(Block.dropper.blockID,pistonDropperDispenser1); - orientation1.put(Block.dispenser.blockID,pistonDropperDispenser1); - orientation1.put(Block.redstoneComparatorActive.blockID,pistonDropperDispenser1); - orientation1.put(Block.redstoneComparatorIdle.blockID,pistonDropperDispenser1); - orientation1.put(Block.redstoneRepeaterActive.blockID,pistonDropperDispenser1); - orientation1.put(Block.redstoneRepeaterIdle.blockID,pistonDropperDispenser1); - orientation1.put(Block.doorWood.blockID,pistonDropperDispenser1); - orientation1.put(Block.doorIron.blockID,pistonDropperDispenser1); - orientation1.put(Block.tripWireSource.blockID,pistonDropperDispenser1); - orientation1.put(Block.railDetector.blockID,railsSpecial1); - orientation1.put(Block.railActivator.blockID,railsSpecial1); - orientation1.put(Block.railPowered.blockID,railsSpecial1); - orientation1.put(Block.rail.blockID,rails1); + orientation1.put(Blocks.brick_stairs, stairs1); + orientation1.put(Blocks.stone_stairs, stairs1); + orientation1.put(Blocks.nether_brick_stairs, stairs1); + orientation1.put(Blocks.quartz_stairs, stairs1); + orientation1.put(Blocks.sandstone_stairs, stairs1); + orientation1.put(Blocks.stone_brick_stairs, stairs1); + orientation1.put(Blocks.birch_stairs, stairs1); + orientation1.put(Blocks.jungle_stairs, stairs1); + orientation1.put(Blocks.oak_stairs, stairs1); + orientation1.put(Blocks.spruce_stairs, stairs1); + orientation1.put(Blocks.vine, vine1); + orientation1.put(Blocks.chest, chestsLadders1); + orientation1.put(Blocks.trapped_chest, chestsLadders1); + orientation1.put(Blocks.ladder, chestsLadders1); + orientation1.put(Blocks.lever, leverButtonTorch1); + orientation1.put(Blocks.stone_button, leverButtonTorch1); + orientation1.put(Blocks.wooden_button, leverButtonTorch1); + orientation1.put(Blocks.redstone_torch, leverButtonTorch1); + orientation1.put(Blocks.unlit_redstone_torch, leverButtonTorch1); + orientation1.put(Blocks.torch, leverButtonTorch1); + orientation1.put(Blocks.piston,pistonDropperDispenser1); + orientation1.put(Blocks.piston_head,pistonDropperDispenser1); + orientation1.put(Blocks.piston_extension,pistonDropperDispenser1); + orientation1.put(Blocks.sticky_piston,pistonDropperDispenser1); + orientation1.put(Blocks.dropper,pistonDropperDispenser1); + orientation1.put(Blocks.dispenser,pistonDropperDispenser1); + orientation1.put(Blocks.powered_comparator,pistonDropperDispenser1); + orientation1.put(Blocks.unpowered_comparator,pistonDropperDispenser1); + orientation1.put(Blocks.powered_repeater,pistonDropperDispenser1); + orientation1.put(Blocks.unpowered_repeater,pistonDropperDispenser1); + orientation1.put(Blocks.wooden_door,pistonDropperDispenser1); + orientation1.put(Blocks.iron_door,pistonDropperDispenser1); + orientation1.put(Blocks.tripwire_hook,pistonDropperDispenser1); + orientation1.put(Blocks.detector_rail,railsSpecial1); + orientation1.put(Blocks.activator_rail,railsSpecial1); + orientation1.put(Blocks.golden_rail,railsSpecial1); + orientation1.put(Blocks.rail,rails1); - orientation2.put(Block.stairsBrick.blockID, stairs2); - orientation2.put(Block.stairsCobblestone.blockID, stairs2); - orientation2.put(Block.stairsNetherBrick.blockID, stairs2); - orientation2.put(Block.stairsNetherQuartz.blockID, stairs2); - orientation2.put(Block.stairsSandStone.blockID, stairs2); - orientation2.put(Block.stairsStoneBrick.blockID, stairs2); - orientation2.put(Block.stairsWoodBirch.blockID, stairs2); - orientation2.put(Block.stairsWoodJungle.blockID, stairs2); - orientation2.put(Block.stairsWoodOak.blockID, stairs2); - orientation2.put(Block.stairsWoodSpruce.blockID, stairs2); - orientation2.put(Block.stairsBrick.blockID, stairs2); - orientation2.put(Block.vine.blockID, vine2); - orientation2.put(Block.chest.blockID, chestsLadders2); - orientation2.put(Block.chestTrapped.blockID, chestsLadders2); - orientation2.put(Block.ladder.blockID, chestsLadders2); - orientation2.put(Block.lever.blockID, leverButtonTorch2); - orientation2.put(Block.stoneButton.blockID, leverButtonTorch2); - orientation2.put(Block.woodenButton.blockID, leverButtonTorch2); - orientation2.put(Block.torchRedstoneActive.blockID, leverButtonTorch2); - orientation2.put(Block.torchRedstoneIdle.blockID, leverButtonTorch2); - orientation2.put(Block.torchWood.blockID, leverButtonTorch2); - orientation2.put(Block.pistonBase.blockID,pistonDropperDispenser2); - orientation2.put(Block.pistonExtension.blockID,pistonDropperDispenser2); - orientation2.put(Block.pistonMoving.blockID,pistonDropperDispenser2); - orientation2.put(Block.pistonStickyBase.blockID,pistonDropperDispenser2); - orientation2.put(Block.dropper.blockID,pistonDropperDispenser2); - orientation2.put(Block.dispenser.blockID,pistonDropperDispenser2); - orientation2.put(Block.redstoneComparatorActive.blockID,pistonDropperDispenser2); - orientation2.put(Block.redstoneComparatorIdle.blockID,pistonDropperDispenser2); - orientation2.put(Block.redstoneRepeaterActive.blockID,pistonDropperDispenser2); - orientation2.put(Block.redstoneRepeaterIdle.blockID,pistonDropperDispenser2); - orientation2.put(Block.doorWood.blockID,pistonDropperDispenser2); - orientation2.put(Block.doorIron.blockID,pistonDropperDispenser2); - orientation2.put(Block.tripWireSource.blockID,pistonDropperDispenser2); - orientation2.put(Block.railDetector.blockID,railsSpecial2); - orientation2.put(Block.railActivator.blockID,railsSpecial2); - orientation2.put(Block.railPowered.blockID,railsSpecial2); - orientation2.put(Block.rail.blockID,rails2); + orientation2.put(Blocks.brick_stairs, stairs2); + orientation2.put(Blocks.stone_stairs, stairs2); + orientation2.put(Blocks.nether_brick_stairs, stairs2); + orientation2.put(Blocks.quartz_stairs, stairs2); + orientation2.put(Blocks.sandstone_stairs, stairs2); + orientation2.put(Blocks.stone_brick_stairs, stairs2); + orientation2.put(Blocks.birch_stairs, stairs2); + orientation2.put(Blocks.jungle_stairs, stairs2); + orientation2.put(Blocks.oak_stairs, stairs2); + orientation2.put(Blocks.spruce_stairs, stairs2); + orientation2.put(Blocks.vine, vine2); + orientation2.put(Blocks.trapped_chest, chestsLadders2); + orientation2.put(Blocks.ladder, chestsLadders2); + orientation2.put(Blocks.lever, leverButtonTorch2); + orientation2.put(Blocks.stone_button, leverButtonTorch2); + orientation2.put(Blocks.wooden_button, leverButtonTorch2); + orientation2.put(Blocks.redstone_torch, leverButtonTorch2); + orientation2.put(Blocks.unlit_redstone_torch, leverButtonTorch2); + orientation2.put(Blocks.torch, leverButtonTorch2); + orientation2.put(Blocks.piston,pistonDropperDispenser2); + orientation2.put(Blocks.piston_head,pistonDropperDispenser2); + orientation2.put(Blocks.piston_extension,pistonDropperDispenser2); + orientation2.put(Blocks.sticky_piston,pistonDropperDispenser2); + orientation2.put(Blocks.dropper,pistonDropperDispenser2); + orientation2.put(Blocks.dispenser,pistonDropperDispenser2); + orientation2.put(Blocks.powered_comparator,pistonDropperDispenser2); + orientation2.put(Blocks.unpowered_comparator,pistonDropperDispenser2); + orientation2.put(Blocks.powered_repeater,pistonDropperDispenser2); + orientation2.put(Blocks.unpowered_repeater,pistonDropperDispenser2); + orientation2.put(Blocks.wooden_door,pistonDropperDispenser2); + orientation2.put(Blocks.iron_door,pistonDropperDispenser2); + orientation2.put(Blocks.tripwire_hook,pistonDropperDispenser2); + orientation2.put(Blocks.detector_rail,railsSpecial2); + orientation2.put(Blocks.activator_rail,railsSpecial2); + orientation2.put(Blocks.golden_rail,railsSpecial2); + orientation2.put(Blocks.rail,rails2); this.rotationMappings.put(2, orientation2); this.rotationMappings.put(1, orientation1); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/helpers/ChunkLoaderHelper.java b/src/main/java/StevenDimDoors/mod_pocketDim/helpers/ChunkLoaderHelper.java index 6483afd..014dada 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/helpers/ChunkLoaderHelper.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/helpers/ChunkLoaderHelper.java @@ -32,9 +32,9 @@ public class ChunkLoaderHelper implements LoadingCallback int y = ticket.getModData().getInteger("goldDimDoorY"); int z = ticket.getModData().getInteger("goldDimDoorZ"); - if (world.getBlockId(x, y, z) == mod_pocketDim.properties.GoldenDimensionalDoorID) + if (world.getBlock(x, y, z) == mod_pocketDim.goldenDimensionalDoor) { - IChunkLoader loader = (IChunkLoader) world.getBlockTileEntity(x, y, z); + IChunkLoader loader = (IChunkLoader) world.getTileEntity(x, y, z); if (!loader.isInitialized()) { loader.initialize(ticket); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/helpers/Compactor.java b/src/main/java/StevenDimDoors/mod_pocketDim/helpers/Compactor.java index a19dc9f..8a9aba7 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/helpers/Compactor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/helpers/Compactor.java @@ -1,8 +1,6 @@ package StevenDimDoors.mod_pocketDim.helpers; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; +import java.io.*; import java.util.Collection; import java.util.Comparator; import java.util.HashSet; @@ -27,7 +25,7 @@ public class Compactor } } - public static void write(Collection values, DataOutputStream output) throws IOException + public static void write(Collection values, DataOutput output) throws IOException { // SenseiKiwi: Just encode the data straight up for now. I'll implement fancier compression later. output.writeInt(values.size()); @@ -35,11 +33,11 @@ public class Compactor { output.writeInt(dimension.id()); output.writeInt(dimension.root().id()); + output.writeInt(dimension.type().index); output.writeInt(dimension.linkCount()); for (DimLink link : dimension.links()) { - Point4D.write(link.source(), output); - output.writeInt(link.orientation()); + (new ClientLinkData(link)).write(output); } } @@ -56,7 +54,7 @@ public class Compactor */ } - public static void readDimensions(DataInputStream input, IDimRegistrationCallback callback) throws IOException + public static void readDimensions(DataInput input, IDimRegistrationCallback callback) throws IOException { // Read in the dimensions one by one. Make sure we register root dimensions before // attempting to register the dimensions under them. diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/helpers/yCoordHelper.java b/src/main/java/StevenDimDoors/mod_pocketDim/helpers/yCoordHelper.java index 26aa178..f46af21 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/helpers/yCoordHelper.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/helpers/yCoordHelper.java @@ -52,22 +52,17 @@ public class yCoordHelper public static boolean isCoveredBlock(Chunk chunk, int localX, int y, int localZ) { - int blockID; Block block; Material material; if (y < 0) return false; - blockID = chunk.getBlockID(localX, y, localZ); - if (blockID == 0) - return false; - - block = Block.blocksList[blockID]; + block = chunk.getBlock(localX, y, localZ); if (block == null) return false; - material = block.blockMaterial; + material = block.getMaterial(); return (material.isLiquid() || !material.isReplaceable()); } @@ -109,12 +104,11 @@ public class yCoordHelper { for (dz = -1; dz <= 1 && isSafe; dz++) { - blockID = chunk.getBlockID(localX + dx, y, localZ + dz); + block = chunk.getBlock(localX + dx, y, localZ + dz); metadata = chunk.getBlockMetadata(localX + dx, y, localZ + dz); - block = Block.blocksList[blockID]; - if (blockID != 0 && (!block.blockMaterial.isReplaceable() || block.blockMaterial.isLiquid())) + if (!block.isAir(world, x, y, z) && (!block.getMaterial().isReplaceable() || block.getMaterial().isLiquid())) { - if (!block.blockMaterial.isReplaceable() && (!block.isOpaqueCube() || block.hasTileEntity(metadata))) + if (!block.getMaterial().isReplaceable() && (!block.isOpaqueCube() || block.hasTileEntity(metadata))) { isSafe = false; } @@ -170,12 +164,11 @@ public class yCoordHelper { for (dz = -1; dz <= 1 && isSafe; dz++) { - blockID = chunk.getBlockID(localX + dx, y, localZ + dz); + block = chunk.getBlock(localX + dx, y, localZ + dz); metadata = chunk.getBlockMetadata(localX + dx, y, localZ + dz); - block = Block.blocksList[blockID]; - if (blockID != 0 && (!block.blockMaterial.isReplaceable() || block.blockMaterial.isLiquid())) + if (!block.isAir(world,x,y,z) && (!block.getMaterial().isReplaceable() || block.getMaterial().isLiquid())) { - if (!block.blockMaterial.isReplaceable() && (!block.isOpaqueCube() || block.hasTileEntity(metadata))) + if (!block.getMaterial().isReplaceable() && (!block.isOpaqueCube() || block.hasTileEntity(metadata))) { if (layers >= 3) { @@ -247,7 +240,7 @@ public class yCoordHelper { for (dz = -1; dz <= 1; dz++, index++) { - if (chunk.getBlockID(localX + dx, y, localZ + dz) != 0) + if (!chunk.getBlock(localX + dx, y, localZ + dz).isAir(world, x+dx,y,z+dz)) { gaps[index] = 0; } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/BaseItemDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/BaseItemDoor.java index 3ad3a4b..600c5c3 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/BaseItemDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/BaseItemDoor.java @@ -5,7 +5,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; @@ -30,14 +30,13 @@ public abstract class BaseItemDoor extends ItemDoor private static DDProperties properties = null; /** - * door represents the non-dimensional door this item is associated with. Leave null for none. - * @param itemID + * door represents the non-dimensional door this item is associated with. Leave null for none. * @param material - * @param door + * @param vanillaDoor */ - public BaseItemDoor(int itemID, Material material, ItemDoor vanillaDoor) + public BaseItemDoor(Material material, ItemDoor vanillaDoor) { - super(itemID, material); + super( material); this.setMaxStackSize(64); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); if (properties == null) @@ -51,7 +50,7 @@ public abstract class BaseItemDoor extends ItemDoor } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } @@ -134,10 +133,10 @@ public abstract class BaseItemDoor extends ItemDoor // side if (side == 1 && !world.isRemote) { - int blockID = world.getBlockId(x, y, z); - if (blockID != 0) + Block block = world.getBlock(x, y, z); + if (!block.isAir(world, x, y, z)) { - if (!Block.blocksList[blockID].isBlockReplaceable(world, x, y, z)) + if (!block.isReplaceable(world, x, y, z)) { y++; } @@ -179,7 +178,7 @@ public abstract class BaseItemDoor extends ItemDoor MovingObjectPosition hit = BaseItemDoor.doRayTrace(player.worldObj, player, true); if (hit != null) { - if (world.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID) + if (world.getBlock(hit.blockX, hit.blockY, hit.blockZ) == mod_pocketDim.blockRift) { DimLink link = PocketManager.getLink(hit.blockX, hit.blockY, hit.blockZ, world.provider.dimensionId); if (link != null) @@ -196,7 +195,7 @@ public abstract class BaseItemDoor extends ItemDoor placeDoorBlock(world, x, y - 1, z, orientation, doorBlock); if (!(stack.getItem() instanceof BaseItemDoor)) { - ((TileEntityDimDoor) world.getBlockTileEntity(x, y, z)).hasGennedPair = true; + ((TileEntityDimDoor) world.getTileEntity(x, y, z)).hasGennedPair = true; } if (!player.capabilities.isCreativeMode) { @@ -213,9 +212,9 @@ public abstract class BaseItemDoor extends ItemDoor public static boolean canPlace(World world, int x, int y, int z) { - int id = world.getBlockId(x, y, z); + Block block = world.getBlock(x, y, z); - return (id == properties.RiftBlockID || id == 0 || Block.blocksList[id].blockMaterial.isReplaceable()); + return (block == mod_pocketDim.blockRift || block.isAir(world, x, y, z) || block.getMaterial().isReplaceable()); } /** @@ -236,7 +235,7 @@ public abstract class BaseItemDoor extends ItemDoor double d1 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double) f + (double) (par1World.isRemote ? par2EntityPlayer.getEyeHeight() - par2EntityPlayer.getDefaultEyeHeight() : par2EntityPlayer.getEyeHeight()); double d2 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double) f; - Vec3 vec3 = par1World.getWorldVec3Pool().getVecFromPool(d0, d1, d2); + Vec3 vec3 = Vec3.createVectorHelper (d0, d1, d2); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); float f5 = -MathHelper.cos(-f1 * 0.017453292F); @@ -249,6 +248,6 @@ public abstract class BaseItemDoor extends ItemDoor d3 = ((EntityPlayerMP) par2EntityPlayer).theItemInWorldManager.getBlockReachDistance(); } Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); - return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); + return par1World.rayTraceBlocks(vec3, vec31, par3); } } \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemBlockDimWall.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemBlockDimWall.java index 50e62fe..434ee1c 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemBlockDimWall.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemBlockDimWall.java @@ -1,22 +1,23 @@ package StevenDimDoors.mod_pocketDim.items; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import StevenDimDoors.mod_pocketDim.mod_pocketDim; public class ItemBlockDimWall extends ItemBlock { - private final static String[] subNames = {"Fabric of Reality", "Ancient Fabric" , "Altered Fabric"}; + private final static String[] subNames = {"tile.blockDimWall", "tile.blockAncientWall" , "tile.blockAlteredWall"}; - public ItemBlockDimWall(int par1) + public ItemBlockDimWall(Block block) { - super(par1); + super(block); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); setHasSubtypes(true); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("tile.", "")); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemDDKey.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemDDKey.java index 78d38cd..3c6a667 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemDDKey.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemDDKey.java @@ -6,7 +6,7 @@ import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; @@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; @@ -29,9 +28,9 @@ public class ItemDDKey extends Item { public static final int TIME_TO_UNLOCK = 30; - public ItemDDKey(int itemID) + public ItemDDKey() { - super(itemID); + super(); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); this.setMaxStackSize(1); @@ -46,16 +45,16 @@ public class ItemDDKey extends Item { if (DDLock.hasCreatedLock(par1ItemStack)) { - par3List.add("Bound"); + par3List.add(StatCollector.translateToLocal("info.riftkey.bound")); } else { - par3List.add("Unbound"); + par3List.add(StatCollector.translateToLocal("info.riftkey.unbound")); } } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } @@ -83,13 +82,13 @@ public class ItemDDKey extends Item return false; } - if (player.getItemInUse() != null) + if (player.inventory.getCurrentItem() != null) { return true; } - int blockID = world.getBlockId(x, y, z); + Block block = world.getBlock(x, y, z); // make sure we are dealing with a door - if (!(Block.blocksList[blockID] instanceof IDimDoor)) + if (!(block instanceof IDimDoor)) { return false; } @@ -146,7 +145,7 @@ public class ItemDDKey extends Item { //Raytrace to make sure we are still looking at a door MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true); - if (pos != null && pos.typeOfHit == EnumMovingObjectType.TILE) + if (pos != null && pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { //make sure we have a link and it has a lock DimLink link = PocketManager.getLink(pos.blockX, pos.blockY, pos.blockZ, player.worldObj); @@ -170,13 +169,13 @@ public class ItemDDKey extends Item * Raytrace to make sure we are still looking at the right block while preparing to remove the lock */ @Override - public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count) + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { // no need to check every tick, twice a second instead if (count % 10 == 0) { MovingObjectPosition pos = getMovingObjectPositionFromPlayer(player.worldObj, player, true); - if (pos != null && pos.typeOfHit == EnumMovingObjectType.TILE) + if (pos != null && pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { DimLink link = PocketManager.getLink(pos.blockX, pos.blockY, pos.blockZ, player.worldObj); if (link != null && link.hasLock()) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemDimensionalDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemDimensionalDoor.java index 18f123d..bb4c69c 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemDimensionalDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemDimensionalDoor.java @@ -12,19 +12,16 @@ import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor; public class ItemDimensionalDoor extends BaseItemDoor { - public ItemDimensionalDoor(int itemID, Material material, ItemDoor door) + public ItemDimensionalDoor(Material material, ItemDoor door) { - super(itemID, material, door); + super(material, door); } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("Place on the block under a rift"); - par3List.add("to activate that rift or place"); - par3List.add("anywhere else to create a"); - par3List.add("pocket dimension."); + mod_pocketDim.translateAndAdd("info.dimDoor",par3List); } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemGoldDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemGoldDimDoor.java index abf9f09..c2114d4 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemGoldDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemGoldDimDoor.java @@ -13,18 +13,16 @@ import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor; public class ItemGoldDimDoor extends BaseItemDoor { - public ItemGoldDimDoor(int itemID, Material material, ItemDoor door) + public ItemGoldDimDoor(Material material, ItemDoor door) { - super(itemID, material, door); + super(material, door); } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("Similar to a Dimensional Door"); - par3List.add("but keeps a pocket dimension"); - par3List.add("loaded if placed on the inside."); + mod_pocketDim.translateAndAdd("info.goldDimDoor", par3List); } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemGoldDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemGoldDoor.java index 252c1b6..74d2933 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemGoldDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemGoldDoor.java @@ -3,7 +3,7 @@ package StevenDimDoors.mod_pocketDim.items; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDoor; import net.minecraft.item.ItemStack; @@ -12,14 +12,14 @@ import net.minecraft.world.World; public class ItemGoldDoor extends ItemDoor { - public ItemGoldDoor(int par1, Material par2Material) + public ItemGoldDoor(Material par2Material) { - super(par1, par2Material); + super(par2Material); this.setMaxStackSize(16); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemPersonalDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemPersonalDoor.java index 02d6b8a..212c4f9 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemPersonalDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemPersonalDoor.java @@ -12,19 +12,16 @@ import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor; public class ItemPersonalDoor extends BaseItemDoor { - public ItemPersonalDoor(int itemID, Material material, ItemDoor door) + public ItemPersonalDoor(Material material, ItemDoor door) { - super(itemID, material, door); + super(material, door); } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("Creates a pathway to"); - par3List.add("Your personal pocket"); - - + mod_pocketDim.translateAndAdd("info.personalDimDoor", par3List); } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemQuartzDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemQuartzDoor.java index 34d226d..71fe975 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemQuartzDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemQuartzDoor.java @@ -3,7 +3,7 @@ package StevenDimDoors.mod_pocketDim.items; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDoor; import net.minecraft.item.ItemStack; @@ -12,13 +12,13 @@ import net.minecraft.world.World; public class ItemQuartzDoor extends ItemDoor { - public ItemQuartzDoor(int par1, Material par2Material) + public ItemQuartzDoor( Material par2Material) { - super(par1, par2Material); + super(par2Material); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java index d846251..03e83ed 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java @@ -4,7 +4,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; @@ -12,7 +12,7 @@ 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; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.AxisAlignedBB; @@ -31,9 +31,9 @@ public class ItemRiftBlade extends ItemSword { private final DDProperties properties; - public ItemRiftBlade(int itemID, DDProperties properties) + public ItemRiftBlade(DDProperties properties) { - super(itemID, EnumToolMaterial.EMERALD); + super(ToolMaterial.EMERALD); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); this.properties = properties; @@ -55,7 +55,7 @@ public class ItemRiftBlade extends ItemSword double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * var4; double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * var4 + 1.62D - par2EntityPlayer.yOffset; double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * var4; - Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11); + Vec3 var13 = Vec3.createVectorHelper(var7, var9, var11); float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI); float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI); float var16 = -MathHelper.cos(-var5 * 0.017453292F); @@ -68,12 +68,12 @@ public class ItemRiftBlade extends ItemSword var21 = 7; } Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21); - return par1World.rayTraceBlocks_do_do(var13, var23, true, false); + return par1World.rayTraceBlocks(var13, var23, true); } private boolean teleportToEntity(ItemStack item, Entity par1Entity, EntityPlayer holder) { - Vec3 var2 = holder.worldObj.getWorldVec3Pool().getVecFromPool(holder.posX - par1Entity.posX, holder.boundingBox.minY + holder.height / 2.0F - par1Entity.posY + par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ); + Vec3 var2 = Vec3.createVectorHelper(holder.posX - par1Entity.posX, holder.boundingBox.minY + holder.height / 2.0F - par1Entity.posY + par1Entity.getEyeHeight(), holder.posZ - par1Entity.posZ); double cooef =( var2.lengthVector()-2.5)/var2.lengthVector(); var2.xCoord*=cooef; @@ -114,7 +114,7 @@ public class ItemRiftBlade extends ItemSword for (EntityLiving ent : list) { Vec3 var3 = player.getLook(1.0F).normalize(); - Vec3 var4 = player.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - player.posX, ent.boundingBox.minY + (ent.height) / 2.0F - ( player.posY + player.getEyeHeight()), ent.posZ - player.posZ); + Vec3 var4 = Vec3.createVectorHelper(ent.posX - player.posX, ent.boundingBox.minY + (ent.height) / 2.0F - ( player.posY + player.getEyeHeight()), ent.posZ - player.posZ); double var5 = var4.lengthVector(); var4 = var4.normalize(); double var7 = var3.dotProduct(var4); @@ -132,7 +132,7 @@ public class ItemRiftBlade extends ItemSword int x = hit.blockX; int y = hit.blockY; int z = hit.blockZ; - if (world.getBlockId(x, y, z) == properties.RiftBlockID) + if (world.getBlock(x, y, z) == mod_pocketDim.blockRift) { if (PocketManager.getLink(x, y, z, world) != null) { @@ -160,7 +160,7 @@ public class ItemRiftBlade extends ItemSword } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } @@ -173,7 +173,7 @@ public class ItemRiftBlade extends ItemSword { //Don't include a call to super.getIsRepairable()! //That would cause this sword to accept diamonds as a repair material (since we set material = Diamond). - return mod_pocketDim.itemStableFabric.itemID == par2ItemStack.itemID ? true : false; + return mod_pocketDim.itemStableFabric == par2ItemStack.getItem() ? true : false; } /** @@ -184,7 +184,6 @@ public class ItemRiftBlade extends ItemSword @SideOnly(Side.CLIENT) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("Opens temporary doors on rifts"); - par3List.add("and has a teleport attack."); + mod_pocketDim.translateAndAdd("info.riftblade", par3List); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftGoggles.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftGoggles.java index dfaedeb..1e6399b 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftGoggles.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftGoggles.java @@ -1,15 +1,14 @@ package StevenDimDoors.mod_pocketDim.items; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.ItemArmor; public class ItemRiftGoggles extends ItemArmor { - public ItemRiftGoggles(int par1, int par2, int par3) + public ItemRiftGoggles(int par2, int par3) { - super(par1, EnumArmorMaterial.IRON, par1, par1); + super(ArmorMaterial.IRON, par2, par3); this.setCreativeTab(CreativeTabs.tabRedstone); // this.setIconIndex(Item.doorWood.getIconFromDamage(0)); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftSignature.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftSignature.java index c3b58d8..fd29e56 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftSignature.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemRiftSignature.java @@ -2,12 +2,13 @@ package StevenDimDoors.mod_pocketDim.items; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -22,9 +23,9 @@ import cpw.mods.fml.relauncher.SideOnly; public class ItemRiftSignature extends Item { - public ItemRiftSignature(int itemID) + public ItemRiftSignature() { - super(itemID); + super(); this.setMaxStackSize(1); this.setMaxDamage(0); this.hasSubtypes = true; @@ -40,7 +41,7 @@ public class ItemRiftSignature extends Item } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } @@ -118,13 +119,11 @@ public class ItemRiftSignature extends Item Point4DOrientation source = getSource(par1ItemStack); if (source != null) { - par3List.add("Leads to (" + source.getX() + ", " + source.getY() + ", " + source.getZ() + ") at dimension #" + source.getDimension()); + par3List.add(StatCollector.translateToLocalFormatted("info.riftSignature.bound", source.getX(), source.getY(), source.getZ(), source.getDimension())); } else { - par3List.add("First click stores a location;"); - par3List.add("second click creates a pair of"); - par3List.add("rifts linking the two locations."); + mod_pocketDim.translateAndAdd("info.riftSignature.unbound", par3List); } } @@ -139,12 +138,12 @@ public class ItemRiftSignature extends Item public static int adjustYForSpecialBlocks(World world, int x, int y, int z) { int targetY = y - 2; // Get the block the player actually clicked on - Block block = Block.blocksList[world.getBlockId(x, targetY, z)]; + Block block = world.getBlock(x, targetY, z); if (block == null) { return targetY + 2; } - if (block.isBlockReplaceable(world, x, targetY, z)) + if (block.isReplaceable(world, x, targetY, z)) { return targetY + 1; // Move block placement down (-2+1) one so its directly over things like snow } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java index f97bb8c..63801ac 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java @@ -1,11 +1,14 @@ package StevenDimDoors.mod_pocketDim.items; import java.util.List; -import net.minecraft.client.renderer.texture.IconRegister; + +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -18,13 +21,13 @@ import cpw.mods.fml.relauncher.SideOnly; public class ItemStabilizedRiftSignature extends ItemRiftSignature { - public ItemStabilizedRiftSignature(int itemID) + public ItemStabilizedRiftSignature() { - super(itemID); + super(); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } @@ -74,7 +77,7 @@ public class ItemStabilizedRiftSignature extends ItemRiftSignature // Check if the player is in creative mode, // or if the player can pay with an Ender Pearl to create a rift. if (!player.capabilities.isCreativeMode && - !player.inventory.consumeInventoryItem(Item.enderPearl.itemID)) + !player.inventory.consumeInventoryItem(Items.ender_pearl)) { mod_pocketDim.sendChat(player, "You don't have any Ender Pearls!"); // I won't do this, but this is the chance to localize chat @@ -167,13 +170,12 @@ public class ItemStabilizedRiftSignature extends ItemRiftSignature Point4DOrientation source = getSource(par1ItemStack); if (source != null) { - par3List.add("Leads to (" + source.getX() + ", " + source.getY() + ", " + source.getZ() + ") at dimension #" + source.getDimension()); + String text = StatCollector.translateToLocalFormatted("info.riftSignature.bound", source.getX(), source.getY(), source.getZ(), source.getDimension()); + par3List.add(text); } else { - par3List.add("First click stores a location,"); - par3List.add("other clicks create rifts linking"); - par3List.add("the first and last locations together."); + mod_pocketDim.translateAndAdd("info.riftSignature.stable", par3List); } } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java index 3e283b4..a1d0b31 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java @@ -1,19 +1,19 @@ package StevenDimDoors.mod_pocketDim.items; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import StevenDimDoors.mod_pocketDim.mod_pocketDim; public class ItemStableFabric extends Item { - public ItemStableFabric(int itemID, int par2) + public ItemStableFabric(int par2) { - super(itemID); + super(); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemUnstableDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemUnstableDoor.java index e51bcaa..aad3e52 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemUnstableDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemUnstableDoor.java @@ -6,22 +6,23 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDoor; import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor; public class ItemUnstableDoor extends BaseItemDoor { - public ItemUnstableDoor(int itemID, Material material, ItemDoor door) + public ItemUnstableDoor(Material material, ItemDoor door) { - super(itemID, material, door); + super( material, door); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("Caution: Leads to random destination"); + par3List.add(StatCollector.translateToLocal("info.chaosDoor")); } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemWarpDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemWarpDoor.java index 403bbc1..206dc24 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemWarpDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemWarpDoor.java @@ -12,19 +12,16 @@ import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor; public class ItemWarpDoor extends BaseItemDoor { - public ItemWarpDoor(int itemID, Material material, ItemDoor door) + public ItemWarpDoor(Material material, ItemDoor door) { - super(itemID, material, door); + super(material, door); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("Place on the block under"); - par3List.add("a rift to create a portal,"); - par3List.add("or place anywhere in a"); - par3List.add("pocket dimension to exit."); + mod_pocketDim.translateAndAdd("info.warpDoor",par3List); } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemWorldThread.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemWorldThread.java index 91162c2..b4a354a 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemWorldThread.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/ItemWorldThread.java @@ -1,19 +1,19 @@ package StevenDimDoors.mod_pocketDim.items; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import StevenDimDoors.mod_pocketDim.mod_pocketDim; public class ItemWorldThread extends Item { - public ItemWorldThread(int itemID) + public ItemWorldThread() { - super(itemID); + super(); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/behaviors/DispenserBehaviorStabilizedRS.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/behaviors/DispenserBehaviorStabilizedRS.java index f79fe26..b304d26 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/behaviors/DispenserBehaviorStabilizedRS.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/behaviors/DispenserBehaviorStabilizedRS.java @@ -18,7 +18,7 @@ public class DispenserBehaviorStabilizedRS extends BehaviorDefaultDispenseItem int x = dispenser.getXInt(); int y = dispenser.getYInt(); int z = dispenser.getZInt(); - EnumFacing facing = BlockDispenser.getFacing(dispenser.getBlockMetadata()); + EnumFacing facing = BlockDispenser.func_149937_b(dispenser.getBlockMetadata()); int dx = facing.getFrontOffsetX(); int dy = facing.getFrontOffsetY(); int dz = facing.getFrontOffsetZ(); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/items/itemRiftRemover.java b/src/main/java/StevenDimDoors/mod_pocketDim/items/itemRiftRemover.java index e1ecef9..8d380dc 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/items/itemRiftRemover.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/items/itemRiftRemover.java @@ -3,7 +3,7 @@ package StevenDimDoors.mod_pocketDim.items; import java.util.List; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -21,16 +21,16 @@ import cpw.mods.fml.relauncher.SideOnly; public class itemRiftRemover extends Item { - public itemRiftRemover(int itemID, Material par2Material) + public itemRiftRemover(Material par2Material) { - super(itemID); + super(); this.setMaxStackSize(1); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); this.setMaxDamage(4); } @Override - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName().replace("item.", "")); } @@ -56,7 +56,7 @@ public class itemRiftRemover extends Item int hz = hit.blockZ; NewDimData dimension = PocketManager.createDimensionData(world); DimLink link = dimension.getLink(hx, hy, hz); - if (world.getBlockId(hx, hy, hz) == mod_pocketDim.blockRift.blockID && link != null && + if (world.getBlock(hx, hy, hz) == mod_pocketDim.blockRift && link != null && player.canPlayerEdit(hx, hy, hz, hit.sideHit, stack)) { // Invoke onPlayerRightClick() @@ -87,15 +87,15 @@ public class itemRiftRemover extends Item NewDimData dimension = PocketManager.createDimensionData(world); DimLink link = dimension.getLink(x, y, z); - if (world.getBlockId(x, y, z) == mod_pocketDim.blockRift.blockID && link != null && + if (world.getBlock(x, y, z) == mod_pocketDim.blockRift && link != null && player.canPlayerEdit(x, y, z, side, stack)) { // Tell the rift's tile entity to do its removal animation - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity != null && tileEntity instanceof TileEntityRift) { ((TileEntityRift) tileEntity).shouldClose = true; - tileEntity.onInventoryChanged(); + tileEntity.markDirty(); } else if (!world.isRemote) { @@ -130,8 +130,6 @@ public class itemRiftRemover extends Item @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("Use near exposed rift"); - par3List.add("to remove it and"); - par3List.add("any nearby rifts."); + mod_pocketDim.translateAndAdd("info.riftRemover",par3List); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index b4d6069..d5544ac 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -1,16 +1,23 @@ package StevenDimDoors.mod_pocketDim; import java.io.File; +import java.util.List; + +import StevenDimDoors.mod_pocketDim.network.DimDoorsNetwork; +import StevenDimDoors.mod_pocketDim.schematic.BlockRotator; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.event.*; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityList; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemDoor; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatMessageComponent; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.StatCollector; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.ForgeChunkManager; @@ -65,7 +72,6 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoorGold; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor; -import StevenDimDoors.mod_pocketDim.util.l_systems.LSystem; import StevenDimDoors.mod_pocketDim.world.BiomeGenLimbo; import StevenDimDoors.mod_pocketDim.world.BiomeGenPocket; import StevenDimDoors.mod_pocketDim.world.DDBiomeGenBase; @@ -74,35 +80,19 @@ import StevenDimDoors.mod_pocketDim.world.LimboProvider; import StevenDimDoors.mod_pocketDim.world.PersonalPocketProvider; import StevenDimDoors.mod_pocketDim.world.PocketProvider; import StevenDimDoors.mod_pocketDim.world.gateways.GatewayGenerator; -import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerAboutToStartEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; -import cpw.mods.fml.common.event.FMLServerStoppedEvent; -import cpw.mods.fml.common.network.NetworkMod; -import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.common.registry.TickRegistry; import cpw.mods.fml.relauncher.Side; @Mod(modid = mod_pocketDim.modid, name = "Dimensional Doors", version = mod_pocketDim.version) - -@NetworkMod(clientSideRequired = true, serverSideRequired = false, connectionHandler=ConnectionHandler.class, -clientPacketHandlerSpec = -@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ClientPacketHandler.class), -serverPacketHandlerSpec = -@SidedPacketHandler(channels = {PacketConstants.CHANNEL_NAME}, packetHandler = ServerPacketHandler.class)) public class mod_pocketDim { - public static final String version = "@VERSION@"; + public static final String version = "2.2.5-test"; public static final String modid = "dimdoors"; //TODO need a place to stick all these constants @@ -148,8 +138,6 @@ public class mod_pocketDim public static BiomeGenBase limboBiome; public static BiomeGenBase pocketBiome; - public static boolean isPlayerWearingGoogles = false; - public static DDProperties properties; public static DDWorldProperties worldProperties; public static CustomLimboPopulator spawner; //Added this field temporarily. Will be refactored out later. @@ -167,15 +155,9 @@ public class mod_pocketDim public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab") { @Override - public ItemStack getIconItemStack() + public Item getTabIconItem() { - return new ItemStack(mod_pocketDim.itemDimensionalDoor, 1, 0); - } - - @Override - public String getTranslatedTabLabel() - { - return "Dimensional Doors"; + return mod_pocketDim.itemDimensionalDoor; } }; @@ -191,6 +173,10 @@ public class mod_pocketDim hooks = new EventHookContainer(properties); MinecraftForge.EVENT_BUS.register(hooks); MinecraftForge.TERRAIN_GEN_BUS.register(hooks); + + proxy.registerSidedHooks(properties); + + DimDoorsNetwork.init(); } @EventHandler @@ -198,42 +184,42 @@ public class mod_pocketDim { // Initialize ServerTickHandler instance serverTickHandler = new ServerTickHandler(); - TickRegistry.registerTickHandler(serverTickHandler, Side.SERVER); + FMLCommonHandler.instance().bus().register(serverTickHandler); // Initialize LimboDecay instance: required for BlockLimbo limboDecay = new LimboDecay(properties); // Initialize blocks and items - transientDoor = new TransientDoor(properties.TransientDoorID, Material.iron, properties).setHardness(1.0F) .setUnlocalizedName("transientDoor"); - goldenDimensionalDoor = new BlockGoldDimDoor(properties.GoldenDimensionalDoorID, Material.iron, properties).setHardness(1.0F) .setUnlocalizedName("dimDoorGold"); + transientDoor = new TransientDoor(Material.iron, properties).setHardness(1.0F) .setBlockName("transientDoor"); + goldenDimensionalDoor = new BlockGoldDimDoor(Material.iron, properties).setHardness(1.0F).setBlockName("dimDoorGold").setBlockTextureName("itemGoldDimDoor"); - quartzDoor = new BlockDoorQuartz(properties.QuartzDoorID, Material.rock).setHardness(0.1F).setUnlocalizedName("doorQuartz"); - personalDimDoor = new PersonalDimDoor(properties.PersonalDimDoorID, Material.rock,properties).setHardness(0.1F).setUnlocalizedName("dimDoorPersonal"); + quartzDoor = new BlockDoorQuartz(Material.rock).setHardness(0.1F).setBlockName("doorQuartz").setBlockTextureName("itemQuartzDoor"); + personalDimDoor = new PersonalDimDoor(Material.rock,properties).setHardness(0.1F).setBlockName("dimDoorPersonal").setBlockTextureName("itemQuartzDimDoor"); - goldenDoor = new BlockDoorGold(properties.GoldenDoorID, Material.iron).setHardness(0.1F).setUnlocalizedName("doorGold"); - blockDimWall = new BlockDimWall(properties.FabricBlockID, 0, Material.iron).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall"); - blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm"); - warpDoor = new WarpDoor(properties.WarpDoorID, Material.wood, properties).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp"); - blockRift = (BlockRift) (new BlockRift(properties.RiftBlockID, 0, Material.air, properties).setHardness(1.0F) .setUnlocalizedName("rift")); - blockLimbo = new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID, limboDecay).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F); - unstableDoor = (new UnstableDoor(properties.UnstableDoorID, Material.iron, properties).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) ); - dimensionalDoor = (DimensionalDoor) (new DimensionalDoor(properties.DimensionalDoorID, Material.iron, properties).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor")); - transTrapdoor = (TransTrapdoor) (new TransTrapdoor(properties.TransTrapdoorID, Material.wood).setHardness(1.0F) .setUnlocalizedName("dimHatch")); + goldenDoor = new BlockDoorGold(Material.iron).setHardness(0.1F).setBlockName("doorGold").setBlockTextureName("itemGoldDoor"); + blockDimWall = new BlockDimWall(0, Material.iron).setLightLevel(1.0F).setHardness(0.1F).setBlockName("blockDimWall"); + blockDimWallPerm = (new BlockDimWallPerm(0, Material.iron)).setLightLevel(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setBlockName("blockDimWallPerm"); + warpDoor = new WarpDoor(Material.wood, properties).setHardness(1.0F) .setBlockName("dimDoorWarp").setBlockTextureName("itemDimDoorWarp"); + blockLimbo = new BlockLimbo(15, Material.iron, properties.LimboDimensionID, limboDecay).setHardness(.2F).setBlockName("BlockLimbo").setLightLevel(.0F); + unstableDoor = (new UnstableDoor(Material.iron, properties).setHardness(.2F).setBlockName("chaosDoor").setLightLevel(.0F).setBlockTextureName("itemChaosDoor") ); + dimensionalDoor = (DimensionalDoor) (new DimensionalDoor(Material.iron, properties).setHardness(1.0F).setResistance(2000.0F) .setBlockName("dimDoor").setBlockTextureName("itemDimDoor")); + transTrapdoor = (TransTrapdoor) (new TransTrapdoor(Material.wood).setHardness(1.0F) .setBlockName("dimHatch")); + blockRift = (BlockRift) (new BlockRift(Material.fire, properties).setHardness(1.0F) .setBlockName("rift")); - itemDDKey = (new ItemDDKey(properties.DDKeyItemID)).setUnlocalizedName("itemDDKey"); - itemQuartzDoor = (new ItemQuartzDoor(properties.QuartzDoorID, Material.rock)).setUnlocalizedName("itemQuartzDoor"); - itemPersonalDoor = (new ItemPersonalDoor(properties.PersonalDimDoorID, Material.rock, (ItemDoor)this.itemQuartzDoor)).setUnlocalizedName("itemQuartzDimDoor"); - itemGoldenDoor = (new ItemGoldDoor(properties.GoldenDoorItemID, Material.wood)).setUnlocalizedName("itemGoldDoor"); - itemGoldenDimensionalDoor = (new ItemGoldDimDoor(properties.GoldenDimensionalDoorItemID, Material.iron, (ItemDoor)this.itemGoldenDoor)).setUnlocalizedName("itemGoldDimDoor"); - itemDimensionalDoor = (ItemDimensionalDoor) (new ItemDimensionalDoor(properties.DimensionalDoorItemID, Material.iron, (ItemDoor)Item.doorIron)).setUnlocalizedName("itemDimDoor"); - itemWarpDoor = (new ItemWarpDoor(properties.WarpDoorItemID, Material.wood,(ItemDoor)Item.doorWood)).setUnlocalizedName("itemDimDoorWarp"); - itemRiftSignature = (new ItemRiftSignature(properties.RiftSignatureItemID)).setUnlocalizedName("itemLinkSignature"); - itemRiftRemover = (new itemRiftRemover(properties.RiftRemoverItemID, Material.wood)).setUnlocalizedName("itemRiftRemover"); - itemStableFabric = (new ItemStableFabric(properties.StableFabricItemID, 0)).setUnlocalizedName("itemStableFabric"); - itemUnstableDoor = (new ItemUnstableDoor(properties.UnstableDoorItemID, Material.iron, null)).setUnlocalizedName("itemChaosDoor"); - itemRiftBlade = (new ItemRiftBlade(properties.RiftBladeItemID, properties)).setUnlocalizedName("ItemRiftBlade"); - itemStabilizedRiftSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig"); - itemWorldThread = (new ItemWorldThread(properties.WorldThreadItemID)).setUnlocalizedName("itemWorldThread"); + itemDDKey = (new ItemDDKey()).setUnlocalizedName("itemDDKey"); + itemQuartzDoor = (new ItemQuartzDoor(Material.rock)).setUnlocalizedName("itemQuartzDoor"); + itemPersonalDoor = (new ItemPersonalDoor(Material.rock, (ItemDoor)this.itemQuartzDoor)).setUnlocalizedName("itemQuartzDimDoor"); + itemGoldenDoor = (new ItemGoldDoor(Material.wood)).setUnlocalizedName("itemGoldDoor"); + itemGoldenDimensionalDoor = (new ItemGoldDimDoor(Material.iron, (ItemDoor)this.itemGoldenDoor)).setUnlocalizedName("itemGoldDimDoor"); + itemDimensionalDoor = (ItemDimensionalDoor) (new ItemDimensionalDoor(Material.iron, (ItemDoor) Items.iron_door)).setUnlocalizedName("itemDimDoor"); + itemWarpDoor = (new ItemWarpDoor(Material.wood,(ItemDoor)Items.iron_door)).setUnlocalizedName("itemDimDoorWarp"); + itemRiftSignature = (new ItemRiftSignature()).setUnlocalizedName("itemLinkSignature"); + itemRiftRemover = (new itemRiftRemover(Material.wood)).setUnlocalizedName("itemRiftRemover"); + itemStableFabric = (new ItemStableFabric(0)).setUnlocalizedName("itemStableFabric"); + itemUnstableDoor = (new ItemUnstableDoor(Material.iron, null)).setUnlocalizedName("itemChaosDoor"); + itemRiftBlade = (new ItemRiftBlade(properties)).setUnlocalizedName("ItemRiftBlade"); + itemStabilizedRiftSignature = (new ItemStabilizedRiftSignature()).setUnlocalizedName("itemStabilizedRiftSig"); + itemWorldThread = (new ItemWorldThread()).setUnlocalizedName("itemWorldThread"); // Check if other biomes have been registered with the same IDs we want. If so, crash Minecraft // to notify the user instead of letting it pass and conflicting with Biomes o' Plenty. @@ -243,21 +229,37 @@ public class mod_pocketDim mod_pocketDim.limboBiome = (new BiomeGenLimbo(properties.LimboBiomeID)); mod_pocketDim.pocketBiome = (new BiomeGenPocket(properties.PocketBiomeID)); - GameRegistry.registerBlock(quartzDoor, "Quartz Door"); - GameRegistry.registerBlock(personalDimDoor, "Personal Dimensional Door"); - GameRegistry.registerBlock(goldenDoor, "Golden Door"); - GameRegistry.registerBlock(goldenDimensionalDoor, "Golden Dimensional Door"); - GameRegistry.registerBlock(unstableDoor, "Unstable Door"); - GameRegistry.registerBlock(warpDoor, "Warp Door"); + GameRegistry.registerBlock(quartzDoor, null, "Quartz Door"); + GameRegistry.registerBlock(personalDimDoor, null, "Personal Dimensional Door"); + GameRegistry.registerBlock(goldenDoor, null, "Golden Door"); + GameRegistry.registerBlock(goldenDimensionalDoor, null, "Golden Dimensional Door"); + GameRegistry.registerBlock(unstableDoor, null, "Unstable Door"); + GameRegistry.registerBlock(warpDoor, null, "Warp Door"); GameRegistry.registerBlock(blockRift, "Rift"); GameRegistry.registerBlock(blockLimbo, "Unraveled Fabric"); - GameRegistry.registerBlock(dimensionalDoor, "Dimensional Door"); + GameRegistry.registerBlock(dimensionalDoor, null, "Dimensional Door"); GameRegistry.registerBlock(transTrapdoor,"Transdimensional Trapdoor"); GameRegistry.registerBlock(blockDimWallPerm, "Fabric of RealityPerm"); GameRegistry.registerBlock(transientDoor, "transientDoor"); + GameRegistry.registerItem(itemDDKey, "Rift Key"); + GameRegistry.registerItem(itemQuartzDoor, "Quartz Door Item"); + GameRegistry.registerItem(itemPersonalDoor, "Personal Dimensional Door Item"); + GameRegistry.registerItem(itemGoldenDoor, "Golden Door Item"); + GameRegistry.registerItem(itemGoldenDimensionalDoor, "Golden Dimensional Door Item"); + GameRegistry.registerItem(itemDimensionalDoor, "Dimensional Door Item"); + GameRegistry.registerItem(itemWarpDoor, "Warp Door Item"); + GameRegistry.registerItem(itemRiftSignature, "Rift Signature"); + GameRegistry.registerItem(itemRiftRemover, "Rift Remover"); + GameRegistry.registerItem(itemStableFabric, "Stable Fabric Item"); + GameRegistry.registerItem(itemUnstableDoor, "Unstable Door Item"); + GameRegistry.registerItem(itemRiftBlade, "Rift Blade"); + GameRegistry.registerItem(itemStabilizedRiftSignature, "Stabilized Rift Signature"); + GameRegistry.registerItem(itemWorldThread, "World Thread"); GameRegistry.registerBlock(blockDimWall, ItemBlockDimWall.class, "Fabric of Reality"); + BlockRotator.setupOrientations(); + if (!DimensionManager.registerProviderType(properties.PocketProviderID, PocketProvider.class, false)) throw new IllegalStateException("There is a provider ID conflict between PocketProvider from Dimensional Doors and another provider type. Fix your configuration!"); if (!DimensionManager.registerProviderType(properties.LimboProviderID, LimboProvider.class, false)) @@ -266,98 +268,41 @@ public class mod_pocketDim throw new IllegalStateException("There is a provider ID conflict between PersonalPocketProvider from Dimensional Doors and another provider type. Fix your configuration!"); DimensionManager.registerDimension(properties.LimboDimensionID, properties.LimboProviderID); - - LanguageRegistry.addName(goldenDoor, "Golden Door"); - LanguageRegistry.addName(goldenDimensionalDoor, "Golden Dimensional Door"); - LanguageRegistry.addName(transientDoor , "Transient Door"); - LanguageRegistry.addName(blockRift , "Rift"); - LanguageRegistry.addName(blockLimbo , "Unraveled Fabric"); - LanguageRegistry.addName(warpDoor , "Warp Door"); - LanguageRegistry.addName(unstableDoor , "Unstable Door"); - LanguageRegistry.addName(blockDimWall , "Fabric of Reality"); - LanguageRegistry.addName(blockDimWallPerm , "Eternal Fabric"); - LanguageRegistry.addName(dimensionalDoor, "Dimensional Door"); - LanguageRegistry.addName(transTrapdoor, "Transdimensional Trapdoor"); - LanguageRegistry.addName(itemWarpDoor, "Warp Door"); - LanguageRegistry.addName(itemRiftSignature, "Rift Signature"); - LanguageRegistry.addName(itemGoldenDoor, "Golden Door"); - LanguageRegistry.addName(itemGoldenDimensionalDoor, "Golden Dimensional Door"); - LanguageRegistry.addName(itemStabilizedRiftSignature, "Stabilized Rift Signature"); - LanguageRegistry.addName(itemRiftRemover, "Rift Remover"); - LanguageRegistry.addName(itemStableFabric, "Stable Fabric"); - LanguageRegistry.addName(itemUnstableDoor, "Unstable Door"); - LanguageRegistry.addName(itemDimensionalDoor, "Dimensional Door"); - LanguageRegistry.addName(itemRiftBlade, "Rift Blade"); - LanguageRegistry.addName(itemWorldThread, "World Thread"); - LanguageRegistry.addName(itemDDKey, "Rift Key"); - LanguageRegistry.addName(itemQuartzDoor, "Quartz Door"); - LanguageRegistry.addName(itemPersonalDoor, "Personal Dimensional Door"); - - - /** - * Add names for multiblock inventory item - */ - LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 0), "Fabric of Reality"); - LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 1), "Ancient Fabric"); - LanguageRegistry.addName(new ItemStack(blockDimWall, 1, 2), "Altered Fabric"); - - LanguageRegistry.instance().addStringLocalization("itemGroup.dimDoorsCustomTab", "en_US", "Dimensional Doors Items"); - - GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor"); - GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift"); - GameRegistry.registerTileEntity(TileEntityTransTrapdoor.class, "TileEntityDimHatch"); - GameRegistry.registerTileEntity(TileEntityDimDoorGold.class, "TileEntityDimDoorGold"); + GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor"); + GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift"); + GameRegistry.registerTileEntity(TileEntityTransTrapdoor.class, "TileEntityDimHatch"); + GameRegistry.registerTileEntity(TileEntityDimDoorGold.class, "TileEntityDimDoorGold"); EntityRegistry.registerModEntity(MobMonolith.class, "Monolith", properties.MonolithEntityID, this, 70, 1, true); EntityList.IDtoClassMapping.put(properties.MonolithEntityID, MobMonolith.class); - EntityList.entityEggs.put(properties.MonolithEntityID, new EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff)); - LanguageRegistry.instance().addStringLocalization("entity.dimdoors.Monolith.name", "Monolith"); + EntityList.entityEggs.put(properties.MonolithEntityID, new EntityList.EntityEggInfo(properties.MonolithEntityID, 0, 0xffffff)); CraftingManager.registerRecipes(properties); CraftingManager.registerDispenserBehaviors(); - GameRegistry.registerCraftingHandler(new CraftingManager()); + FMLCommonHandler.instance().bus().register(new CraftingManager()); DungeonHelper.initialize(); gatewayGenerator = new GatewayGenerator(properties); - GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator); + GameRegistry.registerWorldGenerator(mod_pocketDim.gatewayGenerator, 0); // Register loot chests DDLoot.registerInfo(properties); proxy.loadTextures(); proxy.registerRenderers(); - - LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 4); - LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 5); - // LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 6); //degenerate - LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 7); - // LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 8); - // LSystem.generateLSystem("terdragon", LSystem.TERDRAGON, 9); - - - // LSystem.generateLSystem("vortex", LSystem.VORTEX, 8); - LSystem.generateLSystem("vortex", LSystem.VORTEX, 9); - LSystem.generateLSystem("vortex", LSystem.VORTEX, 10); - LSystem.generateLSystem("vortex", LSystem.VORTEX, 11); - // LSystem.generateLSystem("vortex", LSystem.VORTEX, 12); - - LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 7); - LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 8); - LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 9); - LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 10); - // LSystem.generateLSystem("twindragon", LSystem.TWINDRAGON, 11); - - - LSystem.generateLSystem("dragon", LSystem.DRAGON, 8); - LSystem.generateLSystem("dragon", LSystem.DRAGON, 9); - LSystem.generateLSystem("dragon", LSystem.DRAGON, 10); - LSystem.generateLSystem("dragon", LSystem.DRAGON, 11); - // LSystem.generateLSystem("dragon", LSystem.DRAGON, 12); - // LSystem.generateLSystem("dragon", LSystem.DRAGON, 13); - - + FMLCommonHandler.instance().bus().register(new ConnectionHandler()); } + public static void translateAndAdd(String key, List list) { + for (int i=0;i<10;i++) { + if (StatCollector.canTranslate(key+Integer.toString(i))) { + String line = StatCollector.translateToLocal(key + Integer.toString(i)); + list.add(line); + } else + break; + } + } + @EventHandler public void onPostInitialization(FMLPostInitializationEvent event) { @@ -442,8 +387,7 @@ public class mod_pocketDim public static void sendChat(EntityPlayer player, String message) { - ChatMessageComponent cmp = new ChatMessageComponent(); - cmp.addText(message); - player.sendChatToPlayer(cmp); + ChatComponentText text = new ChatComponentText(message); + player.addChatComponentMessage(text); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/network/ClientJoinPacket.java b/src/main/java/StevenDimDoors/mod_pocketDim/network/ClientJoinPacket.java new file mode 100644 index 0000000..98e790f --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDim/network/ClientJoinPacket.java @@ -0,0 +1,44 @@ +package StevenDimDoors.mod_pocketDim.network; + +import StevenDimDoors.mod_pocketDim.core.NewDimData; +import StevenDimDoors.mod_pocketDim.core.PocketManager; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.world.World; + +import java.io.IOException; + +public class ClientJoinPacket extends DimDoorsPacket { + @Override + public void write(ByteArrayDataOutput out) { + try { + PocketManager.writePacket(out); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + @Override + public void read(ByteArrayDataInput in) { + try { + PocketManager.readPacket(in); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + @Override + public void handleClient(World world, EntityPlayer player) { + NewDimData dimensionData = PocketManager.getDimensionData(player.worldObj); + + if (dimensionData.isPocketDimension()) + player.worldObj.provider.registerWorld(player.worldObj); + } + + @Override + public void handleServer(World world, EntityPlayerMP player) { + + } +} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/network/CreateDimensionPacket.java b/src/main/java/StevenDimDoors/mod_pocketDim/network/CreateDimensionPacket.java new file mode 100644 index 0000000..c035550 --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDim/network/CreateDimensionPacket.java @@ -0,0 +1,50 @@ +package StevenDimDoors.mod_pocketDim.network; + +import StevenDimDoors.mod_pocketDim.core.PocketManager; +import StevenDimDoors.mod_pocketDim.watcher.ClientDimData; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.world.World; + +import java.io.IOException; + +public class CreateDimensionPacket extends DimDoorsPacket { + private ClientDimData dimensionData = null; + + public CreateDimensionPacket() {} + public CreateDimensionPacket(ClientDimData data) { + this.dimensionData = data; + } + + @Override + public void write(ByteArrayDataOutput out) { + if (dimensionData != null) { + try { + dimensionData.write(out); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + @Override + public void read(ByteArrayDataInput in) { + try { + dimensionData = ClientDimData.read(in); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + @Override + public void handleClient(World world, EntityPlayer player) { + PocketManager.getDimwatcher().onCreated(dimensionData); + } + + @Override + public void handleServer(World world, EntityPlayerMP player) { + //Shouldn't be here + } +} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/network/CreateLinkPacket.java b/src/main/java/StevenDimDoors/mod_pocketDim/network/CreateLinkPacket.java new file mode 100644 index 0000000..2211b33 --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDim/network/CreateLinkPacket.java @@ -0,0 +1,53 @@ +package StevenDimDoors.mod_pocketDim.network; + +import StevenDimDoors.mod_pocketDim.core.PocketManager; +import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.world.World; + +import java.io.IOException; + +public class CreateLinkPacket extends DimDoorsPacket { + + private ClientLinkData clientLinkData = null; + + public CreateLinkPacket() { + } + + public CreateLinkPacket(ClientLinkData data) { + this.clientLinkData = data; + } + + @Override + public void write(ByteArrayDataOutput out) { + if (clientLinkData != null) { + try { + clientLinkData.write(out); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + @Override + public void read(ByteArrayDataInput in) { + try { + clientLinkData = ClientLinkData.read(in); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + @Override + public void handleClient(World world, EntityPlayer player) { + PocketManager.getLinkWatcher().onCreated(clientLinkData); + } + + @Override + public void handleServer(World world, EntityPlayerMP player) { + //Shouldn't be here + } +} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/network/DeleteDimensionPacket.java b/src/main/java/StevenDimDoors/mod_pocketDim/network/DeleteDimensionPacket.java new file mode 100644 index 0000000..d2c9137 --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDim/network/DeleteDimensionPacket.java @@ -0,0 +1,50 @@ +package StevenDimDoors.mod_pocketDim.network; + +import StevenDimDoors.mod_pocketDim.core.PocketManager; +import StevenDimDoors.mod_pocketDim.watcher.ClientDimData; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.world.World; + +import java.io.IOException; + +public class DeleteDimensionPacket extends DimDoorsPacket { + private ClientDimData dimensionData = null; + + public DeleteDimensionPacket() {} + public DeleteDimensionPacket(ClientDimData dimensionData) { + this.dimensionData = dimensionData; + } + + @Override + public void write(ByteArrayDataOutput out) { + if (dimensionData != null) { + try { + dimensionData.write(out); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + @Override + public void read(ByteArrayDataInput in) { + try { + dimensionData = ClientDimData.read(in); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + @Override + public void handleClient(World world, EntityPlayer player) { + PocketManager.getDimwatcher().onDeleted(dimensionData); + } + + @Override + public void handleServer(World world, EntityPlayerMP player) { + //Shouldn't be here + } +} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/network/DeleteLinkPacket.java b/src/main/java/StevenDimDoors/mod_pocketDim/network/DeleteLinkPacket.java new file mode 100644 index 0000000..e3d00cb --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDim/network/DeleteLinkPacket.java @@ -0,0 +1,51 @@ +package StevenDimDoors.mod_pocketDim.network; + +import StevenDimDoors.mod_pocketDim.core.PocketManager; +import StevenDimDoors.mod_pocketDim.watcher.ClientDimData; +import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.world.World; + +import java.io.IOException; + +public class DeleteLinkPacket extends DimDoorsPacket { + private ClientLinkData linkData; + + public DeleteLinkPacket() {} + public DeleteLinkPacket(ClientLinkData linkData) { + this.linkData = linkData; + } + + @Override + public void write(ByteArrayDataOutput out) { + if (linkData != null) { + try { + linkData.write(out); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + @Override + public void read(ByteArrayDataInput in) { + try { + linkData = ClientLinkData.read(in); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + @Override + public void handleClient(World world, EntityPlayer player) { + PocketManager.getLinkWatcher().onDeleted(linkData); + } + + @Override + public void handleServer(World world, EntityPlayerMP player) { + //Shouldn't be here + } +} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/network/DimDoorsNetwork.java b/src/main/java/StevenDimDoors/mod_pocketDim/network/DimDoorsNetwork.java new file mode 100644 index 0000000..e935164 --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDim/network/DimDoorsNetwork.java @@ -0,0 +1,97 @@ +package StevenDimDoors.mod_pocketDim.network; + +import com.google.common.collect.Maps; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.network.FMLEmbeddedChannel; +import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec; +import cpw.mods.fml.common.network.FMLOutboundHandler; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.tileentity.TileEntity; + +import java.util.EnumMap; + +@ChannelHandler.Sharable +public class DimDoorsNetwork extends FMLIndexedMessageToMessageCodec { + + private static final DimDoorsNetwork INSTANCE = new DimDoorsNetwork(); + private static final EnumMap channels = Maps.newEnumMap(Side.class); + + public static void init() { + if (!channels.isEmpty()) + return; + + INSTANCE.addDiscriminator(0, ClientJoinPacket.class); + INSTANCE.addDiscriminator(1, CreateDimensionPacket.class); + INSTANCE.addDiscriminator(2, DeleteDimensionPacket.class); + INSTANCE.addDiscriminator(3, CreateLinkPacket.class); + INSTANCE.addDiscriminator(4, DeleteLinkPacket.class); + INSTANCE.addDiscriminator(5, UpdateLinkPacket.class); + + channels.putAll(NetworkRegistry.INSTANCE.newChannel("DimDoors", INSTANCE)); + } + + public void encodeInto(ChannelHandlerContext ctx, DimDoorsPacket msg, ByteBuf target) throws Exception { + ByteArrayDataOutput out = ByteStreams.newDataOutput(); + msg.write(out); + target.writeBytes(out.toByteArray()); + } + + @Override + public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, DimDoorsPacket msg) { + ByteArrayDataInput in = ByteStreams.newDataInput(source.array()); + + in.skipBytes(1); + msg.read(in); + + if (FMLCommonHandler.instance().getEffectiveSide().isClient()) + handleClient(msg); + else + handleServer(ctx, msg); + } + + @SideOnly(Side.CLIENT) + private void handleClient(DimDoorsPacket msg) { + msg.handleClient(Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer); + } + + private void handleServer(ChannelHandlerContext ctx, DimDoorsPacket msg) { + EntityPlayerMP player = ((NetHandlerPlayServer)ctx.channel().attr(NetworkRegistry.NET_HANDLER).get()).playerEntity; + msg.handleServer(player.worldObj, player); + } + + public static void sendToAllPlayers(DimDoorsPacket packet) { + channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); + channels.get(Side.SERVER).writeAndFlush(packet); + } + + public static void sendToServer(DimDoorsPacket packet) { + channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER); + channels.get(Side.CLIENT).writeAndFlush(packet); + } + + public static void sendToPlayer(DimDoorsPacket packet, EntityPlayer player) { + channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); + channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); + channels.get(Side.SERVER).writeAndFlush(packet); + } + + public static void sendToVicinity(DimDoorsPacket packet, TileEntity entity, double distance) { + channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); + + NetworkRegistry.TargetPoint vicinity = new NetworkRegistry.TargetPoint(entity.getWorldObj().provider.dimensionId, entity.xCoord + 0.5, entity.yCoord + 0.5, entity.zCoord + 0.5, distance); + channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(vicinity); + channels.get(Side.SERVER).writeAndFlush(packet); + } +} \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/network/DimDoorsPacket.java b/src/main/java/StevenDimDoors/mod_pocketDim/network/DimDoorsPacket.java new file mode 100644 index 0000000..6a14437 --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDim/network/DimDoorsPacket.java @@ -0,0 +1,20 @@ +package StevenDimDoors.mod_pocketDim.network; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.Packet; +import net.minecraft.world.World; + +public abstract class DimDoorsPacket { + public abstract void write(ByteArrayDataOutput out); + public abstract void read(ByteArrayDataInput in); + + @SideOnly(Side.CLIENT) + public abstract void handleClient(World world, EntityPlayer player); + + public abstract void handleServer(World world, EntityPlayerMP player); +} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/network/UpdateLinkPacket.java b/src/main/java/StevenDimDoors/mod_pocketDim/network/UpdateLinkPacket.java new file mode 100644 index 0000000..6d2eeab --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDim/network/UpdateLinkPacket.java @@ -0,0 +1,49 @@ +package StevenDimDoors.mod_pocketDim.network; + +import StevenDimDoors.mod_pocketDim.core.PocketManager; +import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.world.World; + +import java.io.IOException; + +public class UpdateLinkPacket extends DimDoorsPacket { + private ClientLinkData linkData = null; + + public UpdateLinkPacket() {} + public UpdateLinkPacket(ClientLinkData linkData) { + this.linkData = linkData; + } + @Override + public void write(ByteArrayDataOutput out) { + if (linkData != null) { + try { + linkData.write(out); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + @Override + public void read(ByteArrayDataInput in) { + try { + linkData = ClientLinkData.read(in); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + @Override + public void handleClient(World world, EntityPlayer player) { + PocketManager.getLinkWatcher().update(linkData); + } + + @Override + public void handleServer(World world, EntityPlayerMP player) { + //Shouldn't be here + } +} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/BlockRotator.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/BlockRotator.java index 98ae89c..ab2f711 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/BlockRotator.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/BlockRotator.java @@ -1,12 +1,12 @@ package StevenDimDoors.mod_pocketDim.schematic; -import net.minecraft.block.Block; -import net.minecraft.block.BlockComparator; -import net.minecraft.block.BlockDoor; -import net.minecraft.block.BlockRedstoneRepeater; -import net.minecraft.block.BlockStairs; +import net.minecraft.block.*; import StevenDimDoors.mod_pocketDim.Point3D; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import net.minecraft.init.Blocks; + +import java.util.HashMap; +import java.util.Map; public class BlockRotator { @@ -17,65 +17,65 @@ public class BlockRotator private final static int BLOCK_ID_COUNT = 4096; //Provides a fast lookup table for whether blocks have orientations - private final static boolean[] hasOrientations = new boolean[BLOCK_ID_COUNT]; + private final static Map hasOrientations = new HashMap(); - static + public static void setupOrientations() { - hasOrientations[Block.dispenser.blockID] = true; - hasOrientations[Block.dropper.blockID] = true; - hasOrientations[Block.stairsStoneBrick.blockID] = true; - hasOrientations[Block.lever.blockID] = true; - hasOrientations[Block.stoneButton.blockID] = true; - hasOrientations[Block.woodenButton.blockID] = true; - hasOrientations[Block.redstoneRepeaterIdle.blockID] = true; - hasOrientations[Block.redstoneRepeaterActive.blockID] = true; - hasOrientations[Block.tripWireSource.blockID] = true; - hasOrientations[Block.torchWood.blockID] = true; - hasOrientations[Block.torchRedstoneIdle.blockID] = true; - hasOrientations[Block.torchRedstoneActive.blockID] = true; - hasOrientations[Block.doorIron.blockID] = true; - hasOrientations[Block.doorWood.blockID] = true; - hasOrientations[Block.pistonBase.blockID] = true; - hasOrientations[Block.pistonStickyBase.blockID] = true; - hasOrientations[Block.pistonExtension.blockID] = true; - hasOrientations[Block.redstoneComparatorIdle.blockID] = true; - hasOrientations[Block.redstoneComparatorActive.blockID] = true; - hasOrientations[Block.signPost.blockID] = true; - hasOrientations[Block.signWall.blockID] = true; - hasOrientations[Block.skull.blockID] = true; - hasOrientations[Block.ladder.blockID] = true; - hasOrientations[Block.vine.blockID] = true; - hasOrientations[Block.anvil.blockID] = true; - hasOrientations[Block.chest.blockID] = true; - hasOrientations[Block.chestTrapped.blockID] = true; - hasOrientations[Block.hopperBlock.blockID] = true; - hasOrientations[Block.stairsNetherBrick.blockID] = true; - hasOrientations[Block.stairsCobblestone.blockID] = true; - hasOrientations[Block.stairsNetherQuartz.blockID] = true; - hasOrientations[Block.stairsSandStone.blockID] = true; - hasOrientations[Block.stairsBrick.blockID] = true; - hasOrientations[Block.stairsWoodBirch.blockID] = true; - hasOrientations[Block.stairsWoodOak.blockID] = true; - hasOrientations[Block.stairsWoodJungle.blockID] = true; - hasOrientations[Block.stairsWoodSpruce.blockID] = true; - hasOrientations[Block.wood.blockID] = true; - hasOrientations[Block.blockNetherQuartz.blockID] = true; - hasOrientations[Block.railPowered.blockID] = true; - hasOrientations[Block.railDetector.blockID] = true; - hasOrientations[Block.railActivator.blockID] = true; - hasOrientations[Block.rail.blockID] = true; - hasOrientations[Block.furnaceBurning.blockID] = true; - hasOrientations[Block.furnaceIdle.blockID] = true; - hasOrientations[Block.bed.blockID] = true; + hasOrientations.put(Blocks.dispenser, true); + hasOrientations.put(Blocks.dropper, true); + hasOrientations.put(Blocks.stone_brick_stairs, true); + hasOrientations.put(Blocks.lever, true); + hasOrientations.put(Blocks.stone_button, true); + hasOrientations.put(Blocks.wooden_button, true); + hasOrientations.put(Blocks.unpowered_repeater, true); + hasOrientations.put(Blocks.powered_repeater, true); + hasOrientations.put(Blocks.tripwire_hook, true); + hasOrientations.put(Blocks.torch, true); + hasOrientations.put(Blocks.redstone_torch, true); + hasOrientations.put(Blocks.unlit_redstone_torch, true); + hasOrientations.put(Blocks.iron_door, true); + hasOrientations.put(Blocks.wooden_door, true); + hasOrientations.put(Blocks.piston, true); + hasOrientations.put(Blocks.sticky_piston, true); + hasOrientations.put(Blocks.piston_head, true); + hasOrientations.put(Blocks.powered_comparator, true); + hasOrientations.put(Blocks.unpowered_comparator, true); + hasOrientations.put(Blocks.standing_sign, true); + hasOrientations.put(Blocks.wall_sign, true); + hasOrientations.put(Blocks.skull, true); + hasOrientations.put(Blocks.ladder, true); + hasOrientations.put(Blocks.vine, true); + hasOrientations.put(Blocks.anvil, true); + hasOrientations.put(Blocks.chest, true); + hasOrientations.put(Blocks.trapped_chest, true); + hasOrientations.put(Blocks.hopper, true); + hasOrientations.put(Blocks.nether_brick_stairs, true); + hasOrientations.put(Blocks.stone_stairs, true); + hasOrientations.put(Blocks.quartz_stairs, true); + hasOrientations.put(Blocks.sandstone_stairs, true); + hasOrientations.put(Blocks.brick_stairs, true); + hasOrientations.put(Blocks.birch_stairs, true); + hasOrientations.put(Blocks.oak_stairs, true); + hasOrientations.put(Blocks.jungle_stairs, true); + hasOrientations.put(Blocks.spruce_stairs, true); + hasOrientations.put(Blocks.log, true); + hasOrientations.put(Blocks.log2, true); + hasOrientations.put(Blocks.quartz_block, true); + hasOrientations.put(Blocks.rail, true); + hasOrientations.put(Blocks.activator_rail, true); + hasOrientations.put(Blocks.detector_rail, true); + hasOrientations.put(Blocks.golden_rail, true); + hasOrientations.put(Blocks.furnace, true); + hasOrientations.put(Blocks.lit_furnace, true); + hasOrientations.put(Blocks.bed, true); - hasOrientations[mod_pocketDim.dimensionalDoor.blockID] = true; - hasOrientations[mod_pocketDim.warpDoor.blockID] = true; - hasOrientations[mod_pocketDim.goldenDimensionalDoor.blockID] = true; - hasOrientations[mod_pocketDim.personalDimDoor.blockID] = true; - + hasOrientations.put(mod_pocketDim.dimensionalDoor, true); + hasOrientations.put(mod_pocketDim.warpDoor, true); + hasOrientations.put(mod_pocketDim.goldenDimensionalDoor, true); + hasOrientations.put(mod_pocketDim.personalDimDoor, true); } - public static int transformMetadata(int metadata, int turns, int blockID) + public static int transformMetadata(int metadata, int turns, Block block) { //I changed rotations to reduce the monstrous code we had. It might be //slightly less efficient, but it's easier to maintain for now. ~SenseiKiwi @@ -84,37 +84,37 @@ public class BlockRotator turns += 1 << 16; turns %= 4; - if (hasOrientations[blockID]) + if (hasOrientations.containsKey(block) && hasOrientations.get(block)) { while (turns > 0) { - metadata = rotateMetadataBy90(metadata, blockID); + metadata = rotateMetadataBy90(metadata, block); turns--; } } return metadata; } - private static int rotateMetadataBy90(int metadata, int blockID) + private static int rotateMetadataBy90(int metadata, Block block) { //TODO: Replace this horrible function with something prettier. We promise we will for the next version, //after switching to MC 1.6. PADRE, PLEASE FORGIVE OUR SINS. - if (blockID == Block.wood.blockID) + if (block == Blocks.log || block == Blocks.log2) { if (metadata >= 4 && metadata < 12) { metadata = (metadata % 8) + 4; } } - else if (blockID == Block.blockNetherQuartz.blockID) + else if (block == Blocks.quartz_block) { if (metadata == 3 || metadata == 4) { metadata = (metadata - 2) % 2 + 3; } } - else if (blockID == Block.railPowered.blockID || blockID == Block.railDetector.blockID || blockID == Block.railActivator.blockID) + else if (block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail) { switch (metadata) { @@ -159,7 +159,7 @@ public class BlockRotator break; } } - else if (blockID==Block.rail.blockID) + else if (block==Blocks.rail) { switch (metadata) { @@ -183,7 +183,7 @@ public class BlockRotator break; } } - else if (blockID==Block.bed.blockID) + else if (block==Blocks.bed) { switch (metadata) { @@ -213,7 +213,7 @@ public class BlockRotator break; } } - else if (Block.blocksList[blockID] instanceof BlockStairs) + else if (block instanceof BlockStairs) { switch (metadata) @@ -244,7 +244,7 @@ public class BlockRotator break; } } - else if (blockID == Block.chest.blockID || blockID == Block.chestTrapped.blockID || blockID == Block.ladder.blockID || blockID == Block.furnaceBurning.blockID|| blockID == Block.furnaceIdle.blockID) + else if (block == Blocks.chest || block == Blocks.trapped_chest || block == Blocks.ladder || block == Blocks.lit_furnace || block == Blocks.furnace) { switch (metadata) { @@ -262,7 +262,7 @@ public class BlockRotator break; } } - else if (blockID == Block.hopperBlock.blockID) + else if (block == Blocks.hopper) { switch (metadata) { @@ -292,7 +292,7 @@ public class BlockRotator break; } } - else if (blockID==Block.vine.blockID) + else if (block==Blocks.vine) { switch (metadata) { @@ -311,7 +311,7 @@ public class BlockRotator break; } } - else if (blockID==Block.signWall.blockID) + else if (block==Blocks.wall_sign) { switch (metadata) { @@ -330,7 +330,7 @@ public class BlockRotator break; } } - else if (blockID==Block.signPost.blockID) + else if (block==Blocks.standing_sign) { switch (metadata) { @@ -384,7 +384,7 @@ public class BlockRotator break; } } - else if(blockID== Block.lever.blockID || blockID == Block.stoneButton.blockID || blockID == Block.woodenButton.blockID || blockID== Block.torchWood.blockID||blockID== Block.torchRedstoneIdle.blockID||blockID== Block.torchRedstoneActive.blockID) + else if(block== Blocks.lever || block == Blocks.stone_button || block == Blocks.wooden_button || block== Blocks.torch||block== Blocks.unlit_redstone_torch||block== Blocks.redstone_torch) { switch (metadata) { @@ -414,7 +414,7 @@ public class BlockRotator break; } } - else if(blockID== Block.pistonBase.blockID||blockID==Block.pistonExtension.blockID||blockID==Block.pistonStickyBase.blockID || blockID == Block.dispenser.blockID || blockID == Block.dropper.blockID) + else if(block== Blocks.piston||block==Blocks.piston_head||block==Blocks.sticky_piston || block == Blocks.dispenser || block == Blocks.dropper) { switch (metadata) { @@ -444,7 +444,7 @@ public class BlockRotator break; } } - else if (Block.blocksList[blockID] instanceof BlockRedstoneRepeater || Block.blocksList[blockID] instanceof BlockDoor || blockID== Block.tripWireSource.blockID || Block.blocksList[blockID] instanceof BlockComparator) + else if (block instanceof BlockRedstoneRepeater || block instanceof BlockDoor || block== Blocks.tripwire_hook || block instanceof BlockRedstoneComparator) { switch (metadata) { diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ChunkBlockSetter.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ChunkBlockSetter.java index b00195c..a98f35d 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ChunkBlockSetter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ChunkBlockSetter.java @@ -14,9 +14,9 @@ public class ChunkBlockSetter implements IBlockSetter this.ignoreAir = ignoreAir; } - public void setBlock(World world, int x, int y, int z, int blockID, int metadata) + public void setBlock(World world, int x, int y, int z, Block block, int metadata) { - if ((blockID == 0 && ignoreAir) || (blockID != 0 && Block.blocksList[blockID] == null)) + if (block.isAir(world, x, y, z) && ignoreAir) { return; } @@ -39,7 +39,7 @@ public class ChunkBlockSetter implements IBlockSetter extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky); chunk.getBlockStorageArray()[cY] = extBlockStorage; } - extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID); + extBlockStorage.func_150818_a(localX, y & 15, localZ, block); extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata); chunk.setChunkModified(); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/CompoundFilter.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/CompoundFilter.java index 882faa5..5bae47c 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/CompoundFilter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/CompoundFilter.java @@ -1,5 +1,7 @@ package StevenDimDoors.mod_pocketDim.schematic; +import net.minecraft.block.Block; + import java.util.ArrayList; public class CompoundFilter extends SchematicFilter { @@ -18,7 +20,7 @@ public class CompoundFilter extends SchematicFilter { } @Override - protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata) + protected boolean initialize(Schematic schematic,Block[] blocks, byte[] metadata) { for (SchematicFilter filter : filters) { @@ -44,7 +46,7 @@ public class CompoundFilter extends SchematicFilter { } @Override - protected boolean applyToBlock(int index, short[] blocks, byte[] metadata) + protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata) { for (SchematicFilter filter : filters) { diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/IBlockSetter.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/IBlockSetter.java index 5eedbb3..e17304d 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/IBlockSetter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/IBlockSetter.java @@ -1,8 +1,9 @@ package StevenDimDoors.mod_pocketDim.schematic; +import net.minecraft.block.Block; import net.minecraft.world.World; public interface IBlockSetter { - public void setBlock(World world, int x, int y, int z, int blockID, int metadata); + public void setBlock(World world, int x, int y, int z, Block block, int metadata); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ReplacementFilter.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ReplacementFilter.java index e55a7db..461c629 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ReplacementFilter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ReplacementFilter.java @@ -1,16 +1,18 @@ package StevenDimDoors.mod_pocketDim.schematic; +import net.minecraft.block.Block; + public class ReplacementFilter extends SchematicFilter { - private short targetBlock; + private Block targetBlock; private byte targetMetadata; private boolean matchMetadata; - private short replacementBlock; + private Block replacementBlock; private byte replacementMetadata; private boolean changeMetadata; - public ReplacementFilter(short targetBlock, byte targetMetadata, short replacementBlock, byte replacementMetadata) + public ReplacementFilter(Block targetBlock, byte targetMetadata, Block replacementBlock, byte replacementMetadata) { super("ReplacementFilter"); this.targetBlock = targetBlock; @@ -21,7 +23,7 @@ public class ReplacementFilter extends SchematicFilter { this.changeMetadata = true; } - public ReplacementFilter(short targetBlock, short replacementBlock, byte replacementMetadata) + public ReplacementFilter(Block targetBlock, Block replacementBlock, byte replacementMetadata) { super("ReplacementFilter"); this.targetBlock = targetBlock; @@ -31,7 +33,7 @@ public class ReplacementFilter extends SchematicFilter { this.changeMetadata = true; } - public ReplacementFilter(short targetBlock, byte targetMetadata, short replacementBlock) + public ReplacementFilter(Block targetBlock, byte targetMetadata, Block replacementBlock) { super("ReplacementFilter"); this.targetBlock = targetBlock; @@ -41,7 +43,7 @@ public class ReplacementFilter extends SchematicFilter { this.changeMetadata = false; } - public ReplacementFilter(short targetBlock, short replacementBlock) + public ReplacementFilter(Block targetBlock, Block replacementBlock) { super("ReplacementFilter"); this.targetBlock = targetBlock; @@ -51,7 +53,7 @@ public class ReplacementFilter extends SchematicFilter { } @Override - protected boolean applyToBlock(int index, short[] blocks, byte[] metadata) + protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata) { if (blocks[index] == targetBlock) { diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/Schematic.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/Schematic.java index dbb912f..0016d9f 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/Schematic.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/Schematic.java @@ -6,11 +6,14 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.util.LinkedList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -27,19 +30,30 @@ public class Schematic { protected short height; protected short length; - protected short[] blocks; + protected Block[] blocks; protected byte[] metadata; protected NBTTagList tileEntities; - protected Schematic(short width, short height, short length, short[] blocks, byte[] metadata, NBTTagList tileEntities) + protected Schematic(short width, short height, short length, String[] blockPalette, short[] blockIds, byte[] metadata, NBTTagList tileEntities) { this.width = width; this.height = height; this.length = length; - this.blocks = blocks; this.metadata = metadata; this.tileEntities = tileEntities; + + if (blockPalette != null) + loadBlockList(blockPalette, blockIds); } + + protected Schematic(short width, short height, short length, Block[] blocks, byte[] metadata, NBTTagList tileEntities) { + this.width = width; + this.height = height; + this.length = length; + this.blocks = blocks; + this.metadata = metadata; + this.tileEntities = tileEntities; + } protected Schematic(Schematic source) { @@ -53,6 +67,20 @@ public class Schematic { this.tileEntities = source.tileEntities; } + private void loadBlockList(String[] blockPalette, short[] blockIds) { + this.blocks = new Block[blockIds.length]; + + Block[] blockObjPalette = new Block[blockPalette.length]; + + for (int i = 0; i < blockPalette.length; i++) { + blockObjPalette[i] = (Block)Block.blockRegistry.getObject(blockPalette[i]); + } + + for (int i = 0; i < blockIds.length; i++) { + this.blocks[i] = blockObjPalette[blockIds[i]]; + } + } + public int calculateIndex(int x, int y, int z) { if (x < 0 || x >= width) @@ -96,9 +124,9 @@ public class Schematic { return length; } - public short getBlockID(int x, int y, int z) + public Block getBlock(int x, int y, int z) { - return blocks[calculateIndex(x, y, z)]; + return (Block)Block.blockRegistry.getObject(blocks[calculateIndex(x, y, z)]); } public byte getBlockMetadata(int x, int y, int z) @@ -124,9 +152,7 @@ public class Schematic { public static Schematic readFromResource(String resourcePath) throws InvalidSchematicException { - //We need an instance of a class in the mod to retrieve a resource - Schematic empty = new Schematic((short) 0, (short) 0, (short) 0, null, null, null); - InputStream schematicStream = empty.getClass().getResourceAsStream(resourcePath); + InputStream schematicStream = Schematic.class.getResourceAsStream(resourcePath); return readFromStream(schematicStream); } @@ -141,7 +167,8 @@ public class Schematic { byte[] metadata = null; //block metadata byte[] lowBits = null; //first 8 bits of the block IDs byte[] highBits = null; //additional 4 bits of the block IDs - short[] blocks = null; //list of combined block IDs + short[] blockIds = null; //list of combined block IDs + String[] blockPalette = null; NBTTagList tileEntities = null; //storage for tile entities in NBT form NBTTagCompound schematicTag; //the NBT data extracted from the schematic file boolean hasExtendedBlockIDs; //indicates whether the schematic contains extended block IDs @@ -173,6 +200,19 @@ public class Schematic { if (length < 0) throw new InvalidSchematicException("The schematic cannot have a negative length."); + + NBTTagList nbtPalette = schematicTag.getTagList("Palette", 8); + + if (nbtPalette.tagCount() < 1) { + throw new InvalidSchematicException("The schematic must have a valid block palette."); + } + + blockPalette = new String[nbtPalette.tagCount()]; + + for (int i = 0; i < nbtPalette.tagCount(); i++) { + blockPalette[i] = nbtPalette.getStringTagAt(i); + } + //load block info lowBits = schematicTag.getByteArray("Blocks"); highBits = schematicTag.getByteArray("AddBlocks"); @@ -186,7 +226,7 @@ public class Schematic { if (volume > 2 * highBits.length && hasExtendedBlockIDs) throw new InvalidSchematicException("The schematic has extended block IDs for fewer blocks than its dimensions indicate."); - blocks = new short[volume]; + blockIds = new short[volume]; if (hasExtendedBlockIDs) { //Combine the split block IDs into a single value @@ -194,12 +234,12 @@ public class Schematic { int index; for (index = 0; index < pairs; index += 2) { - blocks[index] = (short) (((highBits[index >> 1] & 0x0F) << 8) + (lowBits[index] & 0xFF)); - blocks[index + 1] = (short) (((highBits[index >> 1] & 0xF0) << 4) + (lowBits[index + 1] & 0xFF)); + blockIds[index] = (short) (((highBits[index >> 1] & 0x0F) << 8) + (lowBits[index] & 0xFF)); + blockIds[index + 1] = (short) (((highBits[index >> 1] & 0xF0) << 4) + (lowBits[index + 1] & 0xFF)); } if (index < volume) { - blocks[index] = lowBits[index >> 1]; + blockIds[index] = lowBits[index >> 1]; } } else @@ -207,14 +247,21 @@ public class Schematic { //Copy the blockIDs for (int index = 0; index < volume; index++) { - blocks[index] = (short) (lowBits[index] & 0xFF); + blockIds[index] = (short) (lowBits[index] & 0xFF); } } + for (int i = 0; i < blockIds.length; i++) { + int paletteIndex = blockIds[i]; + if (paletteIndex < 0 || paletteIndex >= blockPalette.length) { + throw new InvalidSchematicException("Block entry referenced a non-existant palette entry."); + } + } + //Get the list of tile entities - tileEntities = schematicTag.getTagList("TileEntities"); + tileEntities = schematicTag.getTagList("TileEntities", 10); - Schematic result = new Schematic(width, height, length, blocks, metadata, tileEntities); + Schematic result = new Schematic(width, height, length, blockPalette, blockIds, metadata, tileEntities); return result; } catch (InvalidSchematicException ex) @@ -266,7 +313,7 @@ public class Schematic { //Short and sweet ^_^ WorldCopyOperation copier = new WorldCopyOperation(); copier.apply(world, x, y, z, width, height, length); - return new Schematic(width, height, length, copier.getBlockIDs(), copier.getMetadata(), copier.getTileEntities()); + return new Schematic(width, height, length, copier.getBlocks(), copier.getMetadata(), copier.getTileEntities()); } private static boolean encodeBlockIDs(short[] blocks, byte[] lowBits, byte[] highBits) @@ -291,6 +338,20 @@ public class Schematic { return hasHighBits; } + private static void reduceToPalette(Block[] blocks, List blockPalette, short[] blockIds) { + for (int i = 0; i < blocks.length; i++) { + String blockName = Block.blockRegistry.getNameForObject(blocks[i]); + int blockIndex = blockPalette.indexOf(blockName); + + if (blockIndex < 0) { + blockIndex = blockPalette.size(); + blockPalette.add(blockName); + } + + blockIds[i] = (short)blockIndex; + } + } + public NBTTagCompound writeToNBT() { return writeToNBT(true); @@ -301,13 +362,13 @@ public class Schematic { return writeToNBT(width, height, length, blocks, metadata, tileEntities, copyTileEntities); } - protected static NBTTagCompound writeToNBT(short width, short height, short length, short[] blocks, byte[] metadata, + protected static NBTTagCompound writeToNBT(short width, short height, short length, Block[] blocks, byte[] metadata, NBTTagList tileEntities, boolean copyTileEntities) { //This is the main storage function. Schematics are really compressed NBT tags, so if we can generate //the tags, most of the work is done. All the other storage functions will rely on this one. - NBTTagCompound schematicTag = new NBTTagCompound("Schematic"); + NBTTagCompound schematicTag = new NBTTagCompound(); schematicTag.setShort("Width", width); schematicTag.setShort("Length", length); @@ -316,9 +377,13 @@ public class Schematic { schematicTag.setTag("Entities", new NBTTagList()); schematicTag.setString("Materials", "Alpha"); + List blockPalette = new LinkedList(); + short[] blockIds = new short[blocks.length]; + reduceToPalette(blocks, blockPalette, blockIds); + byte[] lowBits = new byte[blocks.length]; byte[] highBits = new byte[(blocks.length >> 1) + (blocks.length & 1)]; - boolean hasExtendedIDs = encodeBlockIDs(blocks, lowBits, highBits); + boolean hasExtendedIDs = encodeBlockIDs(blockIds, lowBits, highBits); schematicTag.setByteArray("Blocks", lowBits); schematicTag.setByteArray("Data", metadata); @@ -400,7 +465,7 @@ public class Schematic { count = tileEntities.tagCount(); for (index = 0; index < count; index++) { - NBTTagCompound tileTag = (NBTTagCompound) tileEntities.tagAt(index); + NBTTagCompound tileTag = (NBTTagCompound) tileEntities.getCompoundTagAt(index); //Rewrite its location to be in world coordinates dx = tileTag.getInteger("x") + x; dy = tileTag.getInteger("y") + y; @@ -409,7 +474,7 @@ public class Schematic { tileTag.setInteger("y", dy); tileTag.setInteger("z", dz); //Load the tile entity and put it in the world - world.setBlockTileEntity(dx, dy, dz, TileEntity.createAndLoadEntity(tileTag)); + world.setTileEntity(dx, dy, dz, TileEntity.createAndLoadEntity(tileTag)); } } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/SchematicFilter.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/SchematicFilter.java index 105a28c..491cf77 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/SchematicFilter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/SchematicFilter.java @@ -1,5 +1,7 @@ package StevenDimDoors.mod_pocketDim.schematic; +import net.minecraft.block.Block; + public class SchematicFilter { private String name; @@ -14,7 +16,7 @@ public class SchematicFilter { return name; } - public boolean apply(Schematic schematic, short[] blocks, byte[] metadata) + public boolean apply(Schematic schematic, Block[] blocks, byte[] metadata) { if (!initialize(schematic, blocks, metadata)) return false; @@ -28,12 +30,12 @@ public class SchematicFilter { return finish(); } - protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata) + protected boolean initialize(Schematic schematic, Block[] blocks, byte[] metadata) { return true; } - protected boolean applyToBlock(int index, short[] blocks, byte[] metadata) + protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata) { return true; } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldBlockSetter.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldBlockSetter.java index 2ff9e08..e937bf5 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldBlockSetter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldBlockSetter.java @@ -21,11 +21,11 @@ public class WorldBlockSetter implements IBlockSetter this.ignoreAir = ignoreAir; } - public void setBlock(World world, int x, int y, int z, int blockID, int metadata) + public void setBlock(World world, int x, int y, int z, Block block, int metadata) { - if (!ignoreAir || blockID != 0) + if (!ignoreAir || !block.isAir(world,x,y,z)) { - world.setBlock(x, y, z, blockID, metadata, flags); + world.setBlock(x, y, z, block, metadata, flags); } } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldCopyOperation.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldCopyOperation.java index fe49a78..0c8220d 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldCopyOperation.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldCopyOperation.java @@ -1,5 +1,6 @@ package StevenDimDoors.mod_pocketDim.schematic; +import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; @@ -11,14 +12,14 @@ public class WorldCopyOperation extends WorldOperation private int originY; private int originZ; private int index; - private short[] blockIDs; + private Block[] blocks; private byte[] metadata; private NBTTagList tileEntities; public WorldCopyOperation() { super("WorldCopyOperation"); - blockIDs = null; + blocks = null; metadata = null; tileEntities = null; } @@ -30,7 +31,7 @@ public class WorldCopyOperation extends WorldOperation originX = x; originY = y; originZ = z; - blockIDs = new short[width * height * length]; + blocks = new Block[width * height * length]; metadata = new byte[width * height * length]; tileEntities = new NBTTagList(); return true; @@ -39,10 +40,10 @@ public class WorldCopyOperation extends WorldOperation @Override protected boolean applyToBlock(World world, int x, int y, int z) { - blockIDs[index] = (short) world.getBlockId(x, y, z); + blocks[index] = world.getBlock(x, y, z); metadata[index] = (byte) world.getBlockMetadata(x, y, z); - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity != null) { //Extract tile entity data @@ -59,9 +60,9 @@ public class WorldCopyOperation extends WorldOperation return true; } - public short[] getBlockIDs() + public Block[] getBlocks() { - return blockIDs; + return blocks; } public byte[] getMetadata() diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/CustomLimboPopulator.java b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/CustomLimboPopulator.java index 231eec2..29f6fa0 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/CustomLimboPopulator.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/CustomLimboPopulator.java @@ -3,7 +3,9 @@ package StevenDimDoors.mod_pocketDim.ticking; import java.util.Random; import java.util.concurrent.ConcurrentLinkedQueue; +import net.minecraft.block.Block; import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; import net.minecraft.server.MinecraftServer; import net.minecraft.world.GameRules; import net.minecraft.world.World; @@ -99,7 +101,7 @@ public class CustomLimboPopulator implements IRegularTickReceiver { } int sanity = 0; - int blockID = 0; + Block block = Blocks.air; boolean didSpawn = false; //The following initialization code is based on code from ChunkProviderGenerate. @@ -117,23 +119,23 @@ public class CustomLimboPopulator implements IRegularTickReceiver { x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); y = MAX_MONOLITH_SPAWN_Y; - blockID = pocket.getBlockId(x, y, z); + block = pocket.getBlock(x, y, z); - while (blockID == 0 &&y>0) + while (block.isAir(pocket, x, y, z) &&y>0) { y--; - blockID = pocket.getBlockId(x, y, z); + block = pocket.getBlock(x, y, z); } - while ((blockID == properties.FabricBlockID || blockID == properties.PermaFabricBlockID) && y > 0) + while ((block == mod_pocketDim.blockDimWall || block == mod_pocketDim.blockDimWallPerm) && y > 0) { y--; - blockID = pocket.getBlockId(x, y, z); + block = pocket.getBlock(x, y, z); } - while (blockID == 0 && y > 0) + while (block.isAir(pocket, x, y, z) && y > 0) { y--; - blockID = pocket.getBlockId(x, y, z); + block = pocket.getBlock(x, y, z); } if(y > 0) { @@ -175,7 +177,7 @@ public class CustomLimboPopulator implements IRegularTickReceiver { int x = chunkX * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); int z = chunkZ * CHUNK_SIZE + random.nextInt(CHUNK_SIZE); - while (limbo.getBlockId(x, y, z) == 0 && y <255) + while (limbo.getBlock(x, y, z).isAir(limbo, x, y, z) && y <255) { y++; } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java index 279c123..b259375 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java @@ -50,6 +50,10 @@ public class MobMonolith extends EntityFlying implements IMob properties = DDProperties.instance(); } + public boolean isDangerous() { + return properties.MonolithTeleportationEnabled && (properties.LimboDimensionID != worldObj.provider.dimensionId || !properties.DangerousLimboMonolithsDisabled); + } + @Override protected void damageEntity(DamageSource par1DamageSource, float par2) { @@ -94,7 +98,7 @@ public class MobMonolith extends EntityFlying implements IMob protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setAttribute(57005); + this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setBaseValue(57005); } @Override @@ -127,7 +131,7 @@ public class MobMonolith extends EntityFlying implements IMob public void onEntityUpdate() { // Remove this Monolith if it's not in Limbo or in a pocket dimension - if (!(this.worldObj.provider instanceof LimboProvider || this.worldObj.provider instanceof PocketProvider)) + if (!(this.worldObj.provider.dimensionId == properties.LimboDimensionID|| this.worldObj.provider instanceof PocketProvider)) { this.setDead(); super.onEntityUpdate(); @@ -145,7 +149,7 @@ public class MobMonolith extends EntityFlying implements IMob if (player != null) { this.facePlayer(player); - if (!this.worldObj.isRemote && !(this.worldObj.provider instanceof LimboProvider)) + if (!this.worldObj.isRemote && isDangerous()) { // Play sounds on the server side, if the player isn't in Limbo. // Limbo is excluded to avoid drowning out its background music. @@ -158,7 +162,7 @@ public class MobMonolith extends EntityFlying implements IMob if (visibility) { // Only spawn particles on the client side and outside Limbo - if (this.worldObj.isRemote && !(this.worldObj.provider instanceof LimboProvider)) + if (this.worldObj.isRemote && isDangerous()) { this.spawnParticles(player); } @@ -166,7 +170,7 @@ public class MobMonolith extends EntityFlying implements IMob // Teleport the target player if various conditions are met if (aggro >= MAX_AGGRO && !this.worldObj.isRemote && properties.MonolithTeleportationEnabled && !player.capabilities.isCreativeMode && - !(this.worldObj.provider instanceof LimboProvider)) + isDangerous()) { this.aggro = 0; Point4D destination = LimboProvider.getLimboSkySpawn(player, properties); @@ -187,9 +191,12 @@ public class MobMonolith extends EntityFlying implements IMob // Rapidly increase the aggro level if this Monolith can see the player if (visibility) { - if (this.worldObj.provider instanceof LimboProvider) + if (this.worldObj.provider.dimensionId == properties.LimboDimensionID) { - aggro++; + if (isDangerous()) + aggro++; + else + aggro += 36; } else { @@ -199,19 +206,20 @@ public class MobMonolith extends EntityFlying implements IMob } else { - if (aggro > aggroCap) - { - // Decrease aggro over time - aggro--; - } - else if (player != null && (aggro < aggroCap)) - { - // Increase aggro if a player is within range and aggro < aggroCap - aggro++; - } + if (isDangerous()) { + if (aggro > aggroCap) { + // Decrease aggro over time + aggro--; + } else if (player != null && (aggro < aggroCap)) { + // Increase aggro if a player is within range and aggro < aggroCap + aggro++; + } + } else + aggro -= 3; } // Clamp the aggro level - aggro = (short) MathHelper.clamp_int(aggro, 0, MAX_AGGRO); + int maxAggro = isDangerous()?MAX_AGGRO:180; + aggro = (short) MathHelper.clamp_int(aggro, 0, maxAggro); this.dataWatcher.updateObject(AGGRO_WATCHER_INDEX, Short.valueOf(aggro)); } else @@ -236,7 +244,7 @@ public class MobMonolith extends EntityFlying implements IMob float aggroPercent = this.getAggroProgress(); if (this.soundTime <= 0) { - this.playSound(mod_pocketDim.modid + ":monk", 1F, 1F); + this.playSound(mod_pocketDim.modid + ":monk", 1F, 1F); this.soundTime = 100; } if ((aggroPercent > 0.70) && this.soundTime < 100) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java index f23c38c..a5155ca 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java @@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.ticking; import java.util.PriorityQueue; import java.util.Random; +import net.minecraft.block.Block; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; @@ -112,9 +113,9 @@ public class RiftRegenerator implements IRegularTickReceiver { else { // All of the necessary conditions have been met. Restore the rift! - int blockID = world.getBlockId(x, y, z); - if (world.setBlock(x, y, z, blockRift.blockID)) - blockRift.dropWorldThread(blockID, world, x, y, z, random); + Block block = world.getBlock(x, y, z); + if (world.setBlock(x, y, z, blockRift)) + blockRift.dropWorldThread(block, world, x, y, z, random); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/ServerTickHandler.java b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/ServerTickHandler.java index 58da365..83844c0 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/ticking/ServerTickHandler.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/ticking/ServerTickHandler.java @@ -1,13 +1,15 @@ package StevenDimDoors.mod_pocketDim.ticking; +import java.lang.reflect.Type; import java.util.ArrayList; import java.util.EnumSet; import StevenDimDoors.mod_pocketDim.core.DDTeleporter; -import cpw.mods.fml.common.ITickHandler; -import cpw.mods.fml.common.TickType; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.relauncher.Side; -public class ServerTickHandler implements ITickHandler, IRegularTickSender +public class ServerTickHandler implements IRegularTickSender { private static final String PROFILING_LABEL = "Dimensional Doors: Server Tick"; @@ -32,10 +34,19 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender receivers.clear(); } - @Override - public void tickStart(EnumSet type, Object... tickData) - { - if (type.equals(EnumSet.of(TickType.SERVER))) + @SubscribeEvent + public void tickEvent(TickEvent event) { + if (event.side != Side.SERVER) + return; + + if (event.phase == TickEvent.Phase.START) + tickStart(event.type); + else if (event.phase == TickEvent.Phase.END) + tickEnd(event.type); + } + + private void tickStart(TickEvent.Type type) { + if (type.equals(EnumSet.of(TickEvent.Type.SERVER))) { for (RegularTickReceiverInfo info : receivers) { @@ -54,8 +65,7 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender } } - @Override - public void tickEnd(EnumSet type, Object... tickData) + private void tickEnd(TickEvent.Type type) { for (RegularTickReceiverInfo info : receivers) { @@ -66,16 +76,4 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender } tickCount++; //There is no need to reset the counter. Let it overflow. } - - @Override - public EnumSet ticks() - { - return EnumSet.of(TickType.SERVER); - } - - @Override - public String getLabel() - { - return PROFILING_LABEL; //Used for profiling! - } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java index 57c10a8..8a48808 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityDimDoor.java @@ -2,24 +2,20 @@ package StevenDimDoors.mod_pocketDim.tileentities; import java.util.Random; +import StevenDimDoors.mod_pocketDim.network.CreateLinkPacket; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.packet.Packet; import StevenDimDoors.mod_pocketDim.ServerPacketHandler; import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; -import net.minecraft.block.Block; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet130UpdateSign; -import net.minecraft.network.packet.Packet250CustomPayload; -import net.minecraft.tileentity.TileEntity; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; - -public class TileEntityDimDoor extends DDTileEntityBase +public class TileEntityDimDoor extends DDTileEntityBase { public boolean openOrClosed; public int orientation; @@ -37,13 +33,29 @@ public class TileEntityDimDoor extends DDTileEntityBase @Override public Packet getDescriptionPacket() { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null) { - return ServerPacketHandler.createLinkPacket(new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj))); + ClientLinkData linkData = new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)); + NBTTagCompound link = new NBTTagCompound(); + linkData.writeToNBT(link); + tag.setTag("Link", link); } - return null; + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); } + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound tag = pkt.func_148857_g(); + readFromNBT(tag); + + if (tag.hasKey("Link")) { + ClientLinkData linkData = ClientLinkData.readFromNBT(tag.getCompoundTag("Link")); + PocketManager.getLinkWatcher().onCreated(linkData); + } + } + @Override public void readFromNBT(NBTTagCompound nbt) { diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java index b5ee488..c6d38df 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/tileentities/TileEntityRift.java @@ -3,13 +3,15 @@ package StevenDimDoors.mod_pocketDim.tileentities; import java.util.ArrayList; import java.util.List; import java.util.Random; + +import StevenDimDoors.mod_pocketDim.network.CreateLinkPacket; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import StevenDimDoors.mod_pocketDim.ServerPacketHandler; @@ -19,8 +21,6 @@ import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.util.Point4D; -import StevenDimDoors.mod_pocketDim.util.l_systems.LSystem; -import StevenDimDoors.mod_pocketDim.util.l_systems.LSystem.PolygonStorage; import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; public class TileEntityRift extends DDTileEntityBase @@ -49,7 +49,6 @@ public class TileEntityRift extends DDTileEntityBase public int spawnedEndermenID = 0; public int riftRotation = random.nextInt(360); - public int renderKey = random.nextInt(LSystem.curves.size()); public float growth = 0; public TileEntityRift() @@ -65,7 +64,7 @@ public class TileEntityRift extends DDTileEntityBase { if (PocketManager.getLink(xCoord, yCoord, zCoord, worldObj.provider.dimensionId) == null) { - if (worldObj.getBlockId(xCoord, yCoord, zCoord) == mod_pocketDim.blockRift.blockID) + if (worldObj.getBlock(xCoord, yCoord, zCoord) == mod_pocketDim.blockRift) { worldObj.setBlockToAir(xCoord, yCoord, zCoord); } @@ -76,7 +75,7 @@ public class TileEntityRift extends DDTileEntityBase return; } - if (worldObj.getBlockId(xCoord, yCoord, zCoord) != mod_pocketDim.blockRift.blockID) + if (worldObj.getBlock(xCoord, yCoord, zCoord) != mod_pocketDim.blockRift) { invalidate(); return; @@ -154,18 +153,18 @@ public class TileEntityRift extends DDTileEntityBase for (DimLink riftLink : dimension.findRiftsInRange(worldObj, 6, xCoord, yCoord, zCoord)) { Point4D location = riftLink.source(); - TileEntityRift rift = (TileEntityRift) worldObj.getBlockTileEntity(location.getX(), location.getY(), location.getZ()); + TileEntityRift rift = (TileEntityRift) worldObj.getTileEntity(location.getX(), location.getY(), location.getZ()); if (rift != null && !rift.shouldClose) { rift.shouldClose = true; - rift.onInventoryChanged(); + rift.markDirty(); } } } - if (growth == 0 && !worldObj.isRemote) + if (growth <= 0 && !worldObj.isRemote) { DimLink link = PocketManager.getLink(this.xCoord, this.yCoord, this.zCoord, worldObj); - if (link != null) + if (link != null && !worldObj.isRemote) { dimension.deleteLink(link); } @@ -207,7 +206,7 @@ public class TileEntityRift extends DDTileEntityBase this.yOffset = 0; this.xOffset = 0; } - this.onInventoryChanged(); + this.markDirty(); } @Override @@ -263,7 +262,6 @@ public class TileEntityRift extends DDTileEntityBase this.shouldClose = nbt.getBoolean("shouldClose"); this.spawnedEndermenID = nbt.getInteger("spawnedEndermenID"); this.riftRotation = nbt.getInteger("riftRotation"); - this.renderKey = nbt.getInteger("renderKey"); this.growth = nbt.getFloat("growth"); } @@ -278,38 +276,43 @@ public class TileEntityRift extends DDTileEntityBase nbt.setInteger("zOffset", this.zOffset); nbt.setBoolean("shouldClose", this.shouldClose); nbt.setInteger("spawnedEndermenID", this.spawnedEndermenID); - nbt.setInteger("renderKey", this.renderKey); nbt.setInteger("riftRotation", this.riftRotation); nbt.setFloat("growth", this.growth); } - @Override - public Packet getDescriptionPacket() - { - if (PocketManager.getLink(xCoord, yCoord, zCoord, worldObj) != null) - { - return ServerPacketHandler.createLinkPacket(new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj))); - } - return null; - } + @Override + public Packet getDescriptionPacket() + { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); - @Override - public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) - { - readFromNBT(pkt.data); - } + if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null) + { + ClientLinkData linkData = new ClientLinkData(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)); + + NBTTagCompound link = new NBTTagCompound(); + linkData.writeToNBT(link); + + tag.setTag("Link", link); + } + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, tag); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound tag = pkt.func_148857_g(); + readFromNBT(tag); + + if (tag.hasKey("Link")) { + ClientLinkData linkData = ClientLinkData.readFromNBT(tag.getCompoundTag("Link")); + PocketManager.getLinkWatcher().onCreated(linkData); + } + } @Override public float[] getRenderColor(Random rand) { return null; } - - public PolygonStorage getCurve() - { - - - return (LSystem.curves.get(renderKey)); - } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/util/Point4D.java b/src/main/java/StevenDimDoors/mod_pocketDim/util/Point4D.java index 2693e63..30bab3f 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/util/Point4D.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/util/Point4D.java @@ -1,10 +1,9 @@ package StevenDimDoors.mod_pocketDim.util; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; +import java.io.*; import StevenDimDoors.mod_pocketDim.Point3D; +import net.minecraft.nbt.NBTTagCompound; public final class Point4D implements Comparable @@ -180,7 +179,16 @@ public final class Point4D implements Comparable return "(" + x + ", " + y + ", " + z + ", " + dimension + ")"; } - public static void write(Point4D point, DataOutputStream stream) throws IOException + public static void writeToNBT(Point4D point, NBTTagCompound tag) { + if (point != null) { + tag.setInteger("X", point.x); + tag.setInteger("Y", point.y); + tag.setInteger("Z", point.z); + tag.setInteger("Dimension", point.dimension); + } + } + + public static void write(Point4D point, DataOutput stream) throws IOException { stream.writeBoolean(point != null); if (point != null) @@ -192,7 +200,7 @@ public final class Point4D implements Comparable } } - public static Point4D read(DataInputStream stream) throws IOException + public static Point4D read(DataInput stream) throws IOException { if (stream.readBoolean()) { @@ -203,4 +211,8 @@ public final class Point4D implements Comparable return null; } } + + public static Point4D readFromNBT(NBTTagCompound tag) { + return new Point4D(tag.getInteger("X"), tag.getInteger("Y"), tag.getInteger("Z"), tag.getInteger("Dimension")); + } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/util/WeightedContainer.java b/src/main/java/StevenDimDoors/mod_pocketDim/util/WeightedContainer.java index 65d239c..a61990f 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/util/WeightedContainer.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/util/WeightedContainer.java @@ -1,6 +1,6 @@ package StevenDimDoors.mod_pocketDim.util; -import net.minecraft.util.WeightedRandomItem; +import net.minecraft.util.WeightedRandom; /*. * Implements a simple generic item for using net.minecraft.util.WeightedRandom with objects of type T. @@ -9,7 +9,7 @@ import net.minecraft.util.WeightedRandomItem; * extending WeightedRandomItem or cases in which we would have to break compatibility with previous serialized * instances to add support for WeightedRandomItem. */ -public class WeightedContainer extends WeightedRandomItem { +public class WeightedContainer extends WeightedRandom.Item { private T data; diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/util/l_systems/LSystem.java b/src/main/java/StevenDimDoors/mod_pocketDim/util/l_systems/LSystem.java deleted file mode 100644 index 46d83ec..0000000 --- a/src/main/java/StevenDimDoors/mod_pocketDim/util/l_systems/LSystem.java +++ /dev/null @@ -1,557 +0,0 @@ -package StevenDimDoors.mod_pocketDim.util.l_systems; - -import java.awt.Point; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import javax.swing.SwingUtilities; -import org.poly2tri.Poly2Tri; -import org.poly2tri.geometry.polygon.Polygon; -import org.poly2tri.geometry.polygon.PolygonPoint; -import org.poly2tri.triangulation.TriangulationPoint; -import org.poly2tri.triangulation.delaunay.DelaunayTriangle; - - -public class LSystem -{ - public static ArrayList curves = new ArrayList(); - - /** - * An array containing the args to generate a curve. - * index 0 = rules - * index 1 = angle - * index 2 = start string - */ - public static final String[] TERDRAGON = {"F>+F----F++++F-","60","F"}; - public static final String[] DRAGON = {"X>X+YF:Y>FX-Y","90","FX"}; - public static final String[] TWINDRAGON = {"X>X+YF:Y>FX-Y","90","FX--FX"}; - public static final String[] VORTEX = {"X>X+YF:Y>FX-Y","90","FX---FX"}; - - - - /** - * Generates a fractal curve - * @param args: 0 = rules, 1 = angle, 2 = start - * @param steps - * @return - */ - public static void generateLSystem(String key, String[] args, int steps) - { - //Parse the rules from the first index - String[] rules = args[0].split(":"); - HashMap lSystemsRule = new HashMap(); - - for (String rule : rules) - { - String[] parts = rule.split(">"); - lSystemsRule.put(parts[0], parts[1]); - } - - //get the angle for each turn - int angle = Integer.parseInt(args[1]); - - - //String to hold the output - //Initialize with starting string - String output = args[2]; - - //generate the l-system - output = (generate(args[2], steps, lSystemsRule)); - - //get the boundary of the polygon - PolygonStorage polygon = getBoundary(convertToPoints(angle, output, (steps))); - - //replace the boundary of the polygon with a series of points representing triangles for rendering - polygon.points = tesselate(polygon); - - curves.add(polygon); - - } - - /** - * Naively returns all of the points comprising the fractal - * @param input - * @return - */ - public static PolygonStorage getSpaceFillingCurve(ArrayList input) - { - // store max x and y values to create bounding box - int maxY = Integer.MIN_VALUE; - int maxX = Integer.MIN_VALUE; - int minY = Integer.MAX_VALUE; - int minX = Integer.MAX_VALUE; - - // store confirmed duplicates here - HashSet duplicates = new HashSet(); - - // store possible singles here - HashSet singles = new HashSet(); - - // list to store confirmed singles and output in the correct order - ArrayList output = new ArrayList(); - - // sort into Hashmaps and hashsets to make contains operations possible, - // while testing for duplicates - for (double[] point : input) - { - // convert doubles to ints and record min/max values - - int xCoord = (int) Math.round(point[0]); - int yCoord = (int) Math.round(point[1]); - - if (xCoord > maxX) - { - maxX = xCoord; - } - if (xCoord < minX) - { - minX = xCoord; - } - - if (yCoord > maxY) - { - maxY = yCoord; - } - if (yCoord < minY) - { - minY = yCoord; - } - output.add(new Point(xCoord, yCoord)); - } - return new PolygonStorage(output, maxX, maxY, minX, minY); - - } - - /** - * Takes an unordered list of points comprising a fractal curve and builds a - * closed polygon around it - * - * @param input - * @return - */ - public static PolygonStorage getBoundary(ArrayList input) - { - // store max x and y values to create bounding box - int maxY = Integer.MIN_VALUE; - int maxX = Integer.MIN_VALUE; - int minY = Integer.MAX_VALUE; - int minX = Integer.MAX_VALUE; - - // store confirmed duplicates here - HashSet duplicates = new HashSet(); - - // store possible singles here - HashSet singles = new HashSet(); - - // list to store confirmed singles and output in the correct order - ArrayList output = new ArrayList(); - - // sort into Hashmaps and hashsets to make contains operations possible, - // while testing for duplicates - for (double[] point : input) - { - // convert doubles to ints and record min/max values - - int xCoord = (int) Math.round(point[0]); - int yCoord = (int) Math.round(point[1]); - - if (xCoord > maxX) - { - maxX = xCoord; - } - if (xCoord < minX) - { - minX = xCoord; - } - - if (yCoord > maxY) - { - maxY = yCoord; - } - if (yCoord < minY) - { - minY = yCoord; - } - singles.add(new Point(xCoord, yCoord)); - - } - - // find a suitable starting point - Point startPoint = new Point(minX, minY); - Point prevPoint = (Point) startPoint.clone(); - - while (startPoint.y < maxY) - { - if (singles.contains(startPoint)) - { - break; - } - startPoint.y++; - } - - // record the first point so we know where to stop - final Point firstPoint = (Point) startPoint.clone(); - - // determine the direction to start searching from - Point direction = getVector(prevPoint, startPoint); - - //output.add(startPoint); - - // loop around in a clockwise circle, jumping to the next point when we - // find it and resetting the direction to start seaching from - // to the last found point. This ensures we always find the next - // *outside* point - do - { - // get the next point - direction = rotateCounterClockwise(direction); - Point target = new Point(startPoint.x + direction.x, startPoint.y + direction.y); - - // see if that point is part of our fractal curve - if (singles.contains(target)) - { - if(target.equals(firstPoint)) - { - output.remove(output.get(output.size()-1)); - break; - } - // get the vector to start from for the next cycle - direction = getVector(startPoint, target); - - // prune zero width spikes - if ((output.size() > 1 && output.get(output.size() - 2).equals(target))) - { - output.remove(output.size() - 1); - } - else - { - - if(output.contains(target)&&!target.equals(output.get(0))) - { - int index = output.indexOf(target); - while(output.size()>index) - { - output.remove(output.size()-1); - } - - } - output.add(target); - } - startPoint = target; - } - } - while (!(output.get(output.size() - 1).equals(firstPoint) && output.size() > 1) && output.size() < singles.size()); - - return new PolygonStorage(output, maxX, maxY, minX, minY); - } - - /** - * using a point as a 2d vector, normalize it (sorta) - * - * @param origin - * @param destination - * @return - */ - public static Point getVector(Point origin, Point destination) - { - int[] normals = { origin.x - destination.x, origin.y - destination.y }; - - for (int i = 0; i < normals.length; i++) - { - if (normals[i] > 0) - { - normals[i] = 1; - } - else if (normals[i] == 0) - { - normals[i] = 0; - } - else if (normals[i] < 0) - { - normals[i] = -1; - } - } - return new Point(normals[0], normals[1]); - } - - /** - * rotate a normal around the origin - * - * @param previous - * @return - */ - public static Point rotateCounterClockwise(Point previous) - { - Point point = new Point(); - - point.x = (int) (previous.x * Math.cos(Math.toRadians(90)) - previous.y * Math.sin(Math.toRadians(90))); - point.y = (int) (previous.x * Math.sin(Math.toRadians(90)) + previous.y * Math.cos(Math.toRadians(90))); - - return point; - } - - /** - * Take an l-system string and convert it into a series of points on a - * cartesian grid. Designed to keep terdragons oriented the same direction - * regardless of iterations - * - * @param angle - * @param system - * @param generations - * @return - */ - public static ArrayList convertToPoints(double angle, String system, int generations) - { - - // determine the starting point and rotation to begin drawing from - int rotation = (generations % 2) == 0 ? 2 : 4; - double[] currentState = { ((generations + rotation) % 4) * 90, 0, 0 }; - - // the output for a totally unordered list of points defining the curve - ArrayList output = new ArrayList(); - - // the stack used to deal with branching l-systems that use [ and ] - ArrayDeque state = new ArrayDeque(); - - // perform the rules corresponding to each symbol in the l-system - for (Character ch : system.toCharArray()) - { - double motion = 1; - - // move forward - if (ch == 'F') - { - currentState[1] -= (Math.cos(Math.toRadians(currentState[0])) * motion); - currentState[2] -= (Math.sin(Math.toRadians(currentState[0])) * motion); - output.add(new double[] { currentState[1], currentState[2] }); - - } - // start branch - if (ch == '[') - { - - state.push(currentState.clone()); - } - // turn left - if (ch == '-') - { - currentState = new double[] { (double) ((currentState[0] - angle) % 360), currentState[1], currentState[2] }; - } - // turn right - if (ch == '+') - { - currentState[0] = ((currentState[0] + angle) % 360); - - } - // end branch and return to previous fork - if (ch == ']') - { - currentState = state.pop(); - } - } - return output; - - } - - /** - * grow and l-system string based on the rules provided in the args - * - * @param start - * @param steps - * @param lSystemsRule - * @return - */ - public static String generate(String start, int steps, HashMap lSystemsRule) - { - - while (steps > 0) - { - StringBuilder output = new StringBuilder(); - - for (Character ch : start.toCharArray()) - { - // get the rule applicable for the variable - String data = lSystemsRule.get(ch.toString()); - - // handle constants for rule-less symbols - if (data == null) - { - data = ch.toString(); - } - output.append(data); - } - steps--; - start = output.toString(); - } - return start; - } - - // a data container class to transmit the important information about the polygon - public static class PolygonStorage - { - public PolygonStorage(ArrayList points, int maxX, int maxY, int minX, int minY) - { - this.points = points; - this.maxX = maxX; - this.maxY = maxY; - this.minX = minX; - this.minY = minY; - } - public ArrayList points; - - public int maxX; - public int maxY; - public int minX; - public int minY; - } - - - public static ArrayList tesselate(PolygonStorage polygon) - { - ArrayList points = new ArrayList(); - - ArrayList polyPoints = new ArrayList(); - - for(int i = 0; i tris =(ArrayList) poly.getTriangles(); - - for(DelaunayTriangle tri : tris) - { - for(TriangulationPoint tpoint : tri.points) - { - points.add(new Point((int)tpoint.getX(),(int) tpoint.getY())); - } - } - return points; - - } - - /** - public static ArrayList tesselate(Polygon polygon) - { - ArrayList points = new ArrayList(); - - Tessellator tess = new Tessellator(); - double[] verticesC1 = new double[polygon.points.size()*3]; - for(int i = 0; i< verticesC1.length; i+=3) - { - Point point = polygon.points.get(i/3); - verticesC1[i]= point.x; - verticesC1[i+1]= point.y; - verticesC1[i+2]= 0; - - } - - tess.gluBeginPolygon(); - - for(int i = 0; i vIndex = prim.vertices; - - if(prim.type==GL11.GL_TRIANGLE_STRIP) - { - for(Integer ii = 0; ii < vIndex.size()-1;ii++) - { - points.add(new Point((int)verticesC1[vIndex.get(ii)*3],(int) verticesC1[vIndex.get(ii)*3+1])); - points.add(new Point((int)verticesC1[vIndex.get(ii+1)*3],(int) verticesC1[vIndex.get(ii+1)*3+1])); - - - } - } - - if(prim.type==GL11.GL_TRIANGLES) - { - for(Integer ii = 0; ii < vIndex.size();ii++) - { - points.add(new Point((int)verticesC1[vIndex.get(ii)*3],(int) verticesC1[vIndex.get(ii)*3+1])); - } - } - - - - - - { - if(prim.type==GL11.GL_TRIANGLE_FAN) - { - Integer firstIndex = vIndex.get(0); - // points.add(new Point((int)verticesC1[vIndex.get(firstIndex)],(int) verticesC1[vIndex.get(firstIndex)+1])); - - Integer[] vertexList = new Integer[vIndex.size()*3]; - for(Integer ii = 0; ii < vIndex.size()-2;ii++) - { - vertexList[ii*3] = vIndex.get(0); - vertexList[ii*3+1] = vIndex.get(ii+1); - vertexList[ii*3+2] = vIndex.get(ii+2); - - - - - } - - for(Integer vertex : vertexList) - { - if(vertex!=null) - { - points.add(new Point((int)(verticesC1[vertex*3]),(int)(verticesC1[vertex*3+1]))); - - } - else - { - break; - } - } - System.out.println(vertexList); - - - } - - //points.add(new Point((int)verticesC1[vIndex.get(firstIndex)],(int) verticesC1[vIndex.get(firstIndex)+1])); - // points.add(new Point((int)verticesC1[vIndex.get(ii)*3],(int) verticesC1[vIndex.get(ii)+1])); - // points.add(new Point((int)verticesC1[vIndex.get(ii+1)*3],(int) verticesC1[vIndex.get(ii+1)*3+1])); - - // points.add(new Point((int)verticesC1[index],(int)verticesC1[index+1])); - // System.out.println(verticesC1[index]+","+verticesC1[index+1]+","+verticesC1[index+2]); - - - - } - //System.out.println(tess.primitives.get(i).toString()); - } - return points; - - } - **/ -} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/watcher/ClientDimData.java b/src/main/java/StevenDimDoors/mod_pocketDim/watcher/ClientDimData.java index aaf6aef..1a8eb17 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/watcher/ClientDimData.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/watcher/ClientDimData.java @@ -1,8 +1,7 @@ package StevenDimDoors.mod_pocketDim.watcher; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; +import java.io.*; + import StevenDimDoors.mod_pocketDim.core.DimensionType; import StevenDimDoors.mod_pocketDim.core.NewDimData; @@ -27,14 +26,14 @@ public class ClientDimData this.type = dimension.type(); } - public void write(DataOutputStream output) throws IOException + public void write(DataOutput output) throws IOException { output.writeInt(ID); output.writeInt(rootID); output.writeInt(type.index); } - public static ClientDimData read(DataInputStream input) throws IOException + public static ClientDimData read(DataInput input) throws IOException { int id = input.readInt(); int rootID = input.readInt(); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java b/src/main/java/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java index c23c137..c4e9bbd 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/watcher/ClientLinkData.java @@ -1,12 +1,12 @@ package StevenDimDoors.mod_pocketDim.watcher; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; +import java.io.*; + import StevenDimDoors.mod_pocketDim.core.DDLock; import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.LinkType; import StevenDimDoors.mod_pocketDim.util.Point4D; +import net.minecraft.nbt.NBTTagCompound; public class ClientLinkData { @@ -36,7 +36,7 @@ public class ClientLinkData } - public void write(DataOutputStream output) throws IOException + public void write(DataOutput output) throws IOException { Point4D.write(point, output); output.writeInt(this.type.index); @@ -50,7 +50,24 @@ public class ClientLinkData } } - public static ClientLinkData read(DataInputStream input) throws IOException + public void writeToNBT(NBTTagCompound tag) { + tag.setInteger("Type", this.type.index); + + if (this.lock != null) { + NBTTagCompound lock = new NBTTagCompound(); + lock.setBoolean("State", this.lock.getLockState()); + lock.setInteger("Key", this.lock.getLockKey()); + tag.setTag("Lock", lock); + } + + if (this.point != null) { + NBTTagCompound point = new NBTTagCompound(); + Point4D.writeToNBT(this.point, point); + tag.setTag("Point", point); + } + } + + public static ClientLinkData read(DataInput input) throws IOException { Point4D point = Point4D.read(input); LinkType type = LinkType.getLinkTypeFromIndex(input.readInt()); @@ -61,4 +78,17 @@ public class ClientLinkData } return new ClientLinkData(point, type, lock); } + + public static ClientLinkData readFromNBT(NBTTagCompound tag) { + LinkType type = LinkType.getLinkTypeFromIndex(tag.getInteger("Type")); + Point4D point = null; + if (tag.hasKey("Point")) + point = Point4D.readFromNBT(tag.getCompoundTag("Point")); + DDLock lock = null; + if (tag.hasKey("Lock")) { + NBTTagCompound lockTag = tag.getCompoundTag("Lock"); + lock = new DDLock(lockTag.getBoolean("State"),lockTag.getInteger("Key")); + } + return new ClientLinkData(point, type, lock); + } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/watcher/IUpdateSource.java b/src/main/java/StevenDimDoors/mod_pocketDim/watcher/IUpdateSource.java deleted file mode 100644 index f8dd404..0000000 --- a/src/main/java/StevenDimDoors/mod_pocketDim/watcher/IUpdateSource.java +++ /dev/null @@ -1,8 +0,0 @@ -package StevenDimDoors.mod_pocketDim.watcher; - -import StevenDimDoors.mod_pocketDim.util.Point4D; - -public interface IUpdateSource -{ - public void registerWatchers(IUpdateWatcher dimWatcher, IUpdateWatcher linkWatcher); -} diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/CustomCaveGen.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/CustomCaveGen.java index 1f9b680..0b0b017 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/CustomCaveGen.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/CustomCaveGen.java @@ -2,7 +2,9 @@ package StevenDimDoors.mod_pocketDim.world; import java.util.Random; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.MapGenBase; @@ -21,15 +23,15 @@ public class CustomCaveGen extends MapGenBase /** * Generates a larger initial cave node than usual. Called 25% of the time. */ - protected void generateLargeCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10) + protected void generateLargeCaveNode(long par1, int par3, int par4, Block[] blocks, double par6, double par8, double par10) { - this.generateCaveNode(par1, par3, par4, par5ArrayOfByte, par6, par8, par10, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); + this.generateCaveNode(par1, par3, par4, blocks, par6, par8, par10, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); } /** * Generates a node in the current cave system recursion tree. */ - protected void generateCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) + protected void generateCaveNode(long par1, int par3, int par4, Block[] blocks, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) { double var19 = par3 * 16 + 8; double var21 = par4 * 16 + 8; @@ -81,8 +83,8 @@ public class CustomCaveGen extends MapGenBase if (!var54 && par15 == var27 && par12 > 1.0F && par16 > 0) { - this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); - this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); + this.generateCaveNode(var25.nextLong(), par3, par4, blocks, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); + this.generateCaveNode(var25.nextLong(), par3, par4, blocks, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); return; } @@ -151,7 +153,7 @@ public class CustomCaveGen extends MapGenBase if (var44 >= 0 && var44 < 128) { - if (par5ArrayOfByte[var45] == Block.waterMoving.blockID || par5ArrayOfByte[var45] == Block.waterStill.blockID) + if (blocks[var45] == Blocks.flowing_water || blocks[var45] == Blocks.water) { var58 = true; } @@ -185,26 +187,26 @@ public class CustomCaveGen extends MapGenBase if (var51 > -0.7D && var59 * var59 + var51 * var51 + var46 * var46 < 1.0D) { - byte var53 = par5ArrayOfByte[var48]; + Block var53 = blocks[var48]; - if (var53 == Block.grass.blockID) + if (var53 == Blocks.grass) { var49 = true; } - if (var53 == properties.LimboBlockID || var53 == Block.dirt.blockID || var53 == Block.grass.blockID) + if (var53 == mod_pocketDim.blockLimbo || var53 == Blocks.dirt || var53 == Blocks.grass) { if (var50 < 10) { - par5ArrayOfByte[var48] = (byte)Block.lavaMoving.blockID; + blocks[var48] = Blocks.flowing_lava; } else { - par5ArrayOfByte[var48] = 0; + blocks[var48] = Blocks.air; - if (var49 && par5ArrayOfByte[var48 - 1] == Block.dirt.blockID) + if (var49 && blocks[var48 - 1] == Blocks.dirt) { - par5ArrayOfByte[var48 - 1] = this.worldObj.getBiomeGenForCoords(var42 + par3 * 16, var45 + par4 * 16).topBlock; + blocks[var48 - 1] = this.worldObj.getBiomeGenForCoords(var42 + par3 * 16, var45 + par4 * 16).topBlock; } } } @@ -230,7 +232,7 @@ public class CustomCaveGen extends MapGenBase * Recursively called by generate() (generate) and optionally by itself. */ @Override - protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, byte[] par6ArrayOfByte) + protected void func_151538_a(World par1World, int par2, int par3, int par4, int par5, Block[] blocks) { int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(40) + 1) + 1); @@ -248,7 +250,7 @@ public class CustomCaveGen extends MapGenBase if (this.rand.nextInt(4) == 0) { - this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13); + this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, blocks, var9, var11, var13); var15 += this.rand.nextInt(4); } @@ -263,7 +265,7 @@ public class CustomCaveGen extends MapGenBase var19 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F; } - this.generateCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13, var19, var17, var18, 0, 0, 1.0D); + this.generateCaveNode(this.rand.nextLong(), par4, par5, blocks, var9, var11, var13, var19, var17, var18, 0, 0, 1.0D); } } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/DDBiomeGenBase.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/DDBiomeGenBase.java index f6e3428..3bd1b95 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/DDBiomeGenBase.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/DDBiomeGenBase.java @@ -23,7 +23,7 @@ public class DDBiomeGenBase extends BiomeGenBase { for (int k = 0; k < biomes.length; k++) { - if (biomeList[biomes[k]] != null && !(biomeList[biomes[k]] instanceof DDBiomeGenBase)) + if (getBiomeGenArray()[biomes[k]] != null && !(getBiomeGenArray()[biomes[k]] instanceof DDBiomeGenBase)) { // Crash Minecraft to avoid having people complain to us about strange things // that are really the result of silent biome ID conflicts. diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboDecay.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboDecay.java index 13edb19..2669762 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboDecay.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboDecay.java @@ -2,12 +2,15 @@ package StevenDimDoors.mod_pocketDim.world; import java.util.Random; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; +import net.minecraft.init.Blocks; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import StevenDimDoors.mod_pocketDim.config.DDProperties; +import net.minecraftforge.common.ForgeChunkManager; /** * Provides methods for applying Limbo decay. Limbo decay refers to the effect that most blocks placed in Limbo @@ -19,39 +22,51 @@ public class LimboDecay { private static final int DECAY_SPREAD_CHANCE = 50; private static final int CHUNK_SIZE = 16; private static final int SECTION_HEIGHT = 16; - + //Provides a reversed list of the block IDs that blocks cycle through during decay. - private final int[] decaySequence; + private Block[] decaySequence = null; private final Random random; private final DDProperties properties; - private final int[] blocksImmuneToDecay; + private Block[] blocksImmuneToDecay = null; public LimboDecay(DDProperties properties) { - decaySequence = new int[] { - properties.LimboBlockID, - Block.gravel.blockID, - Block.cobblestone.blockID, - Block.stone.blockID - }; - - blocksImmuneToDecay = new int[] { - properties.LimboBlockID, - properties.PermaFabricBlockID, - properties.TransientDoorID, - properties.DimensionalDoorID, - properties.WarpDoorID, - properties.RiftBlockID, - properties.UnstableDoorID, - properties.GoldenDoorID, - properties.GoldenDimensionalDoorID - }; - this.properties = properties; this.random = new Random(); } + public Block[] getDecaySequence() { + if (decaySequence == null) { + decaySequence = new Block[] { + mod_pocketDim.blockLimbo, + Blocks.gravel, + Blocks.cobblestone, + Blocks.stone + }; + } + + return decaySequence; + } + + public Block[] getBlocksImmuneToDecay() { + if (blocksImmuneToDecay == null) { + blocksImmuneToDecay = new Block[] { + mod_pocketDim.blockLimbo, + mod_pocketDim.blockDimWallPerm, + mod_pocketDim.transientDoor, + mod_pocketDim.dimensionalDoor, + mod_pocketDim.warpDoor, + mod_pocketDim.blockRift, + mod_pocketDim.unstableDoor, + mod_pocketDim.goldenDoor, + mod_pocketDim.goldenDimensionalDoor + }; + } + + return blocksImmuneToDecay; + } + /** * Checks the blocks orthogonally around a given location (presumably the location of an Unraveled Fabric block) * and applies Limbo decay to them. This gives the impression that decay spreads outward from Unraveled Fabric. @@ -90,7 +105,7 @@ public class LimboDecay { //Obtain the coordinates of active chunks in Limbo. For each section of each chunk, //pick a random block and try to apply fast decay. - for (Object coordObject : limbo.activeChunkSet) + for (Object coordObject : ForgeChunkManager.getPersistentChunksFor(limbo).keySet()) { ChunkCoordIntPair chunkCoord = (ChunkCoordIntPair) coordObject; @@ -112,10 +127,10 @@ public class LimboDecay { */ private boolean decayBlockFast(World world, int x, int y, int z) { - int blockID = world.getBlockId(x, y, z); - if (canDecayBlock(blockID)) + Block block = world.getBlock(x, y, z); + if (canDecayBlock(block, world, x, y, z)) { - world.setBlock(x, y, z, properties.LimboBlockID); + world.setBlock(x, y, z, mod_pocketDim.blockLimbo); return true; } return false; @@ -127,14 +142,14 @@ public class LimboDecay { private boolean decayBlock(World world, int x, int y, int z) { int index; - int blockID = world.getBlockId(x, y, z); - if (canDecayBlock(blockID)) + Block block = world.getBlock(x, y, z); + if (canDecayBlock(block, world, x, y, z)) { //Loop over the block IDs that decay can go through. //Find an index matching the current blockID, if any. - for (index = 0; index < decaySequence.length; index++) + for (index = 0; index < getDecaySequence().length; index++) { - if (decaySequence[index] == blockID) + if (getDecaySequence()[index] == block) { break; } @@ -146,7 +161,7 @@ public class LimboDecay { //last ID in the array, which is the first one that all blocks decay into. //We assume that Unraveled Fabric is NOT decayable. Otherwise, this will go out of bounds! - world.setBlock(x, y, z, decaySequence[index - 1]); + world.setBlock(x, y, z, getDecaySequence()[index - 1]); return true; } return false; @@ -155,22 +170,21 @@ public class LimboDecay { /** * Checks if a block can decay. We will not decay air, certain DD blocks, or containers. */ - private boolean canDecayBlock(int blockID) + private boolean canDecayBlock(Block block, World world, int x, int y, int z) { - if (blockID == 0) + if (block.isAir(world, x, y, z)) { return false; } - for (int k = 0; k < blocksImmuneToDecay.length; k++) + for (int k = 0; k < getBlocksImmuneToDecay().length; k++) { - if (blockID == blocksImmuneToDecay[k]) + if (block == getBlocksImmuneToDecay()[k]) { return false; } } - - Block block = Block.blocksList[blockID]; + return (block == null || !(block instanceof BlockContainer)); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java index dd3185f..fd22e09 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboGenerator.java @@ -3,7 +3,11 @@ package StevenDimDoors.mod_pocketDim.world; import java.util.List; import java.util.Random; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.block.Block; import net.minecraft.entity.EnumCreatureType; +import net.minecraft.init.Blocks; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkPosition; @@ -13,9 +17,8 @@ import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.ChunkProviderGenerate; import net.minecraft.world.gen.NoiseGeneratorOctaves; -import net.minecraft.world.gen.feature.MapGenScatteredFeature; +import net.minecraft.world.gen.structure.MapGenScatteredFeature; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.terraingen.ChunkProviderEvent; import StevenDimDoors.mod_pocketDim.config.DDProperties; import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator; @@ -119,7 +122,7 @@ public class LimboGenerator extends ChunkProviderGenerate } @Override - public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) + public void replaceBlocksForBiome(int par1, int par2, Block[] blocks, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) { } @@ -129,8 +132,8 @@ public class LimboGenerator extends ChunkProviderGenerate { //TODO: Wtf? Why do you reinitialize the seed when we already initialized it in the constructor?! ~SenseiKiwi LimboGenerator.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L); - byte[] var3 = new byte[32768]; - this.generateTerrain(chunkX, chunkZ, var3); + Block[] var3 = new Block[32768]; + this.func_147424_a(chunkX, chunkZ, var3); Chunk var4 = new Chunk(this.worldObj, var3, chunkX, chunkZ); var4.generateSkylightMap(); @@ -163,7 +166,7 @@ public class LimboGenerator extends ChunkProviderGenerate { ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); MinecraftForge.EVENT_BUS.post(event); - if (event.getResult() == Result.DENY) return event.noisefield; + if (event.getResult() == Event.Result.DENY) return event.noisefield; if (par1ArrayOfDouble == null) { @@ -208,13 +211,13 @@ public class LimboGenerator extends ChunkProviderGenerate { for (int var22 = -var19; var22 <= var19; ++var22) { - float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.minHeight + 9.0F); + float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (BiomeGenBase.plains.rootHeight + 9.0F); //this adjusts the height of the terrain - var16 += BiomeGenBase.plains.maxHeight * var24+4; - var17 += BiomeGenBase.plains.minHeight * var24-1; + var16 += BiomeGenBase.plains.heightVariation * var24+4; + var17 += BiomeGenBase.plains.rootHeight * var24-1; var18 += var24; } } @@ -305,7 +308,7 @@ public class LimboGenerator extends ChunkProviderGenerate return par1ArrayOfDouble; } @Override - public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) + public void func_147424_a(int par1, int par2, Block[] blocks) { byte var4 = 4; byte var5 = 16; @@ -353,16 +356,16 @@ public class LimboGenerator extends ChunkProviderGenerate { if ((var47 += var49) > 0.0D) { - par3ArrayOfByte[var43 += var44] = (byte)properties.LimboBlockID; + blocks[var43 += var44] = mod_pocketDim.blockLimbo; } else if (var12 * 8 + var31 < var6) { - par3ArrayOfByte[var43 += var44] = (byte)properties.PermaFabricBlockID; + blocks[var43 += var44] = mod_pocketDim.blockDimWallPerm; } else { - par3ArrayOfByte[var43 += var44] = 0; + blocks[var43 += var44] = Blocks.air; } } @@ -402,7 +405,7 @@ public class LimboGenerator extends ChunkProviderGenerate } @Override - public ChunkPosition findClosestStructure(World var1, String var2, + public ChunkPosition func_147416_a(World var1, String var2, int var3, int var4, int var5) { // TODO Auto-generated method stub return null; diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboProvider.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboProvider.java index 9e22053..381fcb2 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboProvider.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/LimboProvider.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.world; import java.util.Random; +import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -50,7 +51,7 @@ public class LimboProvider extends WorldProvider @Override protected void registerWorldChunkManager() { - super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1,1); + super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.limboBiome,1); } @Override @@ -73,7 +74,7 @@ public class LimboProvider extends WorldProvider @Override - public boolean canSnowAt(int x, int y, int z) + public boolean canSnowAt(int x, int y, int z, boolean checkLight) { return false; } @@ -136,8 +137,8 @@ public class LimboProvider extends WorldProvider @Override public boolean canCoordinateBeSpawn(int par1, int par2) { - int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2); - return var3 == properties.LimboBlockID; + Block block = this.worldObj.getTopBlock(par1, par2); + return block == mod_pocketDim.blockLimbo; } @Override public double getHorizon() @@ -148,14 +149,14 @@ public class LimboProvider extends WorldProvider public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) { setCloudRenderer( new CloudRenderBlank()); - return this.worldObj.getWorldVec3Pool().getVecFromPool(0, 0, 0); + return Vec3.createVectorHelper(0, 0, 0); } @SideOnly(Side.CLIENT) @Override public Vec3 getFogColor(float par1, float par2) { - return this.worldObj.getWorldVec3Pool().getVecFromPool(.2, .2, .2); + return Vec3.createVectorHelper(.2, .2, .2); } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/PersonalPocketProvider.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/PersonalPocketProvider.java index 8f1b824..6f42518 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/PersonalPocketProvider.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/PersonalPocketProvider.java @@ -31,7 +31,7 @@ public class PersonalPocketProvider extends PocketProvider public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) { setCloudRenderer( new CloudRenderBlank()); - return this.worldObj.getWorldVec3Pool().getVecFromPool(1,1,1); + return Vec3.createVectorHelper(1,1,1); } public boolean isSurfaceWorld() @@ -61,7 +61,7 @@ public class PersonalPocketProvider extends PocketProvider @Override public Vec3 getFogColor(float par1, float par2) { - return this.worldObj.getWorldVec3Pool().getVecFromPool(1,1,1); + return Vec3.createVectorHelper(1,1,1); } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java index 6f9b946..adb002f 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketBuilder.java @@ -4,6 +4,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -264,7 +265,7 @@ public class PocketBuilder } //Check if the block below that point is actually a door - Block block = Block.blocksList[world.getBlockId(source.getX(), source.getY() - 1, source.getZ())]; + Block block = world.getBlock(source.getX(), source.getY() - 1, source.getZ()); if (block==null || !(block instanceof IDimDoor)) { throw new IllegalStateException("The link's source is not a door block. It should be impossible to traverse a rift without a door!"); @@ -285,7 +286,7 @@ public class PocketBuilder { throw new IllegalArgumentException("properties cannot be null."); } - if (link.hasDestination()) + if (link.linkType() != LinkType.PERSONAL && link.hasDestination()) { throw new IllegalArgumentException("link cannot have a destination assigned already."); } @@ -322,7 +323,7 @@ public class PocketBuilder * @param door * @return */ - public static boolean generateNewPersonalPocket(DimLink link, DDProperties properties,Entity player, Block door) + public static boolean generateNewPersonalPocket(DimLink link, DDProperties properties,EntityPlayer player, Block door) { //incase a chicken walks in or something if(!(player instanceof EntityPlayer)) @@ -338,7 +339,7 @@ public class PocketBuilder { //Register a new dimension NewDimData parent = PocketManager.getDimensionData(link.source().getDimension()); - NewDimData dimension = PocketManager.registerPocket(parent, DimensionType.PERSONAL, player.getEntityName()); + NewDimData dimension = PocketManager.registerPocket(parent, DimensionType.PERSONAL, player.getGameProfile().getId().toString()); //Load a world @@ -454,7 +455,7 @@ public class PocketBuilder BlockRotator.transformPoint(center, door, orientation - BlockRotator.EAST_DOOR_METADATA, door); //Build the outer layer of Eternal Fabric - buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), properties.PermaFabricBlockID, 0, false, 0); + buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2), mod_pocketDim.blockDimWallPerm, 0, false, 0); //check if we are building a personal pocket int metadata = 0; @@ -466,19 +467,19 @@ public class PocketBuilder //Build the (wallThickness - 1) layers of Fabric of Reality for (int layer = 1; layer < wallThickness; layer++) { - buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, mod_pocketDim.blockDimWall.blockID, metadata, + buildBox(world, center.getX(), center.getY(), center.getZ(), (size / 2) - layer, mod_pocketDim.blockDimWall, metadata, layer < (wallThickness - 1) && properties.TNFREAKINGT_Enabled, properties.NonTntWeight); } //MazeBuilder.generate(world, x, y, z, random); //Build the door - int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, doorBlock.blockID); + int doorOrientation = BlockRotator.transformMetadata(BlockRotator.EAST_DOOR_METADATA, orientation - BlockRotator.EAST_DOOR_METADATA + 2, doorBlock); ItemDimensionalDoor.placeDoorBlock(world, x, y - 1, z, doorOrientation, doorBlock); } - private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, int blockID, int metadata, boolean placeTnt, int nonTntWeight) + private static void buildBox(World world, int centerX, int centerY, int centerZ, int radius, Block block, int metadata, boolean placeTnt, int nonTntWeight) { int x, y, z; @@ -495,14 +496,14 @@ public class PocketBuilder { for (z = startZ; z <= endZ; z++) { - setBlockDirectlySpecial(world, x, startY, z, blockID, metadata, placeTnt, nonTntWeight); - setBlockDirectlySpecial(world, x, endY, z, blockID, metadata, placeTnt, nonTntWeight); + setBlockDirectlySpecial(world, x, startY, z, block, metadata, placeTnt, nonTntWeight); + setBlockDirectlySpecial(world, x, endY, z, block, metadata, placeTnt, nonTntWeight); } for (y = startY; y <= endY; y++) { - setBlockDirectlySpecial(world, x, y, startZ, blockID, metadata, placeTnt, nonTntWeight); - setBlockDirectlySpecial(world, x, y, endZ, blockID, metadata, placeTnt, nonTntWeight); + setBlockDirectlySpecial(world, x, y, startZ, block, metadata, placeTnt, nonTntWeight); + setBlockDirectlySpecial(world, x, y, endZ, block, metadata, placeTnt, nonTntWeight); } } @@ -510,31 +511,26 @@ public class PocketBuilder { for (z = startZ; z <= endZ; z++) { - setBlockDirectlySpecial(world, startX, y, z, blockID, metadata, placeTnt, nonTntWeight); - setBlockDirectlySpecial(world, endX, y, z, blockID, metadata, placeTnt, nonTntWeight); + setBlockDirectlySpecial(world, startX, y, z, block, metadata, placeTnt, nonTntWeight); + setBlockDirectlySpecial(world, endX, y, z, block, metadata, placeTnt, nonTntWeight); } } } - private static void setBlockDirectlySpecial(World world, int x, int y, int z, int blockID, int metadata, boolean placeTnt, int nonTntWeight) + private static void setBlockDirectlySpecial(World world, int x, int y, int z, Block block, int metadata, boolean placeTnt, int nonTntWeight) { if (placeTnt && random.nextInt(nonTntWeight + 1) == 0) { - setBlockDirectly(world, x, y, z, Block.tnt.blockID, 1); + setBlockDirectly(world, x, y, z, Blocks.tnt, 1); } else { - setBlockDirectly(world, x, y, z, blockID, metadata); + setBlockDirectly(world, x, y, z, block, metadata); } } - private static void setBlockDirectly(World world, int x, int y, int z, int blockID, int metadata) + private static void setBlockDirectly(World world, int x, int y, int z, Block block, int metadata) { - if (blockID != 0 && Block.blocksList[blockID] == null) - { - return; - } - int cX = x >> 4; int cZ = z >> 4; int cY = y >> 4; @@ -551,7 +547,7 @@ public class PocketBuilder extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky); chunk.getBlockStorageArray()[cY] = extBlockStorage; } - extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID); + extBlockStorage.func_150818_a(localX, y & 15, localZ, block); extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata); chunk.setChunkModified(); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java index df99d03..de7e801 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketGenerator.java @@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.world; import java.util.List; +import net.minecraft.block.Block; import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; @@ -27,7 +28,7 @@ public class PocketGenerator extends ChunkProviderGenerate } @Override - public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) + public void func_147424_a(int par1, int par2, Block[] blocks) { } @@ -41,7 +42,7 @@ public class PocketGenerator extends ChunkProviderGenerate @Override public Chunk provideChunk(int chunkX, int chunkZ) { - byte[] var3 = new byte[32768]; + Block[] var3 = new Block[32768]; Chunk chunk = new Chunk(worldObj, var3, chunkX, chunkZ); if(!chunk.isTerrainPopulated) @@ -77,7 +78,7 @@ public class PocketGenerator extends ChunkProviderGenerate } @Override - public ChunkPosition findClosestStructure(World var1, String var2, int var3, int var4, int var5) + public ChunkPosition func_147416_a(World var1, String var2, int var3, int var4, int var5) { return null; } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketProvider.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketProvider.java index dd6e787..bebaac7 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketProvider.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/PocketProvider.java @@ -34,7 +34,7 @@ public class PocketProvider extends WorldProvider @Override protected void registerWorldChunkManager() { - super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome, 1, 1); + super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome, 1); } @Override @@ -47,14 +47,14 @@ public class PocketProvider extends WorldProvider public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) { setCloudRenderer( new CloudRenderBlank()); - return this.worldObj.getWorldVec3Pool().getVecFromPool(0d, 0d, 0d); + return Vec3.createVectorHelper(0d, 0d, 0d); } @SideOnly(Side.CLIENT) @Override public Vec3 getFogColor(float par1, float par2) { - return this.worldObj.getWorldVec3Pool().getVecFromPool(0d, 0d, 0d); + return Vec3.createVectorHelper(0d, 0d, 0d); } @Override @@ -70,7 +70,7 @@ public class PocketProvider extends WorldProvider } @Override - public boolean canSnowAt(int x, int y, int z) + public boolean canSnowAt(int x, int y, int z, boolean light) { return false; } @@ -89,7 +89,7 @@ public class PocketProvider extends WorldProvider @Override protected void generateLightBrightnessTable() { - if(PocketManager.getDimensionData(this.dimensionId).type() == DimensionType.POCKET) + if(!PocketManager.isLoaded() || PocketManager.getDimensionData(this.dimensionId).type() == DimensionType.POCKET) { super.generateLightBrightnessTable(); return; diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/ComponentNetherGateway.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/ComponentNetherGateway.java index 245071e..4a5758d 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/ComponentNetherGateway.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/ComponentNetherGateway.java @@ -2,7 +2,7 @@ package StevenDimDoors.mod_pocketDim.world.fortresses; import java.util.List; import java.util.Random; -import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemDoor; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -71,75 +71,75 @@ public class ComponentNetherGateway extends StructureComponent int NETHER_SLAB_METADATA = 6; // Set all the blocks in the area of the room to air - this.fillWithBlocks(world, bounds, 0, 2, 0, 6, 6, 6, 0, 0, false); + this.fillWithBlocks(world, bounds, 0, 2, 0, 6, 6, 6, Blocks.air, Blocks.air, false); // Set up the platform under the gateway - this.fillWithBlocks(world, bounds, 0, 0, 0, 6, 1, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(world, bounds, 0, 0, 0, 6, 1, 6, Blocks.nether_brick, Blocks.nether_brick, false); // Build the fence at the back of the room - this.fillWithBlocks(world, bounds, 1, 2, 6, 5, 2, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); - this.fillWithBlocks(world, bounds, 1, 3, 6, 5, 3, 6, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(world, bounds, 1, 2, 6, 5, 2, 6, Blocks.nether_brick, Blocks.nether_brick, false); + this.fillWithBlocks(world, bounds, 1, 3, 6, 5, 3, 6, Blocks.nether_brick_fence, Blocks.nether_brick_fence, false); // Build the fences at the sides of the room - this.fillWithBlocks(world, bounds, 0, 2, 0, 0, 2, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); - this.fillWithBlocks(world, bounds, 0, 3, 0, 0, 3, 6, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(world, bounds, 0, 2, 0, 0, 2, 6, Blocks.nether_brick, Blocks.nether_brick, false); + this.fillWithBlocks(world, bounds, 0, 3, 0, 0, 3, 6, Blocks.nether_brick_fence, Blocks.nether_brick_fence, false); - this.fillWithBlocks(world, bounds, 6, 2, 0, 6, 2, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); - this.fillWithBlocks(world, bounds, 6, 3, 0, 6, 3, 6, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(world, bounds, 6, 2, 0, 6, 2, 6, Blocks.nether_brick, Blocks.nether_brick, false); + this.fillWithBlocks(world, bounds, 6, 3, 0, 6, 3, 6, Blocks.nether_brick_fence, Blocks.nether_brick_fence, false); // Build the fence portions closest to the entrance - this.placeBlockAtCurrentPosition(world, Block.netherBrick.blockID, 0, 1, 2, 0, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 1, 3, 0, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick, 0, 1, 2, 0, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 1, 3, 0, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherBrick.blockID, 0, 5, 2, 0, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 5, 3, 0, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick, 0, 5, 2, 0, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 5, 3, 0, bounds); // Build the first layer of the gateway - this.fillWithBlocks(world, bounds, 1, 2, 2, 5, 2, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); - this.fillWithMetadataBlocks(world, bounds, 1, 2, 1, 5, 2, 1, Block.stoneSingleSlab.blockID, NETHER_SLAB_METADATA, Block.stoneSingleSlab.blockID, NETHER_SLAB_METADATA, false); + this.fillWithBlocks(world, bounds, 1, 2, 2, 5, 2, 5, Blocks.nether_brick, Blocks.nether_brick, false); + this.fillWithMetadataBlocks(world, bounds, 1, 2, 1, 5, 2, 1, Blocks.stone_slab, NETHER_SLAB_METADATA, Blocks.stone_slab, NETHER_SLAB_METADATA, false); - this.placeBlockAtCurrentPosition(world, Block.stoneSingleSlab.blockID, NETHER_SLAB_METADATA, 1, 2, 2, bounds); - this.placeBlockAtCurrentPosition(world, Block.stoneSingleSlab.blockID, NETHER_SLAB_METADATA, 5, 2, 2, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, NETHER_SLAB_METADATA, 1, 2, 2, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, NETHER_SLAB_METADATA, 5, 2, 2, bounds); // Build the second layer of the gateway - int orientation = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 2); - this.fillWithBlocks(world, bounds, 2, 3, 3, 2, 3, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); - this.fillWithBlocks(world, bounds, 4, 3, 3, 4, 3, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); - this.placeBlockAtCurrentPosition(world, Block.netherBrick.blockID, 0, 3, 3, 4, bounds); - this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, orientation, 3, 3, 5, bounds); + int orientation = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 2); + this.fillWithBlocks(world, bounds, 2, 3, 3, 2, 3, 4, Blocks.nether_brick, Blocks.nether_brick, false); + this.fillWithBlocks(world, bounds, 4, 3, 3, 4, 3, 4, Blocks.nether_brick, Blocks.nether_brick, false); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick, 0, 3, 3, 4, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, orientation, 3, 3, 5, bounds); // Build the third layer of the gateway // We add 4 to get the rotated metadata for upside-down stairs // because Minecraft only supports metadata rotations for normal stairs -_- - this.fillWithMetadataBlocks(world, bounds, 2, 4, 4, 4, 4, 4, Block.stairsNetherBrick.blockID, orientation, Block.stairsNetherBrick.blockID, orientation, false); + this.fillWithMetadataBlocks(world, bounds, 2, 4, 4, 4, 4, 4, Blocks.nether_brick_stairs, orientation, Blocks.nether_brick_stairs, orientation, false); - this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 0) + 4, 2, 4, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 1) + 4, 4, 4, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 0) + 4, 2, 4, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 1) + 4, 4, 4, 3, bounds); // Build the fourth layer of the gateway - this.placeBlockAtCurrentPosition(world, Block.netherBrick.blockID, 0, 3, 5, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick, 0, 3, 5, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherrack.blockID, 0, 2, 5, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 0) + 4, 1, 5, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 3) + 4, 2, 5, 2, bounds); - this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 2) + 4, 2, 5, 4, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.netherrack, 0, 2, 5, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 0) + 4, 1, 5, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 3) + 4, 2, 5, 2, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 2) + 4, 2, 5, 4, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherrack.blockID, 0, 4, 5, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 1) + 4, 5, 5, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 3) + 4, 4, 5, 2, bounds); - this.placeBlockAtCurrentPosition(world, Block.stairsNetherBrick.blockID, this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 2) + 4, 4, 5, 4, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.netherrack, 0, 4, 5, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 1) + 4, 5, 5, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 3) + 4, 4, 5, 2, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_stairs, this.getMetadataWithOffset(Blocks.nether_brick_stairs, 2) + 4, 4, 5, 4, bounds); // Build the top layer of the gateway - this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 3, 6, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 3, 6, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.fire.blockID, 0, 2, 6, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 1, 6, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 2, 6, 2, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 2, 6, 4, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.fire, 0, 2, 6, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 1, 6, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 2, 6, 2, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 2, 6, 4, bounds); - this.placeBlockAtCurrentPosition(world, Block.fire.blockID, 0, 4, 6, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 5, 6, 3, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 4, 6, 2, bounds); - this.placeBlockAtCurrentPosition(world, Block.netherFence.blockID, 0, 4, 6, 4, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.fire, 0, 4, 6, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 5, 6, 3, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 4, 6, 2, bounds); + this.placeBlockAtCurrentPosition(world, Blocks.nether_brick_fence, 0, 4, 6, 4, bounds); // Place the transient door int y = this.getYWithOffset(3); @@ -152,7 +152,7 @@ public class ComponentNetherGateway extends StructureComponent // due to the way Minecraft handles structure generation! if (bounds.isVecInside(x, y, z) && bounds.isVecInside(x, y + 1, z)) { - orientation = this.getMetadataWithOffset(Block.doorWood.blockID, 1); + orientation = this.getMetadataWithOffset(Blocks.wooden_door, 1); dimension = PocketManager.createDimensionData(world); link = dimension.getLink(x, y + 1, z); if (link == null) @@ -166,7 +166,7 @@ public class ComponentNetherGateway extends StructureComponent { for (z = 0; z <= 6; ++z) { - this.fillCurrentPositionBlocksDownwards(world, Block.netherBrick.blockID, 0, x, -1, z, bounds); + this.func_151554_b(world, Blocks.nether_brick, 0, x, -1, z, bounds); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDNetherFortressGenerator.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDNetherFortressGenerator.java index 9531939..0d63af0 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDNetherFortressGenerator.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDNetherFortressGenerator.java @@ -15,7 +15,7 @@ public class DDNetherFortressGenerator extends MapGenNetherBridge // If we don't do this, Minecraft will crash when a fortress tries to generate. // Moreover, use Fortress as our structure identifier so that if DD is removed, // fortresses will generate properly using Vanilla code. - MapGenStructureIO.func_143034_b(DDStructureNetherBridgeStart.class, "Fortress"); + MapGenStructureIO.func_143031_a(DDStructureNetherBridgeStart.class, "Fortress"); } @Override diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDStructureNetherBridgeStart.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDStructureNetherBridgeStart.java index 2778197..a10f2de 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDStructureNetherBridgeStart.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/fortresses/DDStructureNetherBridgeStart.java @@ -6,13 +6,13 @@ import java.util.Random; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -import net.minecraft.world.gen.structure.ComponentNetherBridgeThrone; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; -import net.minecraft.world.gen.structure.StructureNetherBridgeStart; import StevenDimDoors.mod_pocketDim.config.DDProperties; +import net.minecraft.world.gen.structure.StructureNetherBridgePieces; +import net.minecraft.world.gen.structure.StructureStart; -public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart +public class DDStructureNetherBridgeStart extends StructureStart { public static final int MAX_GATEWAY_GENERATION_CHANCE = 100; @@ -26,26 +26,26 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart public DDStructureNetherBridgeStart(World world, Random random, int chunkX, int chunkZ, DDProperties properties) { // StructureNetherBridgeStart handles designing the fortress for us - super(world, random, chunkX, chunkZ); + super(chunkX, chunkZ); Iterator componentIterator; StructureComponent component; StructureBoundingBox bounds; - ArrayList spawnerRooms; + ArrayList spawnerRooms; hasGateway = false; // Randomly decide whether to build a gateway in this fortress if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < properties.FortressGatewayGenerationChance) { // Search for all the blaze spawners in a fortress - spawnerRooms = new ArrayList(); + spawnerRooms = new ArrayList(); componentIterator = this.components.iterator(); while (componentIterator.hasNext()) { component = (StructureComponent) componentIterator.next(); - if (component instanceof ComponentNetherBridgeThrone) + if (component instanceof StructureNetherBridgePieces.Throne) { - spawnerRooms.add((ComponentNetherBridgeThrone) component); + spawnerRooms.add((StructureNetherBridgePieces.Throne) component); } } @@ -78,7 +78,7 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart dimensionalTag.setInteger("GatewayMinY", this.minY); dimensionalTag.setInteger("GatewayMinZ", this.minZ); } - fortressTag.setCompoundTag("DimensionalDoors", dimensionalTag); + fortressTag.setTag("DimensionalDoors", dimensionalTag); return fortressTag; } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayBlockFilter.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayBlockFilter.java index 04ee966..70c07ea 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayBlockFilter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayBlockFilter.java @@ -3,8 +3,10 @@ package StevenDimDoors.mod_pocketDim.world.gateways; import java.util.ArrayList; import StevenDimDoors.mod_pocketDim.Point3D; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.schematic.Schematic; import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter; +import net.minecraft.block.Block; public class GatewayBlockFilter extends SchematicFilter { @@ -33,41 +35,41 @@ public class GatewayBlockFilter extends SchematicFilter { } @Override - protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata) + protected boolean initialize(Schematic schematic, Block[] blocks, byte[] metadata) { this.schematic = schematic; return true; } @Override - protected boolean applyToBlock(int index, short[] blocks, byte[] metadata) + protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata) { int indexBelow; int indexDoubleBelow; - if (blocks[index] == STANDARD_DIMENSIONAL_DOOR_ID) + if (blocks[index] == mod_pocketDim.dimensionalDoor) { indexBelow = schematic.calculateIndexBelow(index); - if (indexBelow >= 0 && blocks[indexBelow] == STANDARD_DIMENSIONAL_DOOR_ID) + if (indexBelow >= 0 && blocks[indexBelow] == mod_pocketDim.dimensionalDoor) { entranceDoorLocation = schematic.calculatePoint(index); entranceOrientation = (metadata[indexBelow] & 3); return true; } } - if (blocks[index] == STANDARD_TRANSIENT_DOOR_ID) + if (blocks[index] == mod_pocketDim.transientDoor) { indexBelow = schematic.calculateIndexBelow(index); - if (indexBelow >= 0 && blocks[indexBelow] == STANDARD_TRANSIENT_DOOR_ID) + if (indexBelow >= 0 && blocks[indexBelow] == mod_pocketDim.transientDoor) { entranceDoorLocation = schematic.calculatePoint(index); entranceOrientation = (metadata[indexBelow] & 3); return true; } } - if (blocks[index] == STANDARD_WARP_DOOR_ID) + if (blocks[index] == mod_pocketDim.warpDoor) { indexBelow = schematic.calculateIndexBelow(index); - if (indexBelow >= 0 && blocks[indexBelow] == STANDARD_WARP_DOOR_ID) + if (indexBelow >= 0 && blocks[indexBelow] == mod_pocketDim.warpDoor) { entranceDoorLocation = schematic.calculatePoint(index); entranceOrientation = (metadata[indexBelow] & 3); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayGenerator.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayGenerator.java index 4e2c756..7b33283 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayGenerator.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayGenerator.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.common.DimensionManager; @@ -97,9 +98,9 @@ public class GatewayGenerator implements IWorldGenerator //If the point is within the acceptable altitude range, the block above is empty, and we're //not building on bedrock, then generate a rift there if (y >= MIN_RIFT_Y && y <= MAX_RIFT_Y && world.isAirBlock(x, y + 1, z) && - world.getBlockId(x, y, z) != Block.bedrock.blockID && //<-- Stops Nether roof spawning. DO NOT REMOVE! - world.getBlockId(x, y - 1, z) != Block.bedrock.blockID && - world.getBlockId(x, y - 2, z) != Block.bedrock.blockID) + world.getBlock(x, y, z) != Blocks.bedrock && //<-- Stops Nether roof spawning. DO NOT REMOVE! + world.getBlock(x, y - 1, z) != Blocks.bedrock && + world.getBlock(x, y - 2, z) != Blocks.bedrock) { //Create a link. If this is not the first time, create a child link and connect it to the first link. if (link == null) @@ -165,8 +166,8 @@ public class GatewayGenerator implements IWorldGenerator return (y >= MIN_RIFT_Y && y <= MAX_RIFT_Y && world.isAirBlock(x, y + 1, z) && - world.getBlockId(x, y, z) != Block.bedrock.blockID && //<-- Stops Nether roof spawning. DO NOT REMOVE! - world.getBlockId(x, y - 1, z) != Block.bedrock.blockID && + world.getBlock(x, y, z) != Blocks.bedrock && //<-- Stops Nether roof spawning. DO NOT REMOVE! + world.getBlock(x, y - 1, z) != Blocks.bedrock && checkFoundationMaterial(world, x, y - 2, z)); } @@ -175,8 +176,8 @@ public class GatewayGenerator implements IWorldGenerator //We check the material and opacity to prevent generating gateways on top of trees or houses, //or on top of strange things like tall grass, water, slabs, or torches. //We also want to avoid generating things on top of the Nether's bedrock! - Material material = world.getBlockMaterial(x, y, z); - return (material != Material.leaves && material != Material.wood && material != Material.pumpkin - && world.isBlockOpaqueCube(x, y, z) && world.getBlockId(x, y, z) != Block.bedrock.blockID); + Material material = world.getBlock(x, y, z).getMaterial(); + return (material != Material.leaves && material != Material.wood && material != Material.gourd + && world.isBlockNormalCubeDefault(x, y, z, false) && world.getBlock(x, y, z) != Blocks.bedrock); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayLimbo.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayLimbo.java index 6a3ec04..c9e77e7 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayLimbo.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayLimbo.java @@ -1,5 +1,6 @@ package StevenDimDoors.mod_pocketDim.world.gateways; +import net.minecraft.block.Block; import net.minecraft.item.ItemDoor; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.mod_pocketDim; @@ -18,17 +19,17 @@ public class GatewayLimbo extends BaseGateway @Override public boolean generate(World world, int x, int y, int z) { - int blockID = mod_pocketDim.blockLimbo.blockID; + Block block = mod_pocketDim.blockLimbo; // Build the gateway out of Unraveled Fabric. Since nearly all the blocks in Limbo are of // that type, there is no point replacing the ground. - world.setBlock(x, y + 3, z + 1, blockID, 0, 3); - world.setBlock(x, y + 3, z - 1, blockID, 0, 3); + world.setBlock(x, y + 3, z + 1, block, 0, 3); + world.setBlock(x, y + 3, z - 1, block, 0, 3); // Build the columns around the door - world.setBlock(x, y + 2, z - 1, blockID, 0, 3); - world.setBlock(x, y + 2, z + 1, blockID, 0, 3); - world.setBlock(x, y + 1, z - 1, blockID, 0, 3); - world.setBlock(x, y + 1, z + 1, blockID, 0, 3); + world.setBlock(x, y + 2, z - 1, block, 0, 3); + world.setBlock(x, y + 2, z + 1, block, 0, 3); + world.setBlock(x, y + 1, z - 1, block, 0, 3); + world.setBlock(x, y + 1, z + 1, block, 0, 3); PocketManager.getDimensionData(world).createLink(x, y + 2, z, LinkType.DUNGEON, 0); diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayTwoPillars.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayTwoPillars.java index 13507a4..42d22fa 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayTwoPillars.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayTwoPillars.java @@ -1,6 +1,7 @@ package StevenDimDoors.mod_pocketDim.world.gateways; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.config.DDProperties; @@ -16,7 +17,7 @@ public class GatewayTwoPillars extends BaseSchematicGateway @Override protected void generateRandomBits(World world, int x, int y, int z) { - final int blockID = Block.stoneBrick.blockID; + final Block block = Blocks.stonebrick; //Replace some of the ground around the gateway with bricks for (int xc = -GATEWAY_RADIUS; xc <= GATEWAY_RADIUS; xc++) @@ -26,19 +27,19 @@ public class GatewayTwoPillars extends BaseSchematicGateway //Check that the block is supported by an opaque block. //This prevents us from building over a cliff, on the peak of a mountain, //or the surface of the ocean or a frozen lake. - if (world.isBlockOpaqueCube(x + xc, y - 1, z + zc)) + if (world.isBlockNormalCubeDefault(x + xc, y - 1, z + zc, false)) { //Randomly choose whether to place bricks or not. The math is designed so that the //chances of placing a block decrease as we get farther from the gateway's center. if (Math.abs(xc) + Math.abs(zc) < world.rand.nextInt(2) + 3) { //Place Stone Bricks - world.setBlock(x + xc, y, z + zc, blockID, 0, 3); + world.setBlock(x + xc, y, z + zc, block, 0, 3); } else if (Math.abs(xc) + Math.abs(zc) < world.rand.nextInt(3) + 3) { //Place Cracked Stone Bricks - world.setBlock(x + xc, y, z + zc, blockID, 2, 3); + world.setBlock(x + xc, y, z + zc, block, 2, 3); } } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientOnlyHooks.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientOnlyHooks.java new file mode 100644 index 0000000..24d2622 --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientOnlyHooks.java @@ -0,0 +1,53 @@ +package StevenDimDoors.mod_pocketDimClient; + +import StevenDimDoors.mod_pocketDim.config.DDProperties; +import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.common.eventhandler.Event; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.ISound; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.sound.PlaySoundEvent17; +import net.minecraftforge.event.world.WorldEvent; + +public class ClientOnlyHooks { + private DDProperties properties; + + private ISound limboMusic; + + public ClientOnlyHooks(DDProperties properties) { + this.properties = properties; + this.limboMusic = PositionedSoundRecord.func_147673_a(new ResourceLocation(mod_pocketDim.modid + ":creepy")); + } + + + @SideOnly(Side.CLIENT) + @SubscribeEvent + public void onSoundEffectResult(PlaySoundEvent17 event) + { + ResourceLocation playingSound = event.sound.getPositionedSoundLocation(); + if (playingSound != null && playingSound.getResourceDomain().equals("minecraft") && (playingSound.getResourcePath().equals("music.game") || playingSound.getResourcePath().equals("music.game.creative"))) { + if (FMLClientHandler.instance().getClient().thePlayer.worldObj.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID) { + ResourceLocation sound = new ResourceLocation(mod_pocketDim.modid + ":creepy"); + + if (!Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(limboMusic)) { + event.result = limboMusic; + } else { + event.setResult(Event.Result.DENY); + } + } + } + } + + @SubscribeEvent + public void onWorldLoad(WorldEvent.Load event) { + if (event.world.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID && + event.world.isRemote && !Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(limboMusic)) { + Minecraft.getMinecraft().getSoundHandler().playSound(limboMusic); + } + } +} diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java deleted file mode 100644 index eda68a4..0000000 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java +++ /dev/null @@ -1,82 +0,0 @@ -package StevenDimDoors.mod_pocketDimClient; - -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; -import cpw.mods.fml.common.network.IPacketHandler; -import cpw.mods.fml.common.network.Player; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; - -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet250CustomPayload; -import net.minecraft.server.integrated.IntegratedServer; - -public class ClientPacketHandler implements IPacketHandler, IUpdateSource -{ - private IUpdateWatcher linkWatcher; - private IUpdateWatcher dimWatcher; - - public ClientPacketHandler() - { - PocketManager.getWatchers(this); - } - - @Override - public void registerWatchers(IUpdateWatcher dimWatcher, IUpdateWatcher linkWatcher) - { - this.dimWatcher = dimWatcher; - this.linkWatcher = linkWatcher; - } - - @Override - public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) - { - // TODO: Is this even necessary? I'm not convinced we can receive packets from other channels anyway! - if (!packet.channel.equals(PacketConstants.CHANNEL_NAME)) - return; - - //Checking memory connection wasnt working for some reason, but this seems to work fine. - if (FMLCommonHandler.instance().getMinecraftServerInstance() instanceof IntegratedServer) - return; - - try - { - DataInputStream input = new DataInputStream(new ByteArrayInputStream(packet.data)); - byte packetID = input.readByte(); - switch (packetID) - { - case PacketConstants.CLIENT_JOIN_PACKET_ID: - PocketManager.readPacket(input); - break; - case PacketConstants.CREATE_DIM_PACKET_ID: - dimWatcher.onCreated( ClientDimData.read(input) ); - break; - case PacketConstants.CREATE_LINK_PACKET_ID: - 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( ClientLinkData.read(input) ); - break; - case PacketConstants.UPDATE_LINK_PACKET_ID: - linkWatcher.update( ClientLinkData.read(input) ); - break; - } - } - catch (Exception e) - { - System.err.println("An exception occurred while processing a data packet:"); - e.printStackTrace(); - } - } -} diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientProxy.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientProxy.java index 004e4ce..4f965c1 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientProxy.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/ClientProxy.java @@ -1,4 +1,5 @@ package StevenDimDoors.mod_pocketDimClient; +import StevenDimDoors.mod_pocketDim.config.DDProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.CommonProxy; @@ -12,6 +13,7 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor; import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; +import net.minecraftforge.common.MinecraftForge; public class ClientProxy extends CommonProxy @@ -23,8 +25,6 @@ public class ClientProxy extends CommonProxy //MinecraftForgeClient.preloadTexture(BLOCK_PNG); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDimDoor.class, new RenderDimDoor()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTransTrapdoor.class, new RenderTransTrapdoor()); - //This code activates the new rift rendering, as well as a bit of code in TileEntityRift - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRift.class, new RenderRift()); //MinecraftForgeClient.preloadTexture(RIFT2_PNG); RenderingRegistry.registerEntityRenderingHandler(MobMonolith.class, new RenderMobObelisk(.5F)); @@ -35,14 +35,14 @@ public class ClientProxy extends CommonProxy @Override public void updateDoorTE(BaseDimDoor door, World world, int x, int y, int z) { - TileEntity tile = world.getBlockTileEntity(x, y, z); + TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof TileEntityDimDoor) { DimLink link = PocketManager.getLink(x, y, z, world); int metadata = world.getBlockMetadata(x, y, z); TileEntityDimDoor dimTile = (TileEntityDimDoor) tile; dimTile.openOrClosed = door.isDoorOnRift(world, x, y, z)&&door.isUpperDoorBlock(metadata); - dimTile.orientation = door.getFullMetadata(world, x, y, z) & 7; + dimTile.orientation = door.func_150012_g(world, x, y, z) & 7; dimTile.lockStatus = door.getLockStatus(world, x, y, z); } } @@ -51,5 +51,13 @@ public class ClientProxy extends CommonProxy public void printStringClient(String string) { } - + + @Override + public void registerSidedHooks(DDProperties properties) { + ClientOnlyHooks hooks = new ClientOnlyHooks(properties); + MinecraftForge.EVENT_BUS.register(hooks); + MinecraftForge.TERRAIN_GEN_BUS.register(hooks); + PocketManager.getDimwatcher().registerReceiver (new PocketManager.ClientDimWatcher()); + PocketManager.getLinkWatcher().registerReceiver(new PocketManager.ClientLinkWatcher()); + } } \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/GoggleRiftFX.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/GoggleRiftFX.java index 9845af8..a0a2f4f 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/GoggleRiftFX.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/GoggleRiftFX.java @@ -12,180 +12,188 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GoggleRiftFX extends EntityFireworkSparkFX { - private int field_92049_a = 160; - private boolean field_92054_ax; - private boolean field_92048_ay; - private final EffectRenderer field_92047_az; - private float field_92050_aA; - private float field_92051_aB; - private float field_92052_aC; - private boolean field_92053_aD; + private int field_92049_a = 160; + private boolean field_92054_ax; + private boolean field_92048_ay; + private final EffectRenderer field_92047_az; + private float field_92050_aA; + private float field_92051_aB; + private float field_92052_aC; + private boolean field_92053_aD; - public GoggleRiftFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer) - { + public GoggleRiftFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer) + { - super(par1World, par2, par4, par6, par12, par12, par12, par14EffectRenderer); - this.motionX = par8; - this.motionY = par10; - this.motionZ = par12; - this.field_92047_az = par14EffectRenderer; - this.particleScale *= .55F; - this.particleMaxAge = 30 + this.rand.nextInt(16); - this.noClip = true; - } - @Override - public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) - { - if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0) - { - this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); - } - } + super(par1World, par2, par4, par6, par12, par12, par12, par14EffectRenderer); + this.motionX = par8; + this.motionY = par10; + this.motionZ = par12; + this.field_92047_az = par14EffectRenderer; + this.particleScale *= 0.75F; + this.particleMaxAge = 40 + this.rand.nextInt(26); + this.noClip = true; + } - public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) - { - float var8 = super.particleTextureIndexX % 16 / 16.0F; - float var9 = var8 + 0.0624375F; - float var10 = this.particleTextureIndexX / 16 / 16.0F; - float var11 = var10 + 0.0624375F; - float var12 = 0.1F * this.particleScale; - float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX); - float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY); - float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ); - float var16 = .0F; + public void func_92045_e(boolean par1) + { + this.field_92054_ax = par1; + } - if (PocketManager.createDimensionData(worldObj).isPocketDimension()) - { - var16 = .7F; - } + public void func_92043_f(boolean par1) + { + this.field_92048_ay = par1; + } - par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7); + public void func_92044_a(int par1) + { + float var2 = ((par1 & 16711680) >> 16) / 255.0F; + float var3 = ((par1 & 65280) >> 8) / 255.0F; + float var4 = ((par1 & 255) >> 0) / 255.0F; + float var5 = 1.0F; + this.setRBGColorF(var2 * var5, var3 * var5, var4 * var5); + } - par1Tessellator.addVertexWithUV(var13 - par3 * var12 - par6 * var12, var14 - par4 * var12, var15 - par5 * var12 - par7 * var12, var9, var11); - par1Tessellator.addVertexWithUV(var13 - par3 * var12 + par6 * var12, var14 + par4 * var12, var15 - par5 * var12 + par7 * var12, var9, var10); - par1Tessellator.addVertexWithUV(var13 + par3 * var12 + par6 * var12, var14 + par4 * var12, var15 + par5 * var12 + par7 * var12, var8, var10); - par1Tessellator.addVertexWithUV(var13 + par3 * var12 - par6 * var12, var14 - par4 * var12, var15 + par5 * var12 - par7 * var12, var8, var11); - } + public void func_92046_g(int par1) + { + this.field_92050_aA = ((par1 & 16711680) >> 16) / 255.0F; + this.field_92051_aB = ((par1 & 65280) >> 8) / 255.0F; + this.field_92052_aC = ((par1 & 255) >> 0) / 255.0F; + this.field_92053_aD = true; + } + + /** + * returns the bounding box for this entity + */ + @Override + public AxisAlignedBB getBoundingBox() + { + return null; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + @Override + public boolean canBePushed() + { + return false; + } + + @Override + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0) + { - public void func_92045_e(boolean par1) - { - this.field_92054_ax = par1; - } + this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + } - public void func_92043_f(boolean par1) - { - this.field_92048_ay = par1; - } + public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float f6 = this.particleTextureIndexX / 16.0F; + float f7 = f6 + 0.0624375F; + float f8 = this.particleTextureIndexY / 16.0F; + float f9 = f8 + 0.0624375F; + float f10 = 0.1F * this.particleScale; - public void func_92044_a(int par1) - { - float var2 = ((par1 & 16711680) >> 16) / 255.0F; - float var3 = ((par1 & 65280) >> 8) / 255.0F; - float var4 = ((par1 & 255) >> 0) / 255.0F; - float var5 = 1.0F; - this.setRBGColorF(var2 * var5, var3 * var5, var4 * var5); - } + if (this.particleIcon != null) + { + f6 = this.particleIcon.getMinU(); + f7 = this.particleIcon.getMaxU(); + f8 = this.particleIcon.getMinV(); + f9 = this.particleIcon.getMaxV(); + } - public void func_92046_g(int par1) - { - this.field_92050_aA = ((par1 & 16711680) >> 16) / 255.0F; - this.field_92051_aB = ((par1 & 65280) >> 8) / 255.0F; - this.field_92052_aC = ((par1 & 255) >> 0) / 255.0F; - this.field_92053_aD = true; - } + float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX); + float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY); + float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ); + float f14 = 0F; - /** - * returns the bounding box for this entity - */ - @Override - public AxisAlignedBB getBoundingBox() - { - return null; - } + if (PocketManager.createDimensionData(worldObj).isPocketDimension()) + { + f14 = 0.7F; + } - /** - * Returns true if this entity should push and be pushed by other entities when colliding. - */ - @Override - public boolean canBePushed() - { - return false; - } + par1Tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, (float) .7); + par1Tessellator.addVertexWithUV(f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9); + par1Tessellator.addVertexWithUV(f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8); + par1Tessellator.addVertexWithUV(f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f6, f8); + par1Tessellator.addVertexWithUV(f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f6, f9); + } + /** + * Called to update the entity's position/logic. + */ + @Override + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() - { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; + if (this.particleAge > this.particleMaxAge / 2) + { + this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / this.particleMaxAge); - if (this.particleAge++ >= this.particleMaxAge) - { - this.setDead(); - } + if (this.field_92053_aD) + { + this.particleRed += (this.field_92050_aA - this.particleRed) * 0.2F; + this.particleGreen += (this.field_92051_aB - this.particleGreen) * 0.2F; + this.particleBlue += (this.field_92052_aC - this.particleBlue) * 0.2F; + } + } - if (this.particleAge > this.particleMaxAge / 2) - { - this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / this.particleMaxAge); + this.setParticleTextureIndex(this.field_92049_a + (7 - this.particleAge * 8 / this.particleMaxAge)); + // this.motionY -= 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9100000262260437D; + this.motionY *= 0.9100000262260437D; + this.motionZ *= 0.9100000262260437D; - if (this.field_92053_aD) - { - this.particleRed += (this.field_92050_aA - this.particleRed) * 0.2F; - this.particleGreen += (this.field_92051_aB - this.particleGreen) * 0.2F; - this.particleBlue += (this.field_92052_aC - this.particleBlue) * 0.2F; - } - } + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } - this.setParticleTextureIndex(this.field_92049_a + (7 - this.particleAge * 8 / this.particleMaxAge)); - // this.motionY -= 0.004D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.9100000262260437D; - this.motionY *= 0.9100000262260437D; - this.motionZ *= 0.9100000262260437D; + if (this.field_92054_ax && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0) + { + GoggleRiftFX var1 = new GoggleRiftFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.field_92047_az); + var1.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue); + var1.particleAge = var1.particleMaxAge / 2; - if (this.onGround) - { - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; - } + if (this.field_92053_aD) + { + var1.field_92053_aD = true; + var1.field_92050_aA = this.field_92050_aA; + var1.field_92051_aB = this.field_92051_aB; + var1.field_92052_aC = this.field_92052_aC; + } - if (this.field_92054_ax && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0) - { - GoggleRiftFX var1 = new GoggleRiftFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.field_92047_az); - var1.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue); - var1.particleAge = var1.particleMaxAge / 2; + var1.field_92048_ay = this.field_92048_ay; + this.field_92047_az.addEffect(var1); + } + } - if (this.field_92053_aD) - { - var1.field_92053_aD = true; - var1.field_92050_aA = this.field_92050_aA; - var1.field_92051_aB = this.field_92051_aB; - var1.field_92052_aC = this.field_92052_aC; - } + @Override + public int getBrightnessForRender(float par1) + { + return 15728880; + } - var1.field_92048_ay = this.field_92048_ay; - this.field_92047_az.addEffect(var1); - } - } - - @Override - public int getBrightnessForRender(float par1) - { - return 15728880; - } - - /** - * Gets how bright this entity is. - */ - @Override - public float getBrightness(float par1) - { - return 1.0F; - } + /** + * Gets how bright this entity is. + */ + @Override + public float getBrightness(float par1) + { + return 1.0F; + } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java index 564a9ca..88ae914 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java @@ -39,11 +39,6 @@ public class ModelMobObelisk extends ModelBase wholemonolith = new ModelRenderer(this, 0, 0); wholemonolith.addBox(-48/2F,-108F/1.3F, -12/2F, 48, 108, 12); - wholemonolith.setTextureSize(256, 256); - wholemonolith.mirror = true; - this.wholemonolith.rotationPointY=0; - this.wholemonolith.rotationPointX=0; - this.wholemonolith.rotationPointZ=0; } @@ -51,22 +46,10 @@ public class ModelMobObelisk extends ModelBase @Override public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { - super.render(par1Entity, 0, 0, 0, 0, 0, 0); this.setRotationAngles(0, 0, 0, 0, 0,0, par1Entity); - - + + GL11.glScalef(((MobMonolith) par1Entity).getRenderSizeModifier(), ((MobMonolith) par1Entity).getRenderSizeModifier(), ((MobMonolith) par1Entity).getRenderSizeModifier()); wholemonolith.render(par7); } - - - - - - @Override - public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) - { - super.setRotationAngles( 0, 0, 0, 0, 0, 0, par7Entity); - } - } diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/PrivatePocketRender.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/PrivatePocketRender.java index 08458ea..0679252 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/PrivatePocketRender.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/PrivatePocketRender.java @@ -1,11 +1,11 @@ package StevenDimDoors.mod_pocketDimClient; +import net.minecraft.util.IIcon; import org.lwjgl.opengl.GL11; import net.minecraft.block.Block; import net.minecraft.block.BlockGrass; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; @@ -79,7 +79,7 @@ public class PrivatePocketRender implements ISimpleBlockRenderingHandler Tessellator tessellator = Tessellator.instance; boolean flag = false; - Icon icon = renderer.getBlockIcon(block, world, x, y, z, 2); + IIcon icon = renderer.getBlockIcon(block, world, x, y, z, 2); @@ -144,7 +144,7 @@ public class PrivatePocketRender implements ISimpleBlockRenderingHandler @Override - public boolean shouldRender3DInInventory() + public boolean shouldRender3DInInventory(int data) { // TODO Auto-generated method stub return true; diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java index cbd3e21..20a1b7b 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderDimDoor.java @@ -31,7 +31,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.storage.MapCoord; import net.minecraft.world.storage.MapData; import static org.lwjgl.opengl.GL11.*; @@ -50,8 +49,8 @@ public class RenderDimDoor extends TileEntitySpecialRenderer { private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16); private ResourceLocation warpPath= new ResourceLocation(mod_pocketDim.modid + ":textures/other/WARP.png"); - private ResourceLocation keyPath= new ResourceLocation(mod_pocketDim.modid + ":textures/other/Keyhole.png"); - private ResourceLocation KeyholeLight= new ResourceLocation(mod_pocketDim.modid + ":textures/other/KeyholeLight.png"); + private ResourceLocation keyPath= new ResourceLocation(mod_pocketDim.modid + ":textures/other/keyhole.png"); + private ResourceLocation KeyholeLight= new ResourceLocation(mod_pocketDim.modid + ":textures/other/keyholeLight.png"); private ResourceLocation keyOutline= new ResourceLocation(mod_pocketDim.modid + ":textures/other/keyOutline.png"); private ResourceLocation keyOutlineLight= new ResourceLocation(mod_pocketDim.modid + ":textures/other/keyOutlineLight.png"); @@ -352,7 +351,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer TileEntityDimDoor tile = (TileEntityDimDoor) par1TileEntity; try { - mod_pocketDim.dimensionalDoor.updateAttachedTile(tile.worldObj, + mod_pocketDim.dimensionalDoor.updateAttachedTile(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord); } catch (Exception e) diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java index dc35abd..9dc1ab7 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderMobObelisk.java @@ -1,5 +1,6 @@ package StevenDimDoors.mod_pocketDimClient; +import StevenDimDoors.mod_pocketDim.world.LimboProvider; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.entity.RenderLiving; @@ -29,17 +30,20 @@ public class RenderMobObelisk extends RenderLiving } @Override - public void doRenderLiving(EntityLiving entity, double x, double y, double z, float par8, float par9) + public void doRender(EntityLiving entity, double x, double y, double z, float par8, float par9) { final float minScaling = 0; final float maxScaling = 0.1f; MobMonolith monolith = ((MobMonolith) entity); - // Use linear interpolation to scale how much jitter we want for our given aggro level - float aggroScaling = minScaling + (maxScaling - minScaling) * monolith.getAggroProgress(); + float aggroScaling = 0; + if (monolith.isDangerous()) { + // Use linear interpolation to scale how much jitter we want for our given aggro level + aggroScaling = minScaling + (maxScaling - minScaling) * monolith.getAggroProgress(); + } // Calculate jitter - include entity ID to give Monoliths individual jitters - float time = ((Minecraft.getSystemTime() + 0xF1234568 * monolith.entityId) % 200000) / 50.0F; + float time = ((Minecraft.getSystemTime() + 0xF1234568 * monolith.getEntityId()) % 200000) / 50.0F; // We use random constants here on purpose just to get different wave forms double xJitter = aggroScaling * Math.sin(1.1f * time) * Math.sin(0.8f * time); double yJitter = aggroScaling * Math.sin(1.2f * time) * Math.sin(0.9f * time); @@ -52,13 +56,11 @@ public class RenderMobObelisk extends RenderLiving public void render(EntityLiving par1EntityLivingBase, double x, double y, double z, float par8, float par9) { - if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this))) return; + if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this, x, y, z))) return; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.mainModel.onGround = this.renderSwingProgress(par1EntityLivingBase, par9); @@ -101,10 +103,8 @@ public class RenderMobObelisk extends RenderLiving GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); GL11.glPopMatrix(); - MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this)); + MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this, x, y, z)); } private static float interpolateRotation(float par1, float par2, float par3) @@ -125,6 +125,6 @@ public class RenderMobObelisk extends RenderLiving protected ResourceLocation getEntityTexture(Entity entity) { MobMonolith monolith = (MobMonolith) entity; - return new ResourceLocation(mod_pocketDim.modid + ":textures/mobs/Monolith" + monolith.getTextureState() + ".png"); + return new ResourceLocation(mod_pocketDim.modid + ":textures/mobs/oldMonolith/Monolith" + monolith.getTextureState() + ".png"); } } \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderRift.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderRift.java index 762bca4..0344060 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderRift.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderRift.java @@ -8,8 +8,6 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import org.lwjgl.opengl.GL11; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift; -import StevenDimDoors.mod_pocketDim.util.l_systems.LSystem; -import StevenDimDoors.mod_pocketDim.util.l_systems.LSystem.PolygonStorage; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -35,7 +33,6 @@ public class RenderRift extends TileEntitySpecialRenderer */ TileEntityRift rift = (TileEntityRift) te; // draws the verticies corresponding to the passed it - this.drawCrack(rift.riftRotation, rift.getCurve(), rift.growth/15, xWorld, yWorld, zWorld); GL11.glDisable(GL_BLEND); // reenable all the stuff we disabled @@ -45,124 +42,4 @@ public class RenderRift extends TileEntitySpecialRenderer GL11.glPopMatrix(); } - - /** - * method that draws the fractal and applies animations/effects - * - * f - * - * @param riftRotation - * @param poly - * @param size - * @param xWorld - * @param yWorld - * @param zWorld - */ - public void drawCrack(int riftRotation, PolygonStorage poly, double size, double xWorld, double yWorld, double zWorld) - { - // calculate the proper size for the rift render - double scale = size / (poly.maxX - poly.minX); - - // calculate the midpoint of the fractal bounding box - double offsetX = ((poly.maxX + poly.minX)) / 2; - double offsetY = ((poly.maxY + poly.minY)) / 2; - double offsetZ = 0; - - // changes how far the triangles move - float motionMagnitude = 3.0F; - - // changes how quickly the triangles move - float motionSpeed = 2000.0F; - - // number of individual jitter waveforms to generate - // changes how "together" the overall motions are - int jCount = 5; - - // Calculate jitter like for monoliths - float time = (float) (((Minecraft.getSystemTime() + 0xF1234568 * this.hashCode()) % 2000000) / motionSpeed); - double[] jitters = new double[jCount]; - - // generate a series of waveforms - for (int i = 0; i < jCount - 1; i += 1) - { - jitters[i] = Math.sin((1F + i / 10F) * time) * Math.cos(1F - (i / 10F) * time) / motionMagnitude; - jitters[i + 1] = Math.cos((1F + i / 10F) * time) * Math.sin(1F - (i / 10F) * time) / motionMagnitude; - - } - - // determines which jitter waveform we select. Modulo so the same point - // gets the same jitter waveform over multiple frames - int jIndex = 0; - // set the color for the render - GL11.glColor4f(.1F, .1F, .1F, 1F); - - // set the blending mode - GL11.glEnable(GL_BLEND); - glBlendFunc(GL_ONE_MINUS_SRC_COLOR, GL_ONE); - GL11.glBegin(GL11.GL_TRIANGLES); - for (Point p : poly.points) - { - jIndex = Math.abs(((p.x + p.y) * (p.x + p.y + 1) / 2) + p.y); - // jIndex++; - // calculate the rotation for the fractal, apply offset, and apply - // jitter - double x = (((p.x + jitters[(jIndex + 1) % jCount]) - offsetX) * Math.cos(Math.toRadians(riftRotation)) - (jitters[(jIndex + 2) % jCount]) - * Math.sin(Math.toRadians(riftRotation))); - double y = p.y + (jitters[jIndex % jCount]) - offsetY; - double z = (((p.x + jitters[(jIndex + 2) % jCount]) - offsetX) * Math.sin(Math.toRadians(riftRotation)) + (jitters[(jIndex + 2) % jCount]) - * Math.cos(Math.toRadians(riftRotation))); - - // apply scaling - x *= scale; - y *= scale; - z *= scale; - - // apply transform to center the offset origin into the middle of a - // block - x += .5; - y += .5; - z += .5; - - // draw the vertex and apply the world (screenspace) relative - // coordinates - GL11.glVertex3d(xWorld + x, yWorld + y, zWorld + z); - } - GL11.glEnd(); - - GL11.glColor4f(.3F, .3F, .3F, .2F); - - glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); - - // draw the next set of triangles to form a background and change their - // color slightly over time - GL11.glBegin(GL11.GL_TRIANGLES); - for (Point p : poly.points) - { - jIndex++; - - double x = (((p.x) - offsetX) * Math.cos(Math.toRadians(riftRotation)) - 0 * Math.sin(Math.toRadians(riftRotation))); - double y = p.y - offsetY; - double z = (((p.x) - offsetX) * Math.sin(Math.toRadians(riftRotation)) + 0 * Math.cos(Math.toRadians(riftRotation))); - - x *= scale; - y *= scale; - z *= scale; - - x += .5; - y += .5; - z += .5; - - if (jIndex % 3 == 0) - { - // GL11.glColor4d(1-jitters[(jIndex + 5) % jCount] / 11,1- - // jitters[(jIndex + 4) % jCount] / 8, 1-jitters[(jIndex+3) % - // jCount] / 8, 1); - } - GL11.glVertex3d(xWorld + x, yWorld + y, zWorld + z); - } - - // stop drawing triangles - GL11.glEnd(); - - } } \ No newline at end of file diff --git a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderTransTrapdoor.java b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderTransTrapdoor.java index 98f8e88..36d506b 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderTransTrapdoor.java +++ b/src/main/java/StevenDimDoors/mod_pocketDimClient/RenderTransTrapdoor.java @@ -41,7 +41,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer { GL11.glDisable(GL11.GL_LIGHTING); Random random = new Random(31100L); - int metadata = tile.worldObj.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); + int metadata = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); for (int count = 0; count < 16; ++count) { @@ -112,7 +112,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer GL11.glColor4d(var21 * var17, var22 * var17, var23 * var17, 1.0F); if (TransTrapdoor.isTrapdoorSetLow(metadata)) { - if (BlockTrapDoor.isTrapdoorOpen(metadata)) + if (BlockTrapDoor.func_150118_d(metadata)) { GL11.glVertex3d(x, y+0.2, z); GL11.glVertex3d(x, y+0.2, z+1); @@ -129,7 +129,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer } else { - if (BlockTrapDoor.isTrapdoorOpen(metadata)) + if (BlockTrapDoor.func_150118_d(metadata)) { GL11.glVertex3d(x, y+0.95, z); GL11.glVertex3d(x, y+0.95, z+1); diff --git a/src/main/java/org/poly2tri/Poly2Tri.java b/src/main/java/org/poly2tri/Poly2Tri.java deleted file mode 100644 index ec9f422..0000000 --- a/src/main/java/org/poly2tri/Poly2Tri.java +++ /dev/null @@ -1,124 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri; - -import org.poly2tri.geometry.polygon.Polygon; -import org.poly2tri.geometry.polygon.PolygonSet; -import org.poly2tri.triangulation.Triangulatable; -import org.poly2tri.triangulation.TriangulationAlgorithm; -import org.poly2tri.triangulation.TriangulationContext; -import org.poly2tri.triangulation.TriangulationMode; -import org.poly2tri.triangulation.TriangulationProcess; -import org.poly2tri.triangulation.delaunay.sweep.DTSweep; -import org.poly2tri.triangulation.delaunay.sweep.DTSweepContext; -import org.poly2tri.triangulation.sets.ConstrainedPointSet; -import org.poly2tri.triangulation.sets.PointSet; -import org.poly2tri.triangulation.util.PolygonGenerator; - -public class Poly2Tri -{ - - private static final TriangulationAlgorithm _defaultAlgorithm = TriangulationAlgorithm.DTSweep; - - public static void triangulate( PolygonSet ps ) - { - TriangulationContext tcx = createContext( _defaultAlgorithm ); - for( Polygon p : ps.getPolygons() ) - { - tcx.prepareTriangulation( p ); - triangulate( tcx ); - tcx.clear(); - } - } - - public static void triangulate( Polygon p ) - { - triangulate( _defaultAlgorithm, p ); - } - - public static void triangulate( ConstrainedPointSet cps ) - { - triangulate( _defaultAlgorithm, cps ); - } - - public static void triangulate( PointSet ps ) - { - triangulate( _defaultAlgorithm, ps ); - } - - public static TriangulationContext createContext( TriangulationAlgorithm algorithm ) - { - switch( algorithm ) - { - case DTSweep: - default: - return new DTSweepContext(); - } - } - - public static void triangulate( TriangulationAlgorithm algorithm, - Triangulatable t ) - { - TriangulationContext tcx; - -// long time = System.nanoTime(); - tcx = createContext( algorithm ); - tcx.prepareTriangulation( t ); - triangulate( tcx ); -// logger.info( "Triangulation of {} points [{}ms]", tcx.getPoints().size(), ( System.nanoTime() - time ) / 1e6 ); - } - - public static void triangulate( TriangulationContext tcx ) - { - switch( tcx.algorithm() ) - { - case DTSweep: - default: - DTSweep.triangulate( (DTSweepContext)tcx ); - } - } - - /** - * Will do a warmup run to let the JVM optimize the triangulation code - */ - public static void warmup() - { - /* - * After a method is run 10000 times, the Hotspot compiler will compile - * it into native code. Periodically, the Hotspot compiler may recompile - * the method. After an unspecified amount of time, then the compilation - * system should become quiet. - */ - Polygon poly = PolygonGenerator.RandomCircleSweep2( 50, 50000 ); - TriangulationProcess process = new TriangulationProcess(); - process.triangulate( poly ); - } -} diff --git a/src/main/java/org/poly2tri/geometry/polygon/Polygon.java b/src/main/java/org/poly2tri/geometry/polygon/Polygon.java deleted file mode 100644 index e972033..0000000 --- a/src/main/java/org/poly2tri/geometry/polygon/Polygon.java +++ /dev/null @@ -1,269 +0,0 @@ -package org.poly2tri.geometry.polygon; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.poly2tri.triangulation.Triangulatable; -import org.poly2tri.triangulation.TriangulationContext; -import org.poly2tri.triangulation.TriangulationMode; -import org.poly2tri.triangulation.TriangulationPoint; -import org.poly2tri.triangulation.delaunay.DelaunayTriangle; - -public class Polygon implements Triangulatable -{ - - protected ArrayList _points = new ArrayList(); - protected ArrayList _steinerPoints; - protected ArrayList _holes; - - protected List m_triangles; - - protected PolygonPoint _last; - - /** - * To create a polygon we need atleast 3 separate points - * - * @param p1 - * @param p2 - * @param p3 - */ - public Polygon( PolygonPoint p1, PolygonPoint p2, PolygonPoint p3 ) - { - p1._next = p2; - p2._next = p3; - p3._next = p1; - p1._previous = p3; - p2._previous = p1; - p3._previous = p2; - _points.add( p1 ); - _points.add( p2 ); - _points.add( p3 ); - } - - /** - * Requires atleast 3 points - * @param points - ordered list of points forming the polygon. - * No duplicates are allowed - */ - public Polygon( List points ) - { - // Lets do one sanity check that first and last point hasn't got same position - // Its something that often happen when importing polygon data from other formats - if( points.get(0).equals( points.get(points.size()-1) ) ) - { - points.remove( points.size()-1 ); - } - _points.addAll( points ); - } - - /** - * Requires atleast 3 points - * - * @param points - */ - public Polygon( PolygonPoint[] points ) - { - this( Arrays.asList( points ) ); - } - - public TriangulationMode getTriangulationMode() - { - return TriangulationMode.POLYGON; - } - - public int pointCount() - { - int count = _points.size(); - if( _steinerPoints != null ) - { - count += _steinerPoints.size(); - } - return count; - } - - public void addSteinerPoint( TriangulationPoint point ) - { - if( _steinerPoints == null ) - { - _steinerPoints = new ArrayList(); - } - _steinerPoints.add( point ); - } - - public void addSteinerPoints( List points ) - { - if( _steinerPoints == null ) - { - _steinerPoints = new ArrayList(); - } - _steinerPoints.addAll( points ); - } - - public void clearSteinerPoints() - { - if( _steinerPoints != null ) - { - _steinerPoints.clear(); - } - } - - /** - * Assumes: that given polygon is fully inside the current polygon - * @param poly - a subtraction polygon - */ - public void addHole( Polygon poly ) - { - if( _holes == null ) - { - _holes = new ArrayList(); - } - _holes.add( poly ); - // XXX: tests could be made here to be sure it is fully inside -// addSubtraction( poly.getPoints() ); - } - - /** - * Will insert a point in the polygon after given point - * - * @param a - * @param b - * @param p - */ - public void insertPointAfter( PolygonPoint a, PolygonPoint newPoint ) - { - // Validate that - int index = _points.indexOf( a ); - if( index != -1 ) - { - newPoint.setNext( a.getNext() ); - newPoint.setPrevious( a ); - a.getNext().setPrevious( newPoint ); - a.setNext( newPoint ); - _points.add( index+1, newPoint ); - } - else - { - throw new RuntimeException( "Tried to insert a point into a Polygon after a point not belonging to the Polygon" ); - } - } - - public void addPoints( List list ) - { - PolygonPoint first; - for( PolygonPoint p : list ) - { - p.setPrevious( _last ); - if( _last != null ) - { - p.setNext( _last.getNext() ); - _last.setNext( p ); - } - _last = p; - _points.add( p ); - } - first = (PolygonPoint)_points.get(0); - _last.setNext( first ); - first.setPrevious( _last ); - } - - /** - * Will add a point after the last point added - * - * @param p - */ - public void addPoint(PolygonPoint p ) - { - p.setPrevious( _last ); - p.setNext( _last.getNext() ); - _last.setNext( p ); - _points.add( p ); - } - - public void removePoint( PolygonPoint p ) - { - PolygonPoint next, prev; - - next = p.getNext(); - prev = p.getPrevious(); - prev.setNext( next ); - next.setPrevious( prev ); - _points.remove( p ); - } - - public PolygonPoint getPoint() - { - return _last; - } - - public List getPoints() - { - return _points; - } - - public List getTriangles() - { - return m_triangles; - } - - public void addTriangle( DelaunayTriangle t ) - { - m_triangles.add( t ); - } - - public void addTriangles( List list ) - { - m_triangles.addAll( list ); - } - - public void clearTriangulation() - { - if( m_triangles != null ) - { - m_triangles.clear(); - } - } - - /** - * Creates constraints and populates the context with points - */ - public void prepareTriangulation( TriangulationContext tcx ) - { - if( m_triangles == null ) - { - m_triangles = new ArrayList( _points.size() ); - } - else - { - m_triangles.clear(); - } - - // Outer constraints - for( int i = 0; i < _points.size()-1 ; i++ ) - { - tcx.newConstraint( _points.get( i ), _points.get( i+1 ) ); - } - tcx.newConstraint( _points.get( 0 ), _points.get( _points.size()-1 ) ); - tcx.addPoints( _points ); - - // Hole constraints - if( _holes != null ) - { - for( Polygon p : _holes ) - { - for( int i = 0; i < p._points.size()-1 ; i++ ) - { - tcx.newConstraint( p._points.get( i ), p._points.get( i+1 ) ); - } - tcx.newConstraint( p._points.get( 0 ), p._points.get( p._points.size()-1 ) ); - tcx.addPoints( p._points ); - } - } - - if( _steinerPoints != null ) - { - tcx.addPoints( _steinerPoints ); - } - } - -} diff --git a/src/main/java/org/poly2tri/geometry/polygon/PolygonPoint.java b/src/main/java/org/poly2tri/geometry/polygon/PolygonPoint.java deleted file mode 100644 index a0e3cf1..0000000 --- a/src/main/java/org/poly2tri/geometry/polygon/PolygonPoint.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.poly2tri.geometry.polygon; - -import org.poly2tri.triangulation.point.TPoint; - -public class PolygonPoint extends TPoint -{ - protected PolygonPoint _next; - protected PolygonPoint _previous; - - public PolygonPoint( double x, double y ) - { - super( x, y ); - } - - public PolygonPoint( double x, double y, double z ) - { - super( x, y, z ); - } - - public void setPrevious( PolygonPoint p ) - { - _previous = p; - } - - public void setNext( PolygonPoint p ) - { - _next = p; - } - - public PolygonPoint getNext() - { - return _next; - } - - public PolygonPoint getPrevious() - { - return _previous; - } -} diff --git a/src/main/java/org/poly2tri/geometry/polygon/PolygonSet.java b/src/main/java/org/poly2tri/geometry/polygon/PolygonSet.java deleted file mode 100644 index d7e33bb..0000000 --- a/src/main/java/org/poly2tri/geometry/polygon/PolygonSet.java +++ /dev/null @@ -1,58 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.geometry.polygon; - -import java.util.ArrayList; -import java.util.List; - -public class PolygonSet -{ - protected ArrayList _polygons = new ArrayList(); - - public PolygonSet() - { - } - - public PolygonSet( Polygon poly ) - { - _polygons.add( poly ); - } - - public void add( Polygon p ) - { - _polygons.add( p ); - } - - public List getPolygons() - { - return _polygons; - } -} diff --git a/src/main/java/org/poly2tri/geometry/polygon/PolygonUtil.java b/src/main/java/org/poly2tri/geometry/polygon/PolygonUtil.java deleted file mode 100644 index 3ca71de..0000000 --- a/src/main/java/org/poly2tri/geometry/polygon/PolygonUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.poly2tri.geometry.polygon; - -public class PolygonUtil -{ - /** - * TODO - * @param polygon - */ - public static void validate( Polygon polygon ) - { - // TODO: implement - // 1. Check for duplicate points - // 2. Check for intersecting sides - } -} diff --git a/src/main/java/org/poly2tri/geometry/primitives/Edge.java b/src/main/java/org/poly2tri/geometry/primitives/Edge.java deleted file mode 100644 index 49b00b6..0000000 --- a/src/main/java/org/poly2tri/geometry/primitives/Edge.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.poly2tri.geometry.primitives; - -public abstract class Edge -{ - protected A p; - protected A q; - - public A getP() - { - return p; - } - - public A getQ() - { - return q; - } -} diff --git a/src/main/java/org/poly2tri/geometry/primitives/Point.java b/src/main/java/org/poly2tri/geometry/primitives/Point.java deleted file mode 100644 index 680c141..0000000 --- a/src/main/java/org/poly2tri/geometry/primitives/Point.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.poly2tri.geometry.primitives; - -public abstract class Point -{ - public abstract double getX(); - public abstract double getY(); - public abstract double getZ(); - - public abstract float getXf(); - public abstract float getYf(); - public abstract float getZf(); - - public abstract void set( double x, double y, double z ); - - protected static int calculateHashCode( double x, double y, double z) - { - int result = 17; - - final long a = Double.doubleToLongBits(x); - result += 31 * result + (int) (a ^ (a >>> 32)); - - final long b = Double.doubleToLongBits(y); - result += 31 * result + (int) (b ^ (b >>> 32)); - - final long c = Double.doubleToLongBits(z); - result += 31 * result + (int) (c ^ (c >>> 32)); - - return result; - - } -} diff --git a/src/main/java/org/poly2tri/transform/coordinate/AnyToXYTransform.java b/src/main/java/org/poly2tri/transform/coordinate/AnyToXYTransform.java deleted file mode 100644 index 97026a5..0000000 --- a/src/main/java/org/poly2tri/transform/coordinate/AnyToXYTransform.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.poly2tri.transform.coordinate; - -/** - * A transform that aligns given source normal with the XY plane normal [0,0,1] - * - * @author thahlen@gmail.com - */ - -public class AnyToXYTransform extends Matrix3Transform -{ - /** - * Assumes source normal is normalized - */ - public AnyToXYTransform( double nx, double ny, double nz ) - { - setSourceNormal( nx, ny, nz ); - } - - /** - * Assumes source normal is normalized - * - * @param nx - * @param ny - * @param nz - */ - public void setSourceNormal( double nx, double ny, double nz ) - { - double h,f,c,vx,vy,hvx; - - vx = -ny; - vy = nx; - c = nz; - - h = (1-c)/(1-c*c); - hvx = h*vx; - f = (c < 0) ? -c : c; - - if( f < 1.0 - 1.0E-4 ) - { - m00=c + hvx*vx; - m01=hvx*vy; - m02=-vy; - m10=hvx*vy; - m11=c + h*vy*vy; - m12=vx; - m20=vy; - m21=-vx; - m22=c; - } - else - { - // if "from" and "to" vectors are nearly parallel - m00=1; - m01=0; - m02=0; - m10=0; - m11=1; - m12=0; - m20=0; - m21=0; - if( c > 0 ) - { - m22=1; - } - else - { - m22=-1; - } - } - } -} diff --git a/src/main/java/org/poly2tri/transform/coordinate/CoordinateTransform.java b/src/main/java/org/poly2tri/transform/coordinate/CoordinateTransform.java deleted file mode 100644 index f00cb1c..0000000 --- a/src/main/java/org/poly2tri/transform/coordinate/CoordinateTransform.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.poly2tri.transform.coordinate; - -import java.util.List; - -import org.poly2tri.geometry.primitives.Point; - -public abstract interface CoordinateTransform -{ - public abstract void transform( Point p, Point store ); - public abstract void transform( Point p ); - public abstract void transform( List list ); -} diff --git a/src/main/java/org/poly2tri/transform/coordinate/Matrix3Transform.java b/src/main/java/org/poly2tri/transform/coordinate/Matrix3Transform.java deleted file mode 100644 index f8422bc..0000000 --- a/src/main/java/org/poly2tri/transform/coordinate/Matrix3Transform.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.poly2tri.transform.coordinate; - -import java.util.List; - -import org.poly2tri.geometry.primitives.Point; - -public abstract class Matrix3Transform implements CoordinateTransform -{ - protected double m00,m01,m02,m10,m11,m12,m20,m21,m22; - - public void transform( Point p, Point store ) - { - final double px = p.getX(); - final double py = p.getY(); - final double pz = p.getZ(); - store.set(m00 * px + m01 * py + m02 * pz, - m10 * px + m11 * py + m12 * pz, - m20 * px + m21 * py + m22 * pz ); - } - - public void transform( Point p ) - { - final double px = p.getX(); - final double py = p.getY(); - final double pz = p.getZ(); - p.set(m00 * px + m01 * py + m02 * pz, - m10 * px + m11 * py + m12 * pz, - m20 * px + m21 * py + m22 * pz ); - } - - public void transform( List list ) - { - for( Point p : list ) - { - transform( p ); - } - } -} diff --git a/src/main/java/org/poly2tri/transform/coordinate/NoTransform.java b/src/main/java/org/poly2tri/transform/coordinate/NoTransform.java deleted file mode 100644 index 2f43cbc..0000000 --- a/src/main/java/org/poly2tri/transform/coordinate/NoTransform.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.poly2tri.transform.coordinate; - -import java.util.List; - -import org.poly2tri.geometry.primitives.Point; - -public class NoTransform implements CoordinateTransform -{ - public void transform( Point p, Point store ) - { - store.set( p.getX(), p.getY(), p.getZ() ); - } - - public void transform( Point p ) - { - } - - public void transform( List list ) - { - } -} diff --git a/src/main/java/org/poly2tri/transform/coordinate/XYToAnyTransform.java b/src/main/java/org/poly2tri/transform/coordinate/XYToAnyTransform.java deleted file mode 100644 index 6c0a30f..0000000 --- a/src/main/java/org/poly2tri/transform/coordinate/XYToAnyTransform.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.poly2tri.transform.coordinate; - -/** - * A transform that aligns the XY plane normal [0,0,1] with any given target normal - * - * http://www.cs.brown.edu/~jfh/papers/Moller-EBA-1999/paper.pdf - * - * @author thahlen@gmail.com - * - */ -public class XYToAnyTransform extends Matrix3Transform -{ - /** - * Assumes target normal is normalized - */ - public XYToAnyTransform( double nx, double ny, double nz ) - { - setTargetNormal( nx, ny, nz ); - } - - /** - * Assumes target normal is normalized - * - * @param nx - * @param ny - * @param nz - */ - public void setTargetNormal( double nx, double ny, double nz ) - { - double h,f,c,vx,vy,hvx; - - vx = ny; - vy = -nx; - c = nz; - - h = (1-c)/(1-c*c); - hvx = h*vx; - f = (c < 0) ? -c : c; - - if( f < 1.0 - 1.0E-4 ) - { - m00=c + hvx*vx; - m01=hvx*vy; - m02=-vy; - m10=hvx*vy; - m11=c + h*vy*vy; - m12=vx; - m20=vy; - m21=-vx; - m22=c; - } - else - { - // if "from" and "to" vectors are nearly parallel - m00=1; - m01=0; - m02=0; - m10=0; - m11=1; - m12=0; - m20=0; - m21=0; - if( c > 0 ) - { - m22=1; - } - else - { - m22=-1; - } - } - - } -} diff --git a/src/main/java/org/poly2tri/triangulation/Triangulatable.java b/src/main/java/org/poly2tri/triangulation/Triangulatable.java deleted file mode 100644 index dddc620..0000000 --- a/src/main/java/org/poly2tri/triangulation/Triangulatable.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.poly2tri.triangulation; - -import java.util.List; - -import org.poly2tri.triangulation.delaunay.DelaunayTriangle; - -public interface Triangulatable -{ - /** - * Preparations needed before triangulation start should be handled here - * @param tcx - */ - public void prepareTriangulation( TriangulationContext tcx ); - - public List getTriangles(); - public List getPoints(); - public void addTriangle( DelaunayTriangle t ); - public void addTriangles( List list ); - public void clearTriangulation(); - - public TriangulationMode getTriangulationMode(); -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationAlgorithm.java b/src/main/java/org/poly2tri/triangulation/TriangulationAlgorithm.java deleted file mode 100644 index 497aada..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationAlgorithm.java +++ /dev/null @@ -1,36 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation; - -public enum TriangulationAlgorithm -{ - DTSweep -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationConstraint.java b/src/main/java/org/poly2tri/triangulation/TriangulationConstraint.java deleted file mode 100644 index 0e3f0d2..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationConstraint.java +++ /dev/null @@ -1,55 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation; - -/** - * Forces a triangle edge between two points p and q - * when triangulating. For example used to enforce - * Polygon Edges during a polygon triangulation. - * - * @author Thomas Åhlén, thahlen@gmail.com - */ -public class TriangulationConstraint -{ - protected TriangulationPoint p; - protected TriangulationPoint q; - - public TriangulationPoint getP() - { - return p; - } - - public TriangulationPoint getQ() - { - return q; - } - -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationContext.java b/src/main/java/org/poly2tri/triangulation/TriangulationContext.java deleted file mode 100644 index 71b26bc..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationContext.java +++ /dev/null @@ -1,171 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation; - -import java.util.ArrayList; -import java.util.List; - -import org.poly2tri.triangulation.delaunay.DelaunayTriangle; - -public abstract class TriangulationContext -{ - protected A _debug; - protected boolean _debugEnabled = false; - - protected ArrayList _triList = new ArrayList(); - - protected ArrayList _points = new ArrayList(200); - protected TriangulationMode _triangulationMode; - protected Triangulatable _triUnit; - - private boolean _terminated = false; - private boolean _waitUntilNotified; - - private int _stepTime = -1; - private int _stepCount = 0; - public int getStepCount() { return _stepCount; } - - public void done() - { - _stepCount++; - } - - public abstract TriangulationAlgorithm algorithm(); - - public void prepareTriangulation( Triangulatable t ) - { - _triUnit = t; - _triangulationMode = t.getTriangulationMode(); - t.prepareTriangulation( this ); - } - - public abstract TriangulationConstraint newConstraint( TriangulationPoint a, TriangulationPoint b ); - - public void addToList( DelaunayTriangle triangle ) - { - _triList.add( triangle ); - } - - public List getTriangles() - { - return _triList; - } - - public Triangulatable getTriangulatable() - { - return _triUnit; - } - - public List getPoints() - { - return _points; - } - - public synchronized void update(String message) - { - if( _debugEnabled ) - { - try - { - synchronized( this ) - { - _stepCount++; - if( _stepTime > 0 ) - { - wait( (int)_stepTime ); - /** Can we resume execution or are we expected to wait? */ - if( _waitUntilNotified ) - { - wait(); - } - } - else - { - wait(); - } - // We have been notified - _waitUntilNotified = false; - } - } - catch( InterruptedException e ) - { - update("Triangulation was interrupted"); - } - } - if( _terminated ) - { - throw new RuntimeException( "Triangulation process terminated before completion"); - } - } - - public void clear() - { - _points.clear(); - _terminated = false; - if( _debug != null ) - { - _debug.clear(); - } - _stepCount=0; - } - - public TriangulationMode getTriangulationMode() - { - return _triangulationMode; - } - - public synchronized void waitUntilNotified(boolean b) - { - _waitUntilNotified = b; - } - - public void terminateTriangulation() - { - _terminated=true; - } - - public boolean isDebugEnabled() - { - return _debugEnabled; - } - - public abstract void isDebugEnabled( boolean b ); - - public A getDebugContext() - { - return _debug; - } - - public void addPoints( List points ) - { - _points.addAll( points ); - } -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationDebugContext.java b/src/main/java/org/poly2tri/triangulation/TriangulationDebugContext.java deleted file mode 100644 index a6eca87..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationDebugContext.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.poly2tri.triangulation; - -public abstract class TriangulationDebugContext -{ - protected TriangulationContext _tcx; - - public TriangulationDebugContext( TriangulationContext tcx ) - { - _tcx = tcx; - } - - public abstract void clear(); -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationMode.java b/src/main/java/org/poly2tri/triangulation/TriangulationMode.java deleted file mode 100644 index 946862d..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationMode.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.poly2tri.triangulation; - -public enum TriangulationMode -{ - UNCONSTRAINED,CONSTRAINED,POLYGON; -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationPoint.java b/src/main/java/org/poly2tri/triangulation/TriangulationPoint.java deleted file mode 100644 index 37686a5..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationPoint.java +++ /dev/null @@ -1,112 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation; - -import java.util.ArrayList; - -import org.poly2tri.geometry.primitives.Point; -import org.poly2tri.triangulation.delaunay.sweep.DTSweepConstraint; - - -public abstract class TriangulationPoint extends Point -{ - // List of edges this point constitutes an upper ending point (CDT) - private ArrayList edges; - - @Override - public String toString() - { - return "[" + getX() + "," + getY() + "]"; - } - - public abstract double getX(); - public abstract double getY(); - public abstract double getZ(); - - public abstract float getXf(); - public abstract float getYf(); - public abstract float getZf(); - - public abstract void set( double x, double y, double z ); - - public ArrayList getEdges() - { - return edges; - } - - public void addEdge( DTSweepConstraint e ) - { - if( edges == null ) - { - edges = new ArrayList(); - } - edges.add( e ); - } - - public boolean hasEdges() - { - return edges != null; - } - - /** - * @param p - edge destination point - * @return the edge from this point to given point - */ - public DTSweepConstraint getEdge( TriangulationPoint p ) - { - for( DTSweepConstraint c : edges ) - { - if( c.p == p ) - { - return c; - } - } - return null; - } - - public boolean equals(Object obj) - { - if( obj instanceof TriangulationPoint ) - { - TriangulationPoint p = (TriangulationPoint)obj; - return getX() == p.getX() && getY() == p.getY(); - } - return super.equals( obj ); - } - - public int hashCode() - { - long bits = java.lang.Double.doubleToLongBits(getX()); - bits ^= java.lang.Double.doubleToLongBits(getY()) * 31; - return (((int) bits) ^ ((int) (bits >> 32))); - } - -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationProcess.java b/src/main/java/org/poly2tri/triangulation/TriangulationProcess.java deleted file mode 100644 index 35baf1f..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationProcess.java +++ /dev/null @@ -1,341 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation; - -import java.lang.Thread.State; -import java.util.ArrayList; -import java.util.List; - -import org.poly2tri.Poly2Tri; -import org.poly2tri.geometry.polygon.Polygon; -import org.poly2tri.geometry.polygon.PolygonSet; -import org.poly2tri.triangulation.sets.ConstrainedPointSet; -import org.poly2tri.triangulation.sets.PointSet; - - -/** - * - * @author Thomas Åhlén, thahlen@gmail.com - * - */ -public class TriangulationProcess implements Runnable -{ - - private final TriangulationAlgorithm _algorithm; - - private TriangulationContext _tcx; - private Thread _thread; - private boolean _isTerminated = false; - private int _pointCount = 0; - private long _timestamp = 0; - private double _triangulationTime = 0; - - private boolean _awaitingTermination; - private boolean _restart = false; - - private ArrayList _triangulations = new ArrayList(); - - private ArrayList _listeners = new ArrayList(); - - public void addListener( TriangulationProcessListener listener ) - { - _listeners.add( listener ); - } - - public void removeListener( TriangulationProcessListener listener ) - { - _listeners.remove( listener ); - } - - public void clearListeners() - { - _listeners.clear(); - } - - /** - * Notify all listeners of this new event - * @param event - */ - private void sendEvent( TriangulationProcessEvent event ) - { - for( TriangulationProcessListener l : _listeners ) - { - l.triangulationEvent( event, _tcx.getTriangulatable() ); - } - } - - public int getStepCount() - { - return _tcx.getStepCount(); - } - - public long getTimestamp() - { - return _timestamp; - } - - public double getTriangulationTime() - { - return _triangulationTime; - } - - /** - * Uses SweepLine algorithm by default - * @param algorithm - */ - public TriangulationProcess() - { - this( TriangulationAlgorithm.DTSweep ); - } - - public TriangulationProcess( TriangulationAlgorithm algorithm ) - { - _algorithm = algorithm; - _tcx = Poly2Tri.createContext( algorithm ); - } - - /** - * This retriangulates same set as previous triangulation - * useful if you want to do consecutive triangulations with - * same data. Like when you when you want to do performance - * tests. - */ -// public void triangulate() -// { -// start(); -// } - - /** - * Triangulate a PointSet with eventual constraints - * - * @param cps - */ - public void triangulate( PointSet ps ) - { - _triangulations.clear(); - _triangulations.add( ps ); - start(); - } - - /** - * Triangulate a PointSet with eventual constraints - * - * @param cps - */ - public void triangulate( ConstrainedPointSet cps ) - { - _triangulations.clear(); - _triangulations.add( cps ); - start(); - } - - /** - * Triangulate a PolygonSet - * - * @param ps - */ - public void triangulate( PolygonSet ps ) - { - _triangulations.clear(); - _triangulations.addAll( ps.getPolygons() ); - start(); - } - - /** - * Triangulate a Polygon - * - * @param ps - */ - public void triangulate( Polygon polygon ) - { - _triangulations.clear(); - _triangulations.add( polygon ); - start(); - } - - /** - * Triangulate a List of Triangulatables - * - * @param ps - */ - public void triangulate( List list ) - { - _triangulations.clear(); - _triangulations.addAll( list ); - start(); - } - - private void start() - { - if( _thread == null || _thread.getState() == State.TERMINATED ) - { - _isTerminated = false; - _thread = new Thread( this, _algorithm.name() + "." + _tcx.getTriangulationMode() ); - _thread.start(); - sendEvent( TriangulationProcessEvent.Started ); - } - else - { - // Triangulation already running. Terminate it so we can start a new - shutdown(); - _restart = true; - } - } - - public boolean isWaiting() - { - if( _thread != null && _thread.getState() == State.WAITING ) - { - return true; - } - return false; - } - - public void run() - { - _pointCount=0; - try - { - long time = System.nanoTime(); - for( Triangulatable t : _triangulations ) - { - _tcx.clear(); - _tcx.prepareTriangulation( t ); - _pointCount += _tcx._points.size(); - Poly2Tri.triangulate( _tcx ); - } - _triangulationTime = ( System.nanoTime() - time ) / 1e6; - sendEvent( TriangulationProcessEvent.Done ); - } - catch( RuntimeException e ) - { - if( _awaitingTermination ) - { - _awaitingTermination = false; - sendEvent( TriangulationProcessEvent.Aborted ); - } - else - { - e.printStackTrace(); - sendEvent( TriangulationProcessEvent.Failed ); - } - } - catch( Exception e ) - { - e.printStackTrace(); - sendEvent( TriangulationProcessEvent.Failed ); - } - finally - { - _timestamp = System.currentTimeMillis(); - _isTerminated = true; - _thread = null; - } - - // Autostart a new triangulation? - if( _restart ) - { - _restart = false; - start(); - } - } - - public void resume() - { - if( _thread != null ) - { - // Only force a resume when process is waiting for a notification - if( _thread.getState() == State.WAITING ) - { - synchronized( _tcx ) - { - _tcx.notify(); - } - } - else if( _thread.getState() == State.TIMED_WAITING ) - { - _tcx.waitUntilNotified( false ); - } - } - } - - public void shutdown() - { - _awaitingTermination = true; - _tcx.terminateTriangulation(); - resume(); - } - - public TriangulationContext getContext() - { - return _tcx; - } - - public boolean isDone() - { - return _isTerminated; - } - - public void requestRead() - { - _tcx.waitUntilNotified( true ); - } - - public boolean isReadable() - { - if( _thread == null ) - { - return true; - } - else - { - synchronized( _thread ) - { - if( _thread.getState() == State.WAITING ) - { - return true; - } - else if( _thread.getState() == State.TIMED_WAITING ) - { - // Make sure that it stays readable - _tcx.waitUntilNotified( true ); - return true; - } - return false; - } - } - } - - public int getPointCount() - { - return _pointCount; - } -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationProcessEvent.java b/src/main/java/org/poly2tri/triangulation/TriangulationProcessEvent.java deleted file mode 100644 index dce9e04..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationProcessEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation; - -public enum TriangulationProcessEvent -{ - Started,Waiting,Failed,Aborted,Done -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationProcessListener.java b/src/main/java/org/poly2tri/triangulation/TriangulationProcessListener.java deleted file mode 100644 index 922e3c9..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationProcessListener.java +++ /dev/null @@ -1,36 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation; - -public interface TriangulationProcessListener -{ - public void triangulationEvent( TriangulationProcessEvent e, Triangulatable unit ); -} diff --git a/src/main/java/org/poly2tri/triangulation/TriangulationUtil.java b/src/main/java/org/poly2tri/triangulation/TriangulationUtil.java deleted file mode 100644 index 9da0328..0000000 --- a/src/main/java/org/poly2tri/triangulation/TriangulationUtil.java +++ /dev/null @@ -1,213 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */package org.poly2tri.triangulation; - - -/** - * @author Thomas Åhlén, thahlen@gmail.com - */ -public class TriangulationUtil -{ - public final static double EPSILON = 1e-12; - - // Returns triangle circumcircle point and radius -// public static Tuple2 circumCircle( TPoint a, TPoint b, TPoint c ) -// { -// double A = det( a, b, c ); -// double C = detC( a, b, c ); -// -// double sa = a.getX() * a.getX() + a.getY() * a.getY(); -// double sb = b.getX() * b.getX() + b.getY() * b.getY(); -// double sc = c.getX() * c.getX() + c.getY() * c.getY(); -// -// TPoint bx1 = new TPoint( sa, a.getY() ); -// TPoint bx2 = new TPoint( sb, b.getY() ); -// TPoint bx3 = new TPoint( sc, c.getY() ); -// double bx = det( bx1, bx2, bx3 ); -// -// TPoint by1 = new TPoint( sa, a.getX() ); -// TPoint by2 = new TPoint( sb, b.getX() ); -// TPoint by3 = new TPoint( sc, c.getX() ); -// double by = det( by1, by2, by3 ); -// -// double x = bx / ( 2 * A ); -// double y = by / ( 2 * A ); -// -// TPoint center = new TPoint( x, y ); -// double radius = Math.sqrt( bx * bx + by * by - 4 * A * C ) / ( 2 * Math.abs( A ) ); -// -// return new Tuple2( center, radius ); -// } - - /** - * Requirement:
- * 1. a,b and c form a triangle.
- * 2. a and d is know to be on opposite side of bc
- *
-     *                a
-     *                +
-     *               / \
-     *              /   \
-     *            b/     \c
-     *            +-------+ 
-     *           /    B    \  
-     *          /           \ 
-     * 
- * Fact: d has to be in area B to have a chance to be inside the circle formed by - * a,b and c
- * d is outside B if orient2d(a,b,d) or orient2d(c,a,d) is CW
- * This preknowledge gives us a way to optimize the incircle test - * @param a - triangle point, opposite d - * @param b - triangle point - * @param c - triangle point - * @param d - point opposite a - * @return true if d is inside circle, false if on circle edge - */ - public static boolean smartIncircle( final TriangulationPoint pa, - final TriangulationPoint pb, - final TriangulationPoint pc, - final TriangulationPoint pd ) - { - final double pdx = pd.getX(); - final double pdy = pd.getY(); - final double adx = pa.getX() - pdx; - final double ady = pa.getY() - pdy; - final double bdx = pb.getX() - pdx; - final double bdy = pb.getY() - pdy; - - final double adxbdy = adx * bdy; - final double bdxady = bdx * ady; - final double oabd = adxbdy - bdxady; -// oabd = orient2d(pa,pb,pd); - if( oabd <= 0 ) - { - return false; - } - - final double cdx = pc.getX() - pdx; - final double cdy = pc.getY() - pdy; - - final double cdxady = cdx * ady; - final double adxcdy = adx * cdy; - final double ocad = cdxady - adxcdy; -// ocad = orient2d(pc,pa,pd); - if( ocad <= 0 ) - { - return false; - } - - final double bdxcdy = bdx * cdy; - final double cdxbdy = cdx * bdy; - - final double alift = adx * adx + ady * ady; - final double blift = bdx * bdx + bdy * bdy; - final double clift = cdx * cdx + cdy * cdy; - - final double det = alift * ( bdxcdy - cdxbdy ) + blift * ocad + clift * oabd; - - return det > 0; - } - - /** - * @see smartIncircle - * @param pa - * @param pb - * @param pc - * @param pd - * @return - */ - public static boolean inScanArea( final TriangulationPoint pa, - final TriangulationPoint pb, - final TriangulationPoint pc, - final TriangulationPoint pd ) - { - final double pdx = pd.getX(); - final double pdy = pd.getY(); - final double adx = pa.getX() - pdx; - final double ady = pa.getY() - pdy; - final double bdx = pb.getX() - pdx; - final double bdy = pb.getY() - pdy; - - final double adxbdy = adx * bdy; - final double bdxady = bdx * ady; - final double oabd = adxbdy - bdxady; -// oabd = orient2d(pa,pb,pd); - if( oabd <= 0 ) - { - return false; - } - - final double cdx = pc.getX() - pdx; - final double cdy = pc.getY() - pdy; - - final double cdxady = cdx * ady; - final double adxcdy = adx * cdy; - final double ocad = cdxady - adxcdy; -// ocad = orient2d(pc,pa,pd); - if( ocad <= 0 ) - { - return false; - } - return true; - } - - /** - * Forumla to calculate signed area
- * Positive if CCW
- * Negative if CW
- * 0 if collinear
- *
-     * A[P1,P2,P3]  =  (x1*y2 - y1*x2) + (x2*y3 - y2*x3) + (x3*y1 - y3*x1)
-     *              =  (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)
-     * 
- */ - public static Orientation orient2d( TriangulationPoint pa, - TriangulationPoint pb, - TriangulationPoint pc ) - { - double detleft = ( pa.getX() - pc.getX() ) * ( pb.getY() - pc.getY() ); - double detright = ( pa.getY() - pc.getY() ) * ( pb.getX() - pc.getX() ); - double val = detleft - detright; - if( val > -EPSILON && val < EPSILON ) - { - return Orientation.Collinear; - } - else if( val > 0 ) - { - return Orientation.CCW; - } - return Orientation.CW; - } - - public enum Orientation - { - CW,CCW,Collinear; - } -} diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java b/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java deleted file mode 100644 index c93fcb0..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java +++ /dev/null @@ -1,685 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.delaunay; - -import java.util.ArrayList; - -import org.poly2tri.triangulation.TriangulationPoint; -import org.poly2tri.triangulation.delaunay.sweep.DTSweepConstraint; -import org.poly2tri.triangulation.point.TPoint; - - -public class DelaunayTriangle -{ - - /** Neighbor pointers */ - public final DelaunayTriangle[] neighbors = new DelaunayTriangle[3]; - /** Flags to determine if an edge is a Constrained edge */ - public final boolean[] cEdge = new boolean[] { false, false, false }; - /** Flags to determine if an edge is a Delauney edge */ - public final boolean[] dEdge = new boolean[] { false, false, false }; - /** Has this triangle been marked as an interior triangle? */ - protected boolean interior = false; - - public final TriangulationPoint[] points = new TriangulationPoint[3]; - - public DelaunayTriangle( TriangulationPoint p1, TriangulationPoint p2, TriangulationPoint p3 ) - { - points[0] = p1; - points[1] = p2; - points[2] = p3; - } - - public int index( TriangulationPoint p ) - { - if( p == points[0] ) - { - return 0; - } - else if( p == points[1] ) - { - return 1; - } - else if( p == points[2] ) - { - return 2; - } - throw new RuntimeException("Calling index with a point that doesn't exist in triangle"); - } - - public int indexCW( TriangulationPoint p ) - { - int index = index(p); - switch( index ) - { - case 0: return 2; - case 1: return 0; - default: return 1; - } - } - - public int indexCCW( TriangulationPoint p ) - { - int index = index(p); - switch( index ) - { - case 0: return 1; - case 1: return 2; - default: return 0; - } - } - - public boolean contains( TriangulationPoint p ) - { - return ( p == points[0] || p == points[1] || p == points[2] ); - } - - public boolean contains( DTSweepConstraint e ) - { - return ( contains( e.p ) && contains( e.q ) ); - } - - public boolean contains( TriangulationPoint p, TriangulationPoint q ) - { - return ( contains( p ) && contains( q ) ); - } - - // Update neighbor pointers - private void markNeighbor( TriangulationPoint p1, - TriangulationPoint p2, - DelaunayTriangle t ) - { - if( ( p1 == points[2] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[2] ) ) - { - neighbors[0] = t; - } - else if( ( p1 == points[0] && p2 == points[2] ) || ( p1 == points[2] && p2 == points[0] ) ) - { - neighbors[1] = t; - } - else if( ( p1 == points[0] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[0] ) ) - { - neighbors[2] = t; - } - else - { - // throw new Exception("Neighbor error, please report!"); - } - } - - /* Exhaustive search to update neighbor pointers */ - public void markNeighbor( DelaunayTriangle t ) - { - if( t.contains( points[1], points[2] ) ) - { - neighbors[0] = t; - t.markNeighbor( points[1], points[2], this ); - } - else if( t.contains( points[0], points[2] ) ) - { - neighbors[1] = t; - t.markNeighbor( points[0], points[2], this ); - } - else if( t.contains( points[0], points[1] ) ) - { - neighbors[2] = t; - t.markNeighbor( points[0], points[1], this ); - } - else - { - } - } - - public void clearNeighbors() - { - neighbors[0] = neighbors[1] = neighbors[2] = null; - } - - public void clearNeighbor( DelaunayTriangle triangle ) - { - if( neighbors[0] == triangle ) - { - neighbors[0] = null; - } - else if( neighbors[1] == triangle ) - { - neighbors[1] = null; - } - else - { - neighbors[2] = null; - } - } - - /** - * Clears all references to all other triangles and points - */ - public void clear() - { - DelaunayTriangle t; - for( int i=0; i<3; i++ ) - { - t = neighbors[i]; - if( t != null ) - { - t.clearNeighbor( this ); - } - } - clearNeighbors(); - points[0]=points[1]=points[2]=null; - } - /** - * @param t - opposite triangle - * @param p - the point in t that isn't shared between the triangles - * @return - */ - public TriangulationPoint oppositePoint( DelaunayTriangle t, TriangulationPoint p ) - { - assert t != this : "self-pointer error"; - return pointCW( t.pointCW(p) ); - } - - // The neighbor clockwise to given point - public DelaunayTriangle neighborCW( TriangulationPoint point ) - { - if( point == points[0] ) - { - return neighbors[1]; - } - else if( point == points[1] ) - { - return neighbors[2]; - } - return neighbors[0]; - } - - // The neighbor counter-clockwise to given point - public DelaunayTriangle neighborCCW( TriangulationPoint point ) - { - if( point == points[0] ) - { - return neighbors[2]; - } - else if( point == points[1] ) - { - return neighbors[0]; - } - return neighbors[1]; - } - - // The neighbor across to given point - public DelaunayTriangle neighborAcross( TriangulationPoint opoint ) - { - if( opoint == points[0] ) - { - return neighbors[0]; - } - else if( opoint == points[1] ) - { - return neighbors[1]; - } - return neighbors[2]; - } - - // The point counter-clockwise to given point - public TriangulationPoint pointCCW( TriangulationPoint point ) - { - if( point == points[0] ) - { - return points[1]; - } - else if( point == points[1] ) - { - return points[2]; - } - else if( point == points[2] ) - { - return points[0]; - } - throw new RuntimeException("[FIXME] point location error"); - } - - // The point counter-clockwise to given point - public TriangulationPoint pointCW( TriangulationPoint point ) - { - if( point == points[0] ) - { - return points[2]; - } - else if( point == points[1] ) - { - return points[0]; - } - else if( point == points[2] ) - { - return points[1]; - } - throw new RuntimeException("[FIXME] point location error"); - } - - // Legalize triangle by rotating clockwise around oPoint - public void legalize( TriangulationPoint oPoint, TriangulationPoint nPoint ) - { - if( oPoint == points[0] ) - { - points[1] = points[0]; - points[0] = points[2]; - points[2] = nPoint; - } - else if( oPoint == points[1] ) - { - points[2] = points[1]; - points[1] = points[0]; - points[0] = nPoint; - } - else if( oPoint == points[2] ) - { - points[0] = points[2]; - points[2] = points[1]; - points[1] = nPoint; - } - else - { - throw new RuntimeException("legalization bug"); - } - } - - public void printDebug() - { - System.out.println( points[0] + "," + points[1] + "," + points[2] ); - } - - // Finalize edge marking - public void markNeighborEdges() - { - for( int i = 0; i < 3; i++ ) - { - if( cEdge[i] ) - { - switch( i ) - { - case 0: - if( neighbors[0] != null ) - neighbors[0].markConstrainedEdge( points[1], points[2] ); - break; - case 1: - if( neighbors[1] != null ) - neighbors[1].markConstrainedEdge( points[0], points[2] ); - break; - case 2: - if( neighbors[2] != null ) - neighbors[2].markConstrainedEdge( points[0], points[1] ); - break; - } - } - } - } - - public void markEdge( DelaunayTriangle triangle ) - { - for( int i = 0; i < 3; i++ ) - { - if( cEdge[i] ) - { - switch( i ) - { - case 0: - triangle.markConstrainedEdge( points[1], points[2] ); - break; - case 1: - triangle.markConstrainedEdge( points[0], points[2] ); - break; - case 2: - triangle.markConstrainedEdge( points[0], points[1] ); - break; - } - } - } - } - - public void markEdge( ArrayList tList ) - { - - for( DelaunayTriangle t : tList ) - { - for( int i = 0; i < 3; i++ ) - { - if( t.cEdge[i] ) - { - switch( i ) - { - case 0: - markConstrainedEdge( t.points[1], t.points[2] ); - break; - case 1: - markConstrainedEdge( t.points[0], t.points[2] ); - break; - case 2: - markConstrainedEdge( t.points[0], t.points[1] ); - break; - } - } - } - } - } - - public void markConstrainedEdge( int index ) - { - cEdge[index] = true; - } - - public void markConstrainedEdge( DTSweepConstraint edge ) - { - markConstrainedEdge( edge.p, edge.q ); - if( ( edge.q == points[0] && edge.p == points[1] ) - || ( edge.q == points[1] && edge.p == points[0] ) ) - { - cEdge[2] = true; - } - else if( ( edge.q == points[0] && edge.p == points[2] ) - || ( edge.q == points[2] && edge.p == points[0] ) ) - { - cEdge[1] = true; - } - else if( ( edge.q == points[1] && edge.p == points[2] ) - || ( edge.q == points[2] && edge.p == points[1] ) ) - { - cEdge[0] = true; - } - } - - // Mark edge as constrained - public void markConstrainedEdge( TriangulationPoint p, TriangulationPoint q ) - { - if( ( q == points[0] && p == points[1] ) || ( q == points[1] && p == points[0] ) ) - { - cEdge[2] = true; - } - else if( ( q == points[0] && p == points[2] ) || ( q == points[2] && p == points[0] ) ) - { - cEdge[1] = true; - } - else if( ( q == points[1] && p == points[2] ) || ( q == points[2] && p == points[1] ) ) - { - cEdge[0] = true; - } - } - - public double area() - { - double a = (points[0].getX() - points[2].getX())*(points[1].getY() - points[0].getY()); - double b = (points[0].getX() - points[1].getX())*(points[2].getY() - points[0].getY()); - - return 0.5*Math.abs( a - b ); - } - - public TPoint centroid() - { - double cx = ( points[0].getX() + points[1].getX() + points[2].getX() ) / 3d; - double cy = ( points[0].getY() + points[1].getY() + points[2].getY() ) / 3d; - return new TPoint( cx, cy ); - } - - /** - * Get the neighbor that share this edge - * - * @param constrainedEdge - * @return index of the shared edge or -1 if edge isn't shared - */ - public int edgeIndex( TriangulationPoint p1, TriangulationPoint p2 ) - { - if( points[0] == p1 ) - { - if( points[1] == p2 ) - { - return 2; - } - else if( points[2] == p2 ) - { - return 1; - } - } - else if( points[1] == p1 ) - { - if( points[2] == p2 ) - { - return 0; - } - else if( points[0] == p2 ) - { - return 2; - } - } - else if( points[2] == p1 ) - { - if( points[0] == p2 ) - { - return 1; - } - else if( points[1] == p2 ) - { - return 0; - } - } - return -1; - } - - public boolean getConstrainedEdgeCCW( TriangulationPoint p ) - { - if( p == points[0] ) - { - return cEdge[2]; - } - else if( p == points[1] ) - { - return cEdge[0]; - } - return cEdge[1]; - } - - public boolean getConstrainedEdgeCW( TriangulationPoint p ) - { - if( p == points[0] ) - { - return cEdge[1]; - } - else if( p == points[1] ) - { - return cEdge[2]; - } - return cEdge[0]; - } - - public boolean getConstrainedEdgeAcross( TriangulationPoint p ) - { - if( p == points[0] ) - { - return cEdge[0]; - } - else if( p == points[1] ) - { - return cEdge[1]; - } - return cEdge[2]; - } - - public void setConstrainedEdgeCCW( TriangulationPoint p, boolean ce ) - { - if( p == points[0] ) - { - cEdge[2] = ce; - } - else if( p == points[1] ) - { - cEdge[0] = ce; - } - else - { - cEdge[1] = ce; - } - } - - public void setConstrainedEdgeCW( TriangulationPoint p, boolean ce ) - { - if( p == points[0] ) - { - cEdge[1] = ce; - } - else if( p == points[1] ) - { - cEdge[2] = ce; - } - else - { - cEdge[0] = ce; - } - } - - public void setConstrainedEdgeAcross( TriangulationPoint p, boolean ce ) - { - if( p == points[0] ) - { - cEdge[0] = ce; - } - else if( p == points[1] ) - { - cEdge[1] = ce; - } - else - { - cEdge[2] = ce; - } - } - - public boolean getDelunayEdgeCCW( TriangulationPoint p ) - { - if( p == points[0] ) - { - return dEdge[2]; - } - else if( p == points[1] ) - { - return dEdge[0]; - } - return dEdge[1]; - } - - public boolean getDelunayEdgeCW( TriangulationPoint p ) - { - if( p == points[0] ) - { - return dEdge[1]; - } - else if( p == points[1] ) - { - return dEdge[2]; - } - return dEdge[0]; - } - - public boolean getDelunayEdgeAcross( TriangulationPoint p ) - { - if( p == points[0] ) - { - return dEdge[0]; - } - else if( p == points[1] ) - { - return dEdge[1]; - } - return dEdge[2]; - } - - public void setDelunayEdgeCCW( TriangulationPoint p, boolean e ) - { - if( p == points[0] ) - { - dEdge[2] = e; - } - else if( p == points[1] ) - { - dEdge[0] = e; - } - else - { - dEdge[1] = e; - } - } - - public void setDelunayEdgeCW( TriangulationPoint p, boolean e ) - { - if( p == points[0] ) - { - dEdge[1] = e; - } - else if( p == points[1] ) - { - dEdge[2] = e; - } - else - { - dEdge[0] = e; - } - } - - public void setDelunayEdgeAcross( TriangulationPoint p, boolean e ) - { - if( p == points[0] ) - { - dEdge[0] = e; - } - else if( p == points[1] ) - { - dEdge[1] = e; - } - else - { - dEdge[2] = e; - } - } - - public void clearDelunayEdges() - { - dEdge[0] = false; - dEdge[1] = false; - dEdge[2] = false; - } - - public boolean isInterior() - { - return interior; - } - - public void isInterior( boolean b ) - { - interior = b; - } -} diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/AdvancingFront.java b/src/main/java/org/poly2tri/triangulation/delaunay/sweep/AdvancingFront.java deleted file mode 100644 index e7994f3..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/AdvancingFront.java +++ /dev/null @@ -1,179 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.delaunay.sweep; - -import org.poly2tri.triangulation.TriangulationPoint; - - -/** - * @author Thomas Åhlen (thahlen@gmail.com) - */ -public class AdvancingFront -{ - public AdvancingFrontNode head; - public AdvancingFrontNode tail; - protected AdvancingFrontNode search; - - public AdvancingFront( AdvancingFrontNode head, AdvancingFrontNode tail ) - { - this.head = head; - this.tail = tail; - this.search = head; - addNode( head ); - addNode( tail ); - } - - public void addNode( AdvancingFrontNode node ) - { -// _searchTree.put( node.key, node ); - } - - public void removeNode( AdvancingFrontNode node ) - { -// _searchTree.delete( node.key ); - } - - public String toString() - { - StringBuilder sb = new StringBuilder(); - AdvancingFrontNode node = head; - while( node != tail ) - { - sb.append( node.point.getX() ).append( "->" ); - node = node.next; - } - sb.append( tail.point.getX() ); - return sb.toString(); - } - - private final AdvancingFrontNode findSearchNode( double x ) - { - // TODO: implement BST index - return search; - } - - /** - * We use a balancing tree to locate a node smaller or equal to - * given key value - * - * @param x - * @return - */ - public AdvancingFrontNode locateNode( TriangulationPoint point ) - { - return locateNode( point.getX() ); - } - - private AdvancingFrontNode locateNode( double x ) - { - AdvancingFrontNode node = findSearchNode(x); - if( x < node.value ) - { - while( (node = node.prev) != null ) - { - if( x >= node.value ) - { - search = node; - return node; - } - } - } - else - { - while( (node = node.next) != null ) - { - if( x < node.value ) - { - search = node.prev; - return node.prev; - } - } - } - return null; - } - - /** - * This implementation will use simple node traversal algorithm to find - * a point on the front - * - * @param point - * @return - */ - public AdvancingFrontNode locatePoint( final TriangulationPoint point ) - { - final double px = point.getX(); - AdvancingFrontNode node = findSearchNode(px); - final double nx = node.point.getX(); - - if( px == nx ) - { - if( point != node.point ) - { - // We might have two nodes with same x value for a short time - if( point == node.prev.point ) - { - node = node.prev; - } - else if( point == node.next.point ) - { - node = node.next; - } - else - { - throw new RuntimeException( "Failed to find Node for given afront point"); -// node = null; - } - } - } - else if( px < nx ) - { - while( (node = node.prev) != null ) - { - if( point == node.point ) - { - break; - } - } - } - else - { - while( (node = node.next) != null ) - { - if( point == node.point ) - { - break; - } - } - } - search = node; - return node; - } -} \ No newline at end of file diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/AdvancingFrontIndex.java b/src/main/java/org/poly2tri/triangulation/delaunay/sweep/AdvancingFrontIndex.java deleted file mode 100644 index 8305416..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/AdvancingFrontIndex.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.poly2tri.triangulation.delaunay.sweep; - -public class AdvancingFrontIndex
-{ - double _min,_max; - IndexNode _root; - - public AdvancingFrontIndex( double min, double max, int depth ) - { - if( depth > 5 ) depth = 5; - _root = createIndex( depth ); - } - - private IndexNode createIndex( int n ) - { - IndexNode node = null; - if( n > 0 ) - { - node = new IndexNode(); - node.bigger = createIndex( n-1 ); - node.smaller = createIndex( n-1 ); - } - return node; - } - - public A fetchAndRemoveIndex( A key ) - { - return null; - } - - public A fetchAndInsertIndex( A key ) - { - return null; - } - - class IndexNode - { - A value; - IndexNode smaller; - IndexNode bigger; - double range; - } -} diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/AdvancingFrontNode.java b/src/main/java/org/poly2tri/triangulation/delaunay/sweep/AdvancingFrontNode.java deleted file mode 100644 index d986925..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/AdvancingFrontNode.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.delaunay.sweep; - -import org.poly2tri.triangulation.TriangulationPoint; -import org.poly2tri.triangulation.delaunay.DelaunayTriangle; - - - -public class AdvancingFrontNode -{ - protected AdvancingFrontNode next = null; - protected AdvancingFrontNode prev = null; - - protected final Double key; // XXX: BST - protected final double value; - protected final TriangulationPoint point; - protected DelaunayTriangle triangle; - - public AdvancingFrontNode( TriangulationPoint point ) - { - this.point = point; - value = point.getX(); - key = Double.valueOf( value ); // XXX: BST - } - - public AdvancingFrontNode getNext() - { - return next; - } - - public AdvancingFrontNode getPrevious() - { - return prev; - } - - public TriangulationPoint getPoint() - { - return point; - } - - public DelaunayTriangle getTriangle() - { - return triangle; - } - - public boolean hasNext() - { - return next != null; - } - - public boolean hasPrevious() - { - return prev != null; - } -} diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweep.java b/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweep.java deleted file mode 100644 index bd9fd35..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweep.java +++ /dev/null @@ -1,1290 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.delaunay.sweep; - -import static org.poly2tri.triangulation.TriangulationUtil.EPSILON; -import static org.poly2tri.triangulation.TriangulationUtil.inScanArea; -import static org.poly2tri.triangulation.TriangulationUtil.orient2d; -import static org.poly2tri.triangulation.TriangulationUtil.smartIncircle; -import java.util.List; -import org.poly2tri.triangulation.TriangulationMode; -import org.poly2tri.triangulation.TriangulationPoint; -import org.poly2tri.triangulation.TriangulationUtil.Orientation; -import org.poly2tri.triangulation.delaunay.DelaunayTriangle; - -/** - * Sweep-line, Constrained Delauney Triangulation (CDT) See: Domiter, V. and - * Zalik, B.(2008)'Sweep-line algorithm for constrained Delaunay triangulation', - * International Journal of Geographical Information Science - * - * "FlipScan" Constrained Edge Algorithm invented by author of this code. - * - * Author: Thomas Åhlén, thahlen@gmail.com - */ - -public class DTSweep -{ - - private final static double PI_div2 = Math.PI/2; - private final static double PI_3div4 = 3*Math.PI/4; - - public DTSweep() - {} - - /** Triangulate simple polygon with holes **/ - public static void triangulate( DTSweepContext tcx ) - { - tcx.createAdvancingFront(); - - sweep( tcx ); - - if( tcx.getTriangulationMode() == TriangulationMode.POLYGON ) - { - finalizationPolygon( tcx ); - } - else - { - finalizationConvexHull( tcx ); - } - - tcx.done(); - } - - /** - * Start sweeping the Y-sorted point set from bottom to top - * - * @param tcx - */ - private static void sweep( DTSweepContext tcx ) - { - List points; - TriangulationPoint point; - AdvancingFrontNode node; - - points = tcx.getPoints(); - - for( int i=1; i - */ - private static void turnAdvancingFrontConvex( DTSweepContext tcx, - AdvancingFrontNode b, - AdvancingFrontNode c ) - { - AdvancingFrontNode first = b; - while( c != tcx.aFront.tail ) - { - if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( c ); } - - if( orient2d( b.point, c.point, c.next.point ) == Orientation.CCW ) - { - // [b,c,d] Concave - fill around c - fill( tcx, c ); - c = c.next; - } - else - { - // [b,c,d] Convex - if( b != first && orient2d( b.prev.point, b.point, c.point ) == Orientation.CCW ) - { - // [a,b,c] Concave - fill around b - fill( tcx, b ); - b = b.prev; - } - else - { - // [a,b,c] Convex - nothing to fill - b = c; - c = c.next; - } - } - } - } - - private static void finalizationPolygon( DTSweepContext tcx ) - { - // Get an Internal triangle to start with - DelaunayTriangle t = tcx.aFront.head.next.triangle; - TriangulationPoint p = tcx.aFront.head.next.point; - while( !t.getConstrainedEdgeCW( p ) ) - { - t = t.neighborCCW( p ); - } - - // Collect interior triangles constrained by edges - tcx.meshClean( t ); - } - - /** - * Find closes node to the left of the new point and - * create a new triangle. If needed new holes and basins - * will be filled to. - * - * @param tcx - * @param point - * @return - */ - private static AdvancingFrontNode pointEvent( DTSweepContext tcx, - TriangulationPoint point ) - { - AdvancingFrontNode node,newNode; - - node = tcx.locateNode( point ); - if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( node ); } - newNode = newFrontTriangle( tcx, point, node ); - - // Only need to check +epsilon since point never have smaller - // x value than node due to how we fetch nodes from the front - if( point.getX() <= node.point.getX() + EPSILON ) - { - fill( tcx, node ); - } - tcx.addNode( newNode ); - - fillAdvancingFront( tcx, newNode ); - return newNode; - } - - /** - * Creates a new front triangle and legalize it - * - * @param tcx - * @param point - * @param node - * @return - */ - private static AdvancingFrontNode newFrontTriangle( DTSweepContext tcx, - TriangulationPoint point, - AdvancingFrontNode node ) - { - AdvancingFrontNode newNode; - DelaunayTriangle triangle; - - triangle = new DelaunayTriangle( point, node.point, node.next.point ); - triangle.markNeighbor( node.triangle ); - tcx.addToList( triangle ); - - newNode = new AdvancingFrontNode( point ); - newNode.next = node.next; - newNode.prev = node; - node.next.prev = newNode; - node.next = newNode; - - tcx.addNode( newNode ); // XXX: BST - - if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( newNode ); } - - if( !legalize( tcx, triangle ) ) - { - tcx.mapTriangleToNodes( triangle ); - } - - return newNode; - } - - /** - * - * - * @param tcx - * @param edge - * @param node - */ - private static void edgeEvent( DTSweepContext tcx, - DTSweepConstraint edge, - AdvancingFrontNode node ) - { - try - { - tcx.edgeEvent.constrainedEdge = edge; - tcx.edgeEvent.right = edge.p.getX() > edge.q.getX(); - - if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setPrimaryTriangle( node.triangle ); } - - if( isEdgeSideOfTriangle( node.triangle, edge.p, edge.q ) ) - { - return; - } - - // For now we will do all needed filling - // TODO: integrate with flip process might give some better performance - // but for now this avoid the issue with cases that needs both flips and fills - fillEdgeEvent( tcx, edge, node ); - - edgeEvent( tcx, edge.p, edge.q , node.triangle, edge.q ); - } - catch( PointOnEdgeException e ) - { - } - } - - private static void fillEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) - { - if( tcx.edgeEvent.right ) - { - fillRightAboveEdgeEvent( tcx, edge, node ); - } - else - { - fillLeftAboveEdgeEvent( tcx, edge, node ); - } - } - - private static void fillRightConcaveEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) - { - fill( tcx, node.next ); - if( node.next.point != edge.p ) - { - // Next above or below edge? - if( orient2d( edge.q, node.next.point, edge.p ) == Orientation.CCW ) - { - // Below - if( orient2d( node.point, node.next.point, node.next.next.point ) == Orientation.CCW ) - { - // Next is concave - fillRightConcaveEdgeEvent( tcx, edge, node ); - } - else - { - // Next is convex - } - } - } - } - - private static void fillRightConvexEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) - { - // Next concave or convex? - if( orient2d( node.next.point, node.next.next.point, node.next.next.next.point ) == Orientation.CCW ) - { - // Concave - fillRightConcaveEdgeEvent( tcx, edge, node.next ); - } - else - { - // Convex - // Next above or below edge? - if( orient2d( edge.q, node.next.next.point, edge.p ) == Orientation.CCW ) - { - // Below - fillRightConvexEdgeEvent( tcx, edge, node.next ); - } - else - { - // Above - } - } - } - - private static void fillRightBelowEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) - { - if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( node ); } - if( node.point.getX() < edge.p.getX() ) // needed? - { - if( orient2d( node.point, node.next.point, node.next.next.point ) == Orientation.CCW ) - { - // Concave - fillRightConcaveEdgeEvent( tcx, edge, node ); - } - else - { - // Convex - fillRightConvexEdgeEvent( tcx, edge, node ); - // Retry this one - fillRightBelowEdgeEvent( tcx, edge, node ); - } - - } - } - - private static void fillRightAboveEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) - { - while( node.next.point.getX() < edge.p.getX() ) - { - if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( node ); } - // Check if next node is below the edge - Orientation o1 = orient2d( edge.q, node.next.point, edge.p ); - if( o1 == Orientation.CCW ) - { - fillRightBelowEdgeEvent( tcx, edge, node ); - } - else - { - node = node.next; - } - } - } - - private static void fillLeftConvexEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) - { - // Next concave or convex? - if( orient2d( node.prev.point, node.prev.prev.point, node.prev.prev.prev.point ) == Orientation.CW ) - { - // Concave - fillLeftConcaveEdgeEvent( tcx, edge, node.prev ); - } - else - { - // Convex - // Next above or below edge? - if( orient2d( edge.q, node.prev.prev.point, edge.p ) == Orientation.CW ) - { - // Below - fillLeftConvexEdgeEvent( tcx, edge, node.prev ); - } - else - { - // Above - } - } - } - - private static void fillLeftConcaveEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) - { - fill( tcx, node.prev ); - if( node.prev.point != edge.p ) - { - // Next above or below edge? - if( orient2d( edge.q, node.prev.point, edge.p ) == Orientation.CW ) - { - // Below - if( orient2d( node.point, node.prev.point, node.prev.prev.point ) == Orientation.CW ) - { - // Next is concave - fillLeftConcaveEdgeEvent( tcx, edge, node ); - } - else - { - // Next is convex - } - } - } - } - - private static void fillLeftBelowEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) - { - if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( node ); } - if( node.point.getX() > edge.p.getX() ) - { - if( orient2d( node.point, node.prev.point, node.prev.prev.point ) == Orientation.CW ) - { - // Concave - fillLeftConcaveEdgeEvent( tcx, edge, node ); - } - else - { - // Convex - fillLeftConvexEdgeEvent( tcx, edge, node ); - // Retry this one - fillLeftBelowEdgeEvent( tcx, edge, node ); - } - - } - } - - private static void fillLeftAboveEdgeEvent( DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node ) - { - while( node.prev.point.getX() > edge.p.getX() ) - { - if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setActiveNode( node ); } - // Check if next node is below the edge - Orientation o1 = orient2d( edge.q, node.prev.point, edge.p ); - if( o1 == Orientation.CW ) - { - fillLeftBelowEdgeEvent( tcx, edge, node ); - } - else - { - node = node.prev; - } - } - } - - private static boolean isEdgeSideOfTriangle( DelaunayTriangle triangle, - TriangulationPoint ep, - TriangulationPoint eq ) - { - int index; - index = triangle.edgeIndex( ep, eq ); - if( index != -1 ) - { - triangle.markConstrainedEdge( index ); - triangle = triangle.neighbors[ index ]; - if( triangle != null ) - { - triangle.markConstrainedEdge( ep, eq ); - } - return true; - } - return false; - } - - private static void edgeEvent( DTSweepContext tcx, - TriangulationPoint ep, - TriangulationPoint eq, - DelaunayTriangle triangle, - TriangulationPoint point ) - { - TriangulationPoint p1,p2; - - if( tcx.isDebugEnabled() ) { tcx.getDebugContext().setPrimaryTriangle( triangle ); } - - if( isEdgeSideOfTriangle( triangle, ep, eq ) ) - { - return; - } - - p1 = triangle.pointCCW( point ); - Orientation o1 = orient2d( eq, p1, ep ); - if( o1 == Orientation.Collinear ) - { - if( triangle.contains( eq, p1 ) ) - { - triangle.markConstrainedEdge( eq, p1 ); - // We are modifying the constraint maybe it would be better to - // not change the given constraint and just keep a variable for the new constraint - tcx.edgeEvent.constrainedEdge.q = p1; - triangle = triangle.neighborAcross( point ); - edgeEvent( tcx, ep, p1, triangle, p1 ); - } - else - { - throw new PointOnEdgeException( "EdgeEvent - Point on constrained edge not supported yet" ); - } - return; - } - - p2 = triangle.pointCW( point ); - Orientation o2 = orient2d( eq, p2, ep ); - if( o2 == Orientation.Collinear ) - { - if( triangle.contains( eq, p2 ) ) - { - triangle.markConstrainedEdge( eq, p2 ); - // We are modifying the constraint maybe it would be better to - // not change the given constraint and just keep a variable for the new constraint - tcx.edgeEvent.constrainedEdge.q = p2; - triangle = triangle.neighborAcross( point ); - edgeEvent( tcx, ep, p2, triangle, p2 ); - } - else - { - throw new PointOnEdgeException( "EdgeEvent - Point on constrained edge not supported yet" ); - } - return; - } - - if( o1 == o2 ) - { - // Need to decide if we are rotating CW or CCW to get to a triangle - // that will cross edge - if( o1 == Orientation.CW ) - { - triangle = triangle.neighborCCW( point ); - } - else - { - triangle = triangle.neighborCW( point ); - } - edgeEvent( tcx, ep, eq, triangle, point ); - } - else - { - // This triangle crosses constraint so lets flippin start! - flipEdgeEvent( tcx, ep, eq, triangle, point ); - } - } - - private static void flipEdgeEvent( DTSweepContext tcx, - TriangulationPoint ep, - TriangulationPoint eq, - DelaunayTriangle t, - TriangulationPoint p ) - { - TriangulationPoint op, newP; - DelaunayTriangle ot; - boolean inScanArea; - - ot = t.neighborAcross( p ); - op = ot.oppositePoint( t, p ); - - if( ot == null ) - { - // If we want to integrate the fillEdgeEvent do it here - // With current implementation we should never get here - throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle"); - } - - if( t.getConstrainedEdgeAcross(p) ) - { - throw new RuntimeException( "Intersecting Constraints" ); - } - - if( tcx.isDebugEnabled() ) - { - tcx.getDebugContext().setPrimaryTriangle( t ); - tcx.getDebugContext().setSecondaryTriangle( ot ); - } // TODO: remove - - inScanArea = inScanArea( p, - t.pointCCW( p ), - t.pointCW( p ), - op ); - if( inScanArea ) - { - // Lets rotate shared edge one vertex CW - rotateTrianglePair( t, p, ot, op ); - tcx.mapTriangleToNodes( t ); - tcx.mapTriangleToNodes( ot ); - - if( p == eq && op == ep ) - { - if( eq == tcx.edgeEvent.constrainedEdge.q - && ep == tcx.edgeEvent.constrainedEdge.p) - { - if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - constrained edge done" ); } // TODO: remove - t.markConstrainedEdge( ep, eq ); - ot.markConstrainedEdge( ep, eq ); - legalize( tcx, t ); - legalize( tcx, ot ); - } - else - { - if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - subedge done" ); } // TODO: remove - // XXX: I think one of the triangles should be legalized here? - } - } - else - { - if( tcx.isDebugEnabled() ) { System.out.println("[FLIP] - flipping and continuing with triangle still crossing edge" ); } // TODO: remove - Orientation o = orient2d( eq, op, ep ); - t = nextFlipTriangle( tcx, o, t, ot, p, op ); - flipEdgeEvent( tcx, ep, eq, t, p ); - } - } - else - { - newP = nextFlipPoint( ep, eq, ot, op ); - flipScanEdgeEvent( tcx, ep, eq, t, ot, newP ); - edgeEvent( tcx, ep, eq, t, p ); - } - } - - /** - * When we need to traverse from one triangle to the next we need - * the point in current triangle that is the opposite point to the next - * triangle. - * - * @param ep - * @param eq - * @param ot - * @param op - * @return - */ - private static TriangulationPoint nextFlipPoint( TriangulationPoint ep, - TriangulationPoint eq, - DelaunayTriangle ot, - TriangulationPoint op ) - { - Orientation o2d = orient2d( eq, op, ep ); - if( o2d == Orientation.CW ) - { - // Right - return ot.pointCCW( op ); - } - else if( o2d == Orientation.CCW ) - { - // Left - return ot.pointCW( op ); - } - else - { - // TODO: implement support for point on constraint edge - throw new PointOnEdgeException("Point on constrained edge not supported yet"); - } - } - - /** - * After a flip we have two triangles and know that only one will still be - * intersecting the edge. So decide which to contiune with and legalize the other - * - * @param tcx - * @param o - should be the result of an orient2d( eq, op, ep ) - * @param t - triangle 1 - * @param ot - triangle 2 - * @param p - a point shared by both triangles - * @param op - another point shared by both triangles - * @return returns the triangle still intersecting the edge - */ - private static DelaunayTriangle nextFlipTriangle( DTSweepContext tcx, - Orientation o, - DelaunayTriangle t, - DelaunayTriangle ot, - TriangulationPoint p, - TriangulationPoint op) - { - int edgeIndex; - if( o == Orientation.CCW ) - { - // ot is not crossing edge after flip - edgeIndex = ot.edgeIndex( p, op ); - ot.dEdge[edgeIndex] = true; - legalize( tcx, ot ); - ot.clearDelunayEdges(); - return t; - } - // t is not crossing edge after flip - edgeIndex = t.edgeIndex( p, op ); - t.dEdge[edgeIndex] = true; - legalize( tcx, t ); - t.clearDelunayEdges(); - return ot; - } - - /** - * Scan part of the FlipScan algorithm
- * When a triangle pair isn't flippable we will scan for the next - * point that is inside the flip triangle scan area. When found - * we generate a new flipEdgeEvent - * - * @param tcx - * @param ep - last point on the edge we are traversing - * @param eq - first point on the edge we are traversing - * @param flipTriangle - the current triangle sharing the point eq with edge - * @param t - * @param p - */ - private static void flipScanEdgeEvent( DTSweepContext tcx, - TriangulationPoint ep, - TriangulationPoint eq, - DelaunayTriangle flipTriangle, - DelaunayTriangle t, - TriangulationPoint p ) - { - DelaunayTriangle ot; - TriangulationPoint op,newP; - boolean inScanArea; - - ot = t.neighborAcross( p ); - op = ot.oppositePoint( t, p ); - - if( ot == null ) - { - // If we want to integrate the fillEdgeEvent do it here - // With current implementation we should never get here - throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle"); - } - - if( tcx.isDebugEnabled() ) - { - System.out.println("[FLIP:SCAN] - scan next point" ); // TODO: remove - tcx.getDebugContext().setPrimaryTriangle( t ); - tcx.getDebugContext().setSecondaryTriangle( ot ); - } - - inScanArea = inScanArea( eq, - flipTriangle.pointCCW( eq ), - flipTriangle.pointCW( eq ), - op ); - if( inScanArea ) - { - // flip with new edge op->eq - flipEdgeEvent( tcx, eq, op, ot, op ); - // TODO: Actually I just figured out that it should be possible to - // improve this by getting the next ot and op before the the above - // flip and continue the flipScanEdgeEvent here - // set new ot and op here and loop back to inScanArea test - // also need to set a new flipTriangle first - // Turns out at first glance that this is somewhat complicated - // so it will have to wait. - } - else - { - newP = nextFlipPoint( ep, eq, ot, op ); - flipScanEdgeEvent( tcx, ep, eq, flipTriangle, ot, newP ); - } - } - - /** - * Fills holes in the Advancing Front - * - * - * @param tcx - * @param n - */ - private static void fillAdvancingFront( DTSweepContext tcx, AdvancingFrontNode n ) - { - AdvancingFrontNode node; - double angle; - - // Fill right holes - node = n.next; - while( node.hasNext() ) - { - if( isLargeHole(node) ) - { - break; - } - fill( tcx, node ); - node = node.next; - } - - // Fill left holes - node = n.prev; - while( node.hasPrevious() ) - { - if( isLargeHole(node) ) - { - break; - } - fill( tcx, node ); - node = node.prev; - } - - // Fill right basins - if( n.hasNext() && n.next.hasNext() ) - { - angle = basinAngle( n ); - if( angle < PI_3div4 ) - { - fillBasin( tcx, n ); - } - } - } - - /** - * @param node - * @return true if hole angle exceeds 90 degrees - */ - private static boolean isLargeHole(AdvancingFrontNode node) - { - double angle = angle(node.point, node.next.point, node.prev.point); - //XXX: don't see angle being in range [-pi/2,0] due to how advancing front works -// return (angle > PI_div2) || (angle < -PI_div2); - return (angle > PI_div2) || (angle < 0); - - // ISSUE 48: http://code.google.com/p/poly2tri/issues/detail?id=48 - // TODO: Adding this fix suggested in issues 48 caused some - // triangulations to fail so commented it out for now. - // - // Also haven't been able to produce a triangulation that gives the - // problem described in issue 48. - -// AdvancingFrontNode nextNode = node.next; -// AdvancingFrontNode prevNode = node.prev; -// if( !AngleExceeds90Degrees(node.point, -// nextNode.point, -// prevNode.point)) -// { -// return false; -// } -// -// // Check additional points on front. -// AdvancingFrontNode next2Node = nextNode.next; -// // "..Plus.." because only want angles on same side as point being added. -// if( (next2Node != null) -// && !AngleExceedsPlus90DegreesOrIsNegative(node.point, -// next2Node.point, -// prevNode.point)) -// { -// return false; -// } -// -// AdvancingFrontNode prev2Node = prevNode.prev; -// // "..Plus.." because only want angles on same side as point being added. -// if( (prev2Node != null) -// && !AngleExceedsPlus90DegreesOrIsNegative(node.point, -// nextNode.point, -// prev2Node.point)) -// { -// return false; -// } -// return true; - } - -// private static boolean AngleExceeds90Degrees -// ( -// TriangulationPoint origin, -// TriangulationPoint pa, -// TriangulationPoint pb -// ) -// { -// double angle = angle(origin, pa, pb); -// return (angle > PI_div2) || (angle < -PI_div2); -// } -// -// -// private static boolean AngleExceedsPlus90DegreesOrIsNegative -// ( -// TriangulationPoint origin, -// TriangulationPoint pa, -// TriangulationPoint pb -// ) -// { -// double angle = angle(origin, pa, pb); -// return (angle > PI_div2) || (angle < 0); -// } - - /** - * Fills a basin that has formed on the Advancing Front to the right - * of given node.
- * First we decide a left,bottom and right node that forms the - * boundaries of the basin. Then we do a reqursive fill. - * - * @param tcx - * @param node - starting node, this or next node will be left node - */ - private static void fillBasin( DTSweepContext tcx, AdvancingFrontNode node ) - { - if( orient2d( node.point, node.next.point, node.next.next.point ) == Orientation.CCW ) - { - tcx.basin.leftNode = node; - } - else - { - tcx.basin.leftNode = node.next; - } - - // Find the bottom and right node - tcx.basin.bottomNode = tcx.basin.leftNode; - while( tcx.basin.bottomNode.hasNext() - && tcx.basin.bottomNode.point.getY() >= tcx.basin.bottomNode.next.point.getY() ) - { - tcx.basin.bottomNode = tcx.basin.bottomNode.next; - } - if( tcx.basin.bottomNode == tcx.basin.leftNode ) - { - // No valid basin - return; - } - - tcx.basin.rightNode = tcx.basin.bottomNode; - while( tcx.basin.rightNode.hasNext() - && tcx.basin.rightNode.point.getY() < tcx.basin.rightNode.next.point.getY() ) - { - tcx.basin.rightNode = tcx.basin.rightNode.next; - } - if( tcx.basin.rightNode == tcx.basin.bottomNode ) - { - // No valid basins - return; - } - - tcx.basin.width = tcx.basin.rightNode.getPoint().getX() - tcx.basin.leftNode.getPoint().getX(); - tcx.basin.leftHighest = tcx.basin.leftNode.getPoint().getY() > tcx.basin.rightNode.getPoint().getY(); - - fillBasinReq( tcx, tcx.basin.bottomNode ); - } - - /** - * Recursive algorithm to fill a Basin with triangles - * - * @param tcx - * @param node - bottomNode - * @param cnt - counter used to alternate on even and odd numbers - */ - private static void fillBasinReq( DTSweepContext tcx, AdvancingFrontNode node ) - { - // if shallow stop filling - if( isShallow( tcx, node) ) - { - return; - } - - fill( tcx, node ); - if( node.prev == tcx.basin.leftNode && node.next == tcx.basin.rightNode ) - { - return; - } - else if( node.prev == tcx.basin.leftNode ) - { - Orientation o = orient2d( node.point, node.next.point, node.next.next.point ); - if( o == Orientation.CW ) - { - return; - } - node = node.next; - } - else if( node.next == tcx.basin.rightNode ) - { - Orientation o = orient2d( node.point, node.prev.point, node.prev.prev.point ); - if( o == Orientation.CCW ) - { - return; - } - node = node.prev; - } - else - { - // Continue with the neighbor node with lowest Y value - if( node.prev.point.getY() < node.next.point.getY() ) - { - node = node.prev; - } - else - { - node = node.next; - } - } - fillBasinReq( tcx, node ); - } - - private static boolean isShallow( DTSweepContext tcx, AdvancingFrontNode node ) - { - double height; - - if( tcx.basin.leftHighest ) - { - height = tcx.basin.leftNode.getPoint().getY() - node.getPoint().getY(); - } - else - { - height = tcx.basin.rightNode.getPoint().getY() - node.getPoint().getY(); - } - if( tcx.basin.width > height ) - { - return true; - } - return false; - } - - /** - * - * @param node - middle node - * @return the angle between p-a and p-b in range [-pi,pi] - */ - private static double angle( TriangulationPoint p, - TriangulationPoint a, - TriangulationPoint b ) - { - // XXX: do we really need a signed angle for holeAngle? - // could possible save some cycles here - /* Complex plane - * ab = cosA +i*sinA - * ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx) - * atan2(y,x) computes the principal value of the argument function - * applied to the complex number x+iy - * Where x = ax*bx + ay*by - * y = ax*by - ay*bx - */ - final double px = p.getX(); - final double py = p.getY(); - final double ax = a.getX() - px; - final double ay = a.getY() - py; - final double bx = b.getX() - px; - final double by = b.getY() - py; - return Math.atan2( ax*by - ay*bx, ax*bx + ay*by ); - } - - /** - * The basin angle is decided against the horizontal line [1,0] - */ - private static double basinAngle( AdvancingFrontNode node ) - { - double ax = node.point.getX() - node.next.next.point.getX(); - double ay = node.point.getY() - node.next.next.point.getY(); - return Math.atan2( ay, ax ); - } - - /** - * Adds a triangle to the advancing front to fill a hole. - * @param tcx - * @param node - middle node, that is the bottom of the hole - */ - private static void fill( DTSweepContext tcx, AdvancingFrontNode node ) - { - DelaunayTriangle triangle = new DelaunayTriangle( node.prev.point, - node.point, - node.next.point ); - // TODO: should copy the cEdge value from neighbor triangles - // for now cEdge values are copied during the legalize - triangle.markNeighbor( node.prev.triangle ); - triangle.markNeighbor( node.triangle ); - tcx.addToList( triangle ); - - // Update the advancing front - node.prev.next = node.next; - node.next.prev = node.prev; - tcx.removeNode( node ); - - // If it was legalized the triangle has already been mapped - if( !legalize( tcx, triangle ) ) - { - tcx.mapTriangleToNodes( triangle ); - } - } - - /** - * Returns true if triangle was legalized - */ - private static boolean legalize( DTSweepContext tcx, - DelaunayTriangle t ) - { - int oi; - boolean inside; - TriangulationPoint p,op; - DelaunayTriangle ot; - // To legalize a triangle we start by finding if any of the three edges - // violate the Delaunay condition - for( int i=0; i<3; i++ ) - { - // TODO: fix so that cEdge is always valid when creating new triangles then we can check it here - // instead of below with ot - if( t.dEdge[i] ) - { - continue; - } - ot = t.neighbors[i]; - if( ot != null ) - { - p = t.points[i]; - op = ot.oppositePoint( t, p ); - oi = ot.index( op ); - // If this is a Constrained Edge or a Delaunay Edge(only during recursive legalization) - // then we should not try to legalize - if( ot.cEdge[oi] || ot.dEdge[oi] ) - { - t.cEdge[i] = ot.cEdge[oi]; // XXX: have no good way of setting this property when creating new triangles so lets set it here - continue; - } - inside = smartIncircle( p, - t.pointCCW( p ), - t.pointCW( p ), - op ); - if( inside ) - { - boolean notLegalized; - - // Lets mark this shared edge as Delaunay - t.dEdge[i] = true; - ot.dEdge[oi] = true; - - // Lets rotate shared edge one vertex CW to legalize it - rotateTrianglePair( t, p, ot, op ); - - // We now got one valid Delaunay Edge shared by two triangles - // This gives us 4 new edges to check for Delaunay - - // Make sure that triangle to node mapping is done only one time for a specific triangle - notLegalized = !legalize( tcx, t ); - if( notLegalized ) - { - tcx.mapTriangleToNodes( t ); - } - notLegalized = !legalize( tcx, ot ); - if( notLegalized ) - { - tcx.mapTriangleToNodes( ot ); - } - - // Reset the Delaunay edges, since they only are valid Delaunay edges - // until we add a new triangle or point. - // XXX: need to think about this. Can these edges be tried after we - // return to previous recursive level? - t.dEdge[i] = false; - ot.dEdge[oi] = false; - - // If triangle have been legalized no need to check the other edges since - // the recursive legalization will handles those so we can end here. - return true; - } - } - } - return false; - } - - /** - * Rotates a triangle pair one vertex CW - *
-     *       n2                    n2
-     *  P +-----+             P +-----+
-     *    | t  /|               |\  t |  
-     *    |   / |               | \   |
-     *  n1|  /  |n3           n1|  \  |n3
-     *    | /   |    after CW   |   \ |
-     *    |/ oT |               | oT \|
-     *    +-----+ oP            +-----+
-     *       n4                    n4
-     * 
- */ - private static void rotateTrianglePair( DelaunayTriangle t, - TriangulationPoint p, - DelaunayTriangle ot, - TriangulationPoint op ) - { - DelaunayTriangle n1,n2,n3,n4; - n1 = t.neighborCCW( p ); - n2 = t.neighborCW( p ); - n3 = ot.neighborCCW( op ); - n4 = ot.neighborCW( op ); - - boolean ce1,ce2,ce3,ce4; - ce1 = t.getConstrainedEdgeCCW(p); - ce2 = t.getConstrainedEdgeCW(p); - ce3 = ot.getConstrainedEdgeCCW(op); - ce4 = ot.getConstrainedEdgeCW(op); - - boolean de1,de2,de3,de4; - de1 = t.getDelunayEdgeCCW(p); - de2 = t.getDelunayEdgeCW(p); - de3 = ot.getDelunayEdgeCCW(op); - de4 = ot.getDelunayEdgeCW(op); - - t.legalize( p, op ); - ot.legalize( op, p ); - - // Remap dEdge - ot.setDelunayEdgeCCW( p, de1 ); - t.setDelunayEdgeCW( p, de2 ); - t.setDelunayEdgeCCW( op, de3 ); - ot.setDelunayEdgeCW( op, de4 ); - - // Remap cEdge - ot.setConstrainedEdgeCCW( p, ce1 ); - t.setConstrainedEdgeCW( p, ce2 ); - t.setConstrainedEdgeCCW( op, ce3 ); - ot.setConstrainedEdgeCW( op, ce4 ); - - // Remap neighbors - // XXX: might optimize the markNeighbor by keeping track of - // what side should be assigned to what neighbor after the - // rotation. Now mark neighbor does lots of testing to find - // the right side. - t.clearNeighbors(); - ot.clearNeighbors(); - if( n1 != null ) ot.markNeighbor( n1 ); - if( n2 != null ) t.markNeighbor( n2 ); - if( n3 != null ) t.markNeighbor( n3 ); - if( n4 != null ) ot.markNeighbor( n4 ); - t.markNeighbor( ot ); - } -} diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepConstraint.java b/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepConstraint.java deleted file mode 100644 index 636cbd9..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepConstraint.java +++ /dev/null @@ -1,103 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.delaunay.sweep; - -import java.util.logging.Logger; -import org.poly2tri.triangulation.TriangulationConstraint; -import org.poly2tri.triangulation.TriangulationPoint; - -/** - * - * @author Thomas Åhlén, thahlen@gmail.com - * - */ -public class DTSweepConstraint extends TriangulationConstraint -{ - - public TriangulationPoint p; - public TriangulationPoint q; - - /** - * Give two points in any order. Will always be ordered so - * that q.y > p.y and q.x > p.x if same y value - * - * @param p1 - * @param p2 - */ - public DTSweepConstraint( TriangulationPoint p1, TriangulationPoint p2 ) -// throws DuplicatePointException - { - p = p1; - q = p2; - if( p1.getY() > p2.getY() ) - { - q = p1; - p = p2; - } - else if( p1.getY() == p2.getY() ) - { - if( p1.getX() > p2.getX() ) - { - q = p1; - p = p2; - } - else if( p1.getX() == p2.getX() ) - { -// throw new DuplicatePointException( p1 + "=" + p2 ); -// return; - } - } - q.addEdge(this); - } - -// public TPoint intersect( TPoint a, TPoint b ) -// { -// double pqx,pqy,bax,bay,t; -// -// pqx = p.getX()-q.getX(); -// pqy = p.getY()-q.getY(); -// t = pqy*(a.getX()-q.getX()) - pqx*(a.getY()-q.getY() ); -// t /= pqx*(b.getY()-a.getY()) - pqy*(b.getX()-a.getX()); -// bax = t*(b.getX()-a.getX()) + a.getX(); -// bay = t*(b.getY()-a.getY()) + a.getY(); -// return new TPoint( bax, bay ); -// } - - public TriangulationPoint getP() - { - return p; - } - - public TriangulationPoint getQ() - { - return q; - } -} diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepContext.java b/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepContext.java deleted file mode 100644 index 4605479..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepContext.java +++ /dev/null @@ -1,280 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.delaunay.sweep; - -import java.util.ArrayDeque; -import java.util.Collections; -import org.poly2tri.triangulation.Triangulatable; -import org.poly2tri.triangulation.TriangulationAlgorithm; -import org.poly2tri.triangulation.TriangulationConstraint; -import org.poly2tri.triangulation.TriangulationContext; -import org.poly2tri.triangulation.TriangulationPoint; -import org.poly2tri.triangulation.delaunay.DelaunayTriangle; -import org.poly2tri.triangulation.point.TPoint; - -/** - * - * @author Thomas Åhlén, thahlen@gmail.com - * - */ -public class DTSweepContext extends TriangulationContext -{ - - // Inital triangle factor, seed triangle will extend 30% of - // PointSet width to both left and right. - private final float ALPHA = 0.3f; - - /** Advancing front **/ - protected AdvancingFront aFront; - /** head point used with advancing front */ - private TriangulationPoint _head; - /** tail point used with advancing front */ - private TriangulationPoint _tail; - protected Basin basin = new Basin(); - protected EdgeEvent edgeEvent = new EdgeEvent(); - - private DTSweepPointComparator _comparator = new DTSweepPointComparator(); - - public DTSweepContext() - { - clear(); - } - - public void isDebugEnabled( boolean b ) - { - if( b ) - { - if( _debug == null ) - { - _debug = new DTSweepDebugContext(this); - } - } - _debugEnabled = b; - } - - public void removeFromList( DelaunayTriangle triangle ) - { - _triList.remove( triangle ); - // TODO: remove all neighbor pointers to this triangle -// for( int i=0; i<3; i++ ) -// { -// if( triangle.neighbors[i] != null ) -// { -// triangle.neighbors[i].clearNeighbor( triangle ); -// } -// } -// triangle.clearNeighbors(); - } - - protected void meshClean(DelaunayTriangle triangle) - { - DelaunayTriangle t1,t2; - if( triangle != null ) - { - ArrayDeque deque = new ArrayDeque(); - deque.addFirst(triangle); - triangle.isInterior(true); - - while( !deque.isEmpty() ) - { - t1 = deque.removeFirst(); - _triUnit.addTriangle( t1 ); - for( int i=0; i<3; ++i ) - { - if( !t1.cEdge[i] ) - { - t2 = t1.neighbors[i]; - if( t2 != null && !t2.isInterior() ) - { - t2.isInterior(true); - deque.addLast(t2); - } - } - } - } - } - } - - public void clear() - { - super.clear(); - _triList.clear(); - } - - public AdvancingFront getAdvancingFront() - { - return aFront; - } - - public void setHead( TriangulationPoint p1 ) { _head = p1; } - public TriangulationPoint getHead() { return _head; } - - public void setTail( TriangulationPoint p1 ) { _tail = p1; } - public TriangulationPoint getTail() { return _tail; } - - public void addNode( AdvancingFrontNode node ) - { -// System.out.println( "add:" + node.key + ":" + System.identityHashCode(node.key)); -// m_nodeTree.put( node.getKey(), node ); - aFront.addNode( node ); - } - - public void removeNode( AdvancingFrontNode node ) - { -// System.out.println( "remove:" + node.key + ":" + System.identityHashCode(node.key)); -// m_nodeTree.delete( node.getKey() ); - aFront.removeNode( node ); - } - - public AdvancingFrontNode locateNode( TriangulationPoint point ) - { - return aFront.locateNode( point ); - } - - public void createAdvancingFront() - { - AdvancingFrontNode head,tail,middle; - // Initial triangle - DelaunayTriangle iTriangle = new DelaunayTriangle( _points.get(0), - getTail(), - getHead() ); - addToList( iTriangle ); - - head = new AdvancingFrontNode( iTriangle.points[1] ); - head.triangle = iTriangle; - middle = new AdvancingFrontNode( iTriangle.points[0] ); - middle.triangle = iTriangle; - tail = new AdvancingFrontNode( iTriangle.points[2] ); - - aFront = new AdvancingFront( head, tail ); - aFront.addNode( middle ); - - // TODO: I think it would be more intuitive if head is middles next and not previous - // so swap head and tail - aFront.head.next = middle; - middle.next = aFront.tail; - middle.prev = aFront.head; - aFront.tail.prev = middle; - } - - class Basin - { - AdvancingFrontNode leftNode; - AdvancingFrontNode bottomNode; - AdvancingFrontNode rightNode; - public double width; - public boolean leftHighest; - } - - class EdgeEvent - { - DTSweepConstraint constrainedEdge; - public boolean right; - } - - /** - * Try to map a node to all sides of this triangle that don't have - * a neighbor. - * - * @param t - */ - public void mapTriangleToNodes( DelaunayTriangle t ) - { - AdvancingFrontNode n; - for( int i=0; i<3; i++ ) - { - if( t.neighbors[i] == null ) - { - n = aFront.locatePoint( t.pointCW( t.points[i] ) ); - if( n != null ) - { - n.triangle = t; - } - } - } - } - - @Override - public void prepareTriangulation( Triangulatable t ) - { - super.prepareTriangulation( t ); - - double xmax, xmin; - double ymax, ymin; - - xmax = xmin = _points.get(0).getX(); - ymax = ymin = _points.get(0).getY(); - // Calculate bounds. Should be combined with the sorting - for( TriangulationPoint p : _points ) - { - if( p.getX() > xmax ) - xmax = p.getX(); - if( p.getX() < xmin ) - xmin = p.getX(); - if( p.getY() > ymax ) - ymax = p.getY(); - if( p.getY() < ymin ) - ymin = p.getY(); - } - - double deltaX = ALPHA * ( xmax - xmin ); - double deltaY = ALPHA * ( ymax - ymin ); - TPoint p1 = new TPoint( xmax + deltaX, ymin - deltaY ); - TPoint p2 = new TPoint( xmin - deltaX, ymin - deltaY ); - - setHead( p1 ); - setTail( p2 ); - -// long time = System.nanoTime(); - // Sort the points along y-axis - Collections.sort( _points, _comparator ); -// logger.info( "Triangulation setup [{}ms]", ( System.nanoTime() - time ) / 1e6 ); - } - - - public void finalizeTriangulation() - { - _triUnit.addTriangles( _triList ); - _triList.clear(); - } - - @Override - public TriangulationConstraint newConstraint( TriangulationPoint a, TriangulationPoint b ) - { - return new DTSweepConstraint( a, b ); - } - - @Override - public TriangulationAlgorithm algorithm() - { - return TriangulationAlgorithm.DTSweep; - } -} diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepDebugContext.java b/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepDebugContext.java deleted file mode 100644 index 103815f..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepDebugContext.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.poly2tri.triangulation.delaunay.sweep; - -import org.poly2tri.triangulation.TriangulationContext; -import org.poly2tri.triangulation.TriangulationDebugContext; -import org.poly2tri.triangulation.TriangulationPoint; -import org.poly2tri.triangulation.delaunay.DelaunayTriangle; - -public class DTSweepDebugContext extends TriangulationDebugContext -{ - /* - * Fields used for visual representation of current triangulation - */ - protected DelaunayTriangle _primaryTriangle; - protected DelaunayTriangle _secondaryTriangle; - protected TriangulationPoint _activePoint; - protected AdvancingFrontNode _activeNode; - protected DTSweepConstraint _activeConstraint; - - public DTSweepDebugContext( DTSweepContext tcx ) - { - super( tcx ); - } - - public boolean isDebugContext() - { - return true; - } - - // private Tuple2 m_circumCircle = new Tuple2( new TPoint(), new Double(0) ); -// public Tuple2 getCircumCircle() { return m_circumCircle; } - public DelaunayTriangle getPrimaryTriangle() - { - return _primaryTriangle; - } - - public DelaunayTriangle getSecondaryTriangle() - { - return _secondaryTriangle; - } - - public AdvancingFrontNode getActiveNode() - { - return _activeNode; - } - - public DTSweepConstraint getActiveConstraint() - { - return _activeConstraint; - } - - public TriangulationPoint getActivePoint() - { - return _activePoint; - } - - public void setPrimaryTriangle( DelaunayTriangle triangle ) - { - _primaryTriangle = triangle; - _tcx.update("setPrimaryTriangle"); - } - - public void setSecondaryTriangle( DelaunayTriangle triangle ) - { - _secondaryTriangle = triangle; - _tcx.update("setSecondaryTriangle"); - } - - public void setActivePoint( TriangulationPoint point ) - { - _activePoint = point; - } - - public void setActiveConstraint( DTSweepConstraint e ) - { - _activeConstraint = e; - _tcx.update("setWorkingSegment"); - } - - public void setActiveNode( AdvancingFrontNode node ) - { - _activeNode = node; - _tcx.update("setWorkingNode"); - } - - @Override - public void clear() - { - _primaryTriangle = null; - _secondaryTriangle = null; - _activePoint = null; - _activeNode = null; - _activeConstraint = null; - } - -// public void setWorkingCircumCircle( TPoint point, TPoint point2, TPoint point3 ) -// { -// double dx,dy; -// -// CircleXY.circumCenter( point, point2, point3, m_circumCircle.a ); -// dx = m_circumCircle.a.getX()-point.getX(); -// dy = m_circumCircle.a.getY()-point.getY(); -// m_circumCircle.b = Double.valueOf( Math.sqrt( dx*dx + dy*dy ) ); -// -// } -} diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepPointComparator.java b/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepPointComparator.java deleted file mode 100644 index 65e1754..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/DTSweepPointComparator.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.poly2tri.triangulation.delaunay.sweep; - -import java.util.Comparator; - -import org.poly2tri.triangulation.TriangulationPoint; - -public class DTSweepPointComparator implements Comparator -{ - public int compare( TriangulationPoint p1, TriangulationPoint p2 ) - { - if(p1.getY() < p2.getY() ) - { - return -1; - } - else if( p1.getY() > p2.getY()) - { - return 1; - } - else - { - if(p1.getX() < p2.getX()) - { - return -1; - } - else if( p1.getX() > p2.getX() ) - { - return 1; - } - else - { - return 0; - } - } - } -} diff --git a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/PointOnEdgeException.java b/src/main/java/org/poly2tri/triangulation/delaunay/sweep/PointOnEdgeException.java deleted file mode 100644 index dfc4467..0000000 --- a/src/main/java/org/poly2tri/triangulation/delaunay/sweep/PointOnEdgeException.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.poly2tri.triangulation.delaunay.sweep; - -public class PointOnEdgeException extends RuntimeException -{ - - /** - * - */ - private static final long serialVersionUID = 1L; - - public PointOnEdgeException( String msg ) - { - super(msg); - } -} diff --git a/src/main/java/org/poly2tri/triangulation/point/FloatBufferPoint.java b/src/main/java/org/poly2tri/triangulation/point/FloatBufferPoint.java deleted file mode 100644 index ad815fc..0000000 --- a/src/main/java/org/poly2tri/triangulation/point/FloatBufferPoint.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.point; - -import java.nio.FloatBuffer; - -import org.poly2tri.triangulation.TriangulationPoint; - - -public class FloatBufferPoint extends TriangulationPoint -{ - private final FloatBuffer _fb; - private final int _ix,_iy,_iz; - - public FloatBufferPoint( FloatBuffer fb, int index ) - { - _fb = fb; - _ix = index; - _iy = index+1; - _iz = index+2; - } - - public final double getX() - { - return _fb.get( _ix ); - } - public final double getY() - { - return _fb.get( _iy ); - } - public final double getZ() - { - return _fb.get( _iz ); - } - - public final float getXf() - { - return _fb.get( _ix ); - } - public final float getYf() - { - return _fb.get( _iy ); - } - public final float getZf() - { - return _fb.get( _iz ); - } - - @Override - public void set( double x, double y, double z ) - { - _fb.put( _ix, (float)x ); - _fb.put( _iy, (float)y ); - _fb.put( _iz, (float)z ); - } - - public static TriangulationPoint[] toPoints( FloatBuffer fb ) - { - FloatBufferPoint[] points = new FloatBufferPoint[fb.limit()/3]; - for( int i=0,j=0; i - * A constraint defines an edge between two points in the set, these edges can not - * be crossed. They will be enforced triangle edges after a triangulation. - *

- * - * - * @author Thomas Åhlén, thahlen@gmail.com - */ -public class ConstrainedPointSet extends PointSet -{ - int[] _index; - List _constrainedPointList = null; - - public ConstrainedPointSet( List points, int[] index ) - { - super( points ); - _index = index; - } - - /** - * - * @param points - A list of all points in PointSet - * @param constraints - Pairs of two points defining a constraint, all points must be part of given PointSet! - */ - public ConstrainedPointSet( List points, List constraints ) - { - super( points ); - _constrainedPointList = new ArrayList(); - _constrainedPointList.addAll(constraints); - } - - @Override - public TriangulationMode getTriangulationMode() - { - return TriangulationMode.CONSTRAINED; - } - - public int[] getEdgeIndex() - { - return _index; - } - - @SuppressWarnings("unchecked") - @Override - public void prepareTriangulation( TriangulationContext tcx ) - { - super.prepareTriangulation( tcx ); - if( _constrainedPointList != null ) - { - TriangulationPoint p1,p2; - Iterator iterator = _constrainedPointList.iterator(); - while(iterator.hasNext()) - { - p1 = (TriangulationPoint)iterator.next(); - p2 = (TriangulationPoint)iterator.next(); - tcx.newConstraint(p1,p2); - } - } - else - { - for( int i = 0; i < _index.length; i+=2 ) - { - // XXX: must change!! - tcx.newConstraint( _points.get( _index[i] ), _points.get( _index[i+1] ) ); - } - } - } - - /** - * TODO: TO BE IMPLEMENTED! - * Peforms a validation on given input
- * 1. Check's if there any constraint edges are crossing or collinear
- * 2. - * @return - */ - public boolean isValid() - { - return true; - } -} diff --git a/src/main/java/org/poly2tri/triangulation/sets/PointSet.java b/src/main/java/org/poly2tri/triangulation/sets/PointSet.java deleted file mode 100644 index d4ff5b6..0000000 --- a/src/main/java/org/poly2tri/triangulation/sets/PointSet.java +++ /dev/null @@ -1,95 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.sets; - -import java.util.ArrayList; -import java.util.List; - -import org.poly2tri.triangulation.Triangulatable; -import org.poly2tri.triangulation.TriangulationContext; -import org.poly2tri.triangulation.TriangulationMode; -import org.poly2tri.triangulation.TriangulationPoint; -import org.poly2tri.triangulation.delaunay.DelaunayTriangle; - -public class PointSet implements Triangulatable -{ - List _points; - List _triangles; - - public PointSet( List points ) - { - _points = new ArrayList(); - _points.addAll( points ); - } - - public TriangulationMode getTriangulationMode() - { - return TriangulationMode.UNCONSTRAINED; - } - - public List getPoints() - { - return _points; - } - - public List getTriangles() - { - return _triangles; - } - - public void addTriangle( DelaunayTriangle t ) - { - _triangles.add( t ); - } - - public void addTriangles( List list ) - { - _triangles.addAll( list ); - } - - public void clearTriangulation() - { - _triangles.clear(); - } - - public void prepareTriangulation( TriangulationContext tcx ) - { - if( _triangles == null ) - { - _triangles = new ArrayList( _points.size() ); - } - else - { - _triangles.clear(); - } - tcx.addPoints( _points ); - } -} diff --git a/src/main/java/org/poly2tri/triangulation/util/PointGenerator.java b/src/main/java/org/poly2tri/triangulation/util/PointGenerator.java deleted file mode 100644 index baf2c17..0000000 --- a/src/main/java/org/poly2tri/triangulation/util/PointGenerator.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.poly2tri.triangulation.util; - -import java.util.ArrayList; -import java.util.List; - -import org.poly2tri.triangulation.TriangulationPoint; -import org.poly2tri.triangulation.point.TPoint; - -public class PointGenerator -{ - public static List uniformDistribution( int n, double scale ) - { - ArrayList points = new ArrayList(); - for( int i=0; i uniformGrid( int n, double scale ) - { - double x=0; - double size = scale/n; - double halfScale = 0.5*scale; - - ArrayList points = new ArrayList(); - for( int i=0; i scale/2 ? scale/2 : radius; - radius = radius < scale/10 ? scale/10 : radius; - } while( radius < scale/10 || radius > scale/2 ); - point = new PolygonPoint( radius*Math.cos( (PI_2*i)/vertexCount ), - radius*Math.sin( (PI_2*i)/vertexCount ) ); - points[i] = point; - } - return new Polygon( points ); - } - - public static Polygon RandomCircleSweep2( double scale, int vertexCount ) - { - PolygonPoint point; - PolygonPoint[] points; - double radius = scale/4; - - points = new PolygonPoint[vertexCount]; - for(int i=0; i scale/2 ? scale/2 : radius; - radius = radius < scale/10 ? scale/10 : radius; - } while( radius < scale/10 || radius > scale/2 ); - point = new PolygonPoint( radius*Math.cos( (PI_2*i)/vertexCount ), - radius*Math.sin( (PI_2*i)/vertexCount ) ); - points[i] = point; - } - return new Polygon( points ); - } -} diff --git a/src/main/java/org/poly2tri/triangulation/util/QuadTreeRefinement.java b/src/main/java/org/poly2tri/triangulation/util/QuadTreeRefinement.java deleted file mode 100644 index f3ab2ed..0000000 --- a/src/main/java/org/poly2tri/triangulation/util/QuadTreeRefinement.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.poly2tri.triangulation.util; - -import org.poly2tri.geometry.polygon.Polygon; - -/** - * Use a QuadTree traversal to add steiner points - * inside the polygon that needs refinement - * - * @author thahlen@gmail.com - */ -public class QuadTreeRefinement -{ - public static final void refine( Polygon p, int depth ) - { - - } -} diff --git a/src/main/java/org/poly2tri/triangulation/util/Tuple2.java b/src/main/java/org/poly2tri/triangulation/util/Tuple2.java deleted file mode 100644 index 4c5fa7d..0000000 --- a/src/main/java/org/poly2tri/triangulation/util/Tuple2.java +++ /dev/null @@ -1,43 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.util; - -public class Tuple2 -{ - public A a; - public B b; - - public Tuple2(A a,B b) - { - this.a = a; - this.b = b; - } -} diff --git a/src/main/java/org/poly2tri/triangulation/util/Tuple3.java b/src/main/java/org/poly2tri/triangulation/util/Tuple3.java deleted file mode 100644 index b81d8a5..0000000 --- a/src/main/java/org/poly2tri/triangulation/util/Tuple3.java +++ /dev/null @@ -1,45 +0,0 @@ -/* Poly2Tri - * Copyright (c) 2009-2010, Poly2Tri Contributors - * http://code.google.com/p/poly2tri/ - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of Poly2Tri nor the names of its contributors may be - * used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.poly2tri.triangulation.util; - -public class Tuple3 -{ - public A a; - public B b; - public C c; - - public Tuple3(A a,B b,C c) - { - this.a = a; - this.b = b; - this.c = c; - } -} diff --git a/src/main/resources/META-INF/DimDoors_at.cfg b/src/main/resources/META-INF/DimDoors_at.cfg new file mode 100644 index 0000000..6a6d483 --- /dev/null +++ b/src/main/resources/META-INF/DimDoors_at.cfg @@ -0,0 +1 @@ +public net.minecraft.block.Block field_149781_w # Block resistance diff --git a/src/main/resources/assets/dimdoors/lang/de_DE.lang b/src/main/resources/assets/dimdoors/lang/de_DE.lang new file mode 100644 index 0000000..6200c55 --- /dev/null +++ b/src/main/resources/assets/dimdoors/lang/de_DE.lang @@ -0,0 +1,59 @@ +itemGroup.dimDoorsCreativeTab=Dimensional Doors: Items +tile.doorGold.name=Goldtür +tile.transientDoor.name=Vergängliche Tür +tile.dimDoorGold.name=Goldene Dimensionaltür +tile.doorQuartz.name=Quarztür +tile.dimDoorPersonal.name=Persönliche Dimensionaltür +tile.blockDimWall.name=Stoff der Realität +tile.blockAlteredWall.name=Veränderter Stoff +tile.blockAncientWall.name=Antiker Stoff +tile.blockDimWallPerm.name=Ewiger Stoff +tile.dimDoorWarp.name=Warp-Tür +tile.rift.name=Spalt +tile.BlockLimbo.name=Entwirrter Stoff +tile.chaosDoor.name=Instabile Tür +tile.dimDoor.name=Dimensionaltür +tile.dimHatch.name=Transdimensionale Falltür +item.itemGoldDoor.name=Goldtür +item.itemDDKey=Spaltschlüssel +item.itemQuartzDoor.name=Quarztür +item.itemQuartzDimDoor.name=Persönliche Dimensionaltür +item.itemGoldDimDoor.name=Goldene Dimensionaltür +item.itemDimDoor.name=Dimensionaltür +item.itemDimDoorWarp.name=Warp-Tür +item.itemLinkSignature.name=Spaltsignatur +item.itemStabilizedRiftSig.name=Stabilisierte Spaltsignatur +item.itemRiftRemover.name=Spaltentferner +item.itemStableFabric.name=Stabiler Stoff +item.itemChaosDoor.name=Instabile Tür +item.ItemRiftBlade.name=Spaltklinge +item.itemWorldThread.name=Weltenfaden +info.riftkey.bound=Gebunden +info.riftkey.unbound=Nicht gebunden +info.dimDoor0=Platziere auf dem Block unterhalb eines Spalts, +info.dimDoor1=um diesen Spalt zu aktivieren, oder +info.dimDoor2=irgendwo anders, um eine +info.dimDoor3=kleine Dimension to erschaffen. +info.goldDimDoor0=Ähnlich einer Dimensionaltür, +info.goldDimDoor1=aber hält die kleine Dimension geladen, +info.goldDimDoor2=sollte sie in einer solchen platziert sein. +info.personalDimDoor0=Erstellt einen Pfad zu +info.personalDimDoor1=deiner persönlichen Dimension +info.riftblade0=Öffnet temporäre Türen auf Spalten +info.riftblade1=und hat einen Teleport-Angriff. +info.riftRemover0=Verwende nahe eines offenen Spalts, +info.riftRemover1=um ihn und jegliche Spalte +info.riftRemover2=in der Nähe zu entfernen. +info.riftSignature.bound=Führt zu(%d, %d, %d) in Dimension #%d +info.riftSignature.unbound0=Erster Klick speichert die Position; +info.riftSignature.unbound1=zweiter Klick kreiert ein Paar von Spalten, +info.riftSignature.unbound2=welche zu den zwei Positionen führen. +info.riftSignature.stable0=Erster Klick speichert die Position, +info.riftSignature.stable1=weitere Klicks kreieren Spalte, die +info.riftSignature.stable2=die erste und die aktuelle Position verbinden. +info.chaosDoor=Vorsicht: Führt zu einem zufälligen Ziel +info.warpDoor0=Platziere auf dem Block unterhalb eines +info.warpDoor1=Spalts, um ein Portal zu erstellen, +info.warpDoor2=oder platziere irgendwo in einer +info.warpDoor3=kleinen Dimension, um sie zu verlassen. +entity.dimdoors.Monolith.name=Monolith diff --git a/src/main/resources/assets/dimdoors/lang/en_US.lang b/src/main/resources/assets/dimdoors/lang/en_US.lang new file mode 100644 index 0000000..5cfb372 --- /dev/null +++ b/src/main/resources/assets/dimdoors/lang/en_US.lang @@ -0,0 +1,59 @@ +itemGroup.dimDoorsCreativeTab=Dimensional Doors Items +tile.doorGold.name=Golden Door +tile.transientDoor.name=Transient Door +tile.dimDoorGold.name=Golden Dimensional Door +tile.doorQuartz.name=Quartz Door +tile.dimDoorPersonal.name=Personal Dimensional Door +tile.blockDimWall.name=Fabric of Reality +tile.blockAlteredWall.name=Altered Fabric +tile.blockAncientWall.name=Ancient Fabric +tile.blockDimWallPerm.name=Eternal Fabric +tile.dimDoorWarp.name=Warp Door +tile.rift.name=Rift +tile.BlockLimbo.name=Unraveled Fabric +tile.chaosDoor.name=Unstable Door +tile.dimDoor.name=Dimensional Door +tile.dimHatch.name=Transdimensional Trapdoor +item.itemGoldDoor.name=Golden Door +item.itemDDKey=Rift Key +item.itemQuartzDoor.name=Quartz Door +item.itemQuartzDimDoor.name=Personal Dimensional Door +item.itemGoldDimDoor.name=Golden Dimensional Door +item.itemDimDoor.name=Dimensional Door +item.itemDimDoorWarp.name=Warp Door +item.itemLinkSignature.name=Rift Signature +item.itemStabilizedRiftSig.name=Stabilized Rift Signature +item.itemRiftRemover.name=Rift Remover +item.itemStableFabric.name=Stable Fabric +item.itemChaosDoor.name=Unstable Door +item.ItemRiftBlade.name=Rift Blade +item.itemWorldThread.name=World Thread +info.riftkey.bound=Bound +info.riftkey.unbound=Unbound +info.dimDoor0=Place on the block under a rift +info.dimDoor1=to activate that rift or place +info.dimDoor2=anywhere else to create a +info.dimDoor3=pocket dimension. +info.goldDimDoor0=Similar to a Dimensional Door +info.goldDimDoor1=but keeps a pocket dimension +info.goldDimDoor2=loaded if placed on the inside. +info.personalDimDoor0=Creates a pathway to +info.personalDimDoor1=your personal pocket +info.riftblade0=Opens temporary doors on rifts +info.riftblade1=and has a teleport attack. +info.riftRemover0=Use near exposed rift +info.riftRemover1=to remove it and +info.riftRemover2=any nearby rifts. +info.riftSignature.bound=Leads to (%d, %d, %d) at dimension #%d +info.riftSignature.unbound0=First click stores a location; +info.riftSignature.unbound1=second click creates a pair of +info.riftSignature.unbound2=rifts linking the two locations. +info.riftSignature.stable0=First click stores a location, +info.riftSignature.stable1=other clicks create rifts linking +info.riftSignature.stable2=the first and last locations together. +info.chaosDoor=Caution: Leads to random destination +info.warpDoor0=Place on the block under +info.warpDoor1=a rift to create a portal, +info.warpDoor2=or place anywhere in a +info.warpDoor3=pocket dimension to exit. +entity.dimdoors.Monolith.name=Monolith \ No newline at end of file diff --git a/src/main/resources/assets/dimdoors/lang/fr_CA.lang b/src/main/resources/assets/dimdoors/lang/fr_CA.lang new file mode 100644 index 0000000..49c5173 --- /dev/null +++ b/src/main/resources/assets/dimdoors/lang/fr_CA.lang @@ -0,0 +1,63 @@ +itemGroup.dimDoorsCreativeTab=Dimensional Doors + +tile.doorGold.name=Porte dorée +tile.transientDoor.name=Porte transitoire +tile.dimDoorGold.name=Porte dorée dimensionnelle +tile.doorQuartz.name=Porte de quartz +tile.dimDoorPersonal.name=Porte dimensionnelle personnelle +tile.blockDimWall.name=Étoffe de la réalité +tile.blockAlteredWall.name=Étoffe altérée +tile.blockAncientWall.name=Étoffe ancienne +tile.blockDimWallPerm.name=Étoffe éternelle +tile.dimDoorWarp.name=Porte-raccourci +tile.rift.name=Fissure +tile.BlockLimbo.name=Étoffe effilochée +tile.chaosDoor.name=Porte instable +tile.dimDoor.name=Porte dimensionnelle +tile.dimHatch.name=Trappe transdimensionnelle + +item.itemGoldDoor.name=Porte dorée +item.itemDDKey=Clé de fissure +item.itemQuartzDoor.name=Porte de quartz +item.itemQuartzDimDoor.name=Porte dimensionnelle personnelle +item.itemGoldDimDoor.name=Porte dorée dimensionnelle +item.itemDimDoor.name=Porte dimensionnelle +item.itemDimDoorWarp.name=Porte-raccourci +item.itemLinkSignature.name=Signature de fissure +item.itemStabilizedRiftSig.name=Signature de fissure stabilisée +item.itemRiftRemover.name=Enleveur de fissure +item.itemStableFabric.name=Étoffe stable +item.itemChaosDoor.name=Porte instable +item.ItemRiftBlade.name=Lame de fissure +item.itemWorldThread.name=Fil du monde + +info.riftkey.bound=Liée +info.riftkey.unbound=Non liée +info.dimDoor0=Placez sur le bloc sous une fissure +info.dimDoor1=pour activer cette fissure ou placez +info.dimDoor2=n'importe où ailleurs pour créer une +info.dimDoor3=dimension de poche. +info.goldDimDoor0=Similaire à une porte dimensionnelle +info.goldDimDoor1=mais garde une dimension de poche +info.goldDimDoor2=chargée si elle est placée à l'intérieur. +info.personalDimDoor0=Crée un passage vers votre +info.personalDimDoor1=dimension de poche personnelle. +info.riftblade0=Ouvre des portes temporaires sur des fissures +info.riftblade1=et possède une attaque de téléporation. +info.riftRemover0=Utilisez près d'une fissure +info.riftRemover1=exposée pour l'enlever ainsi +info.riftRemover2=que celles à proximité. +info.riftSignature.bound=Mène aux coordonnées (%d, %d, %d) à la dimension #%d +info.riftSignature.unbound0=Le premier clic stocke un emplacement ; +info.riftSignature.unbound1=le deuxième clic crée une paire de +info.riftSignature.unbound2=fissures qui lient les deux emplacements. +info.riftSignature.stable0=Le premier clic stocke un emplacement, +info.riftSignature.stable1=les autres clics créent des fissurent qui lient +info.riftSignature.stable2=le premier et les derniers emplacements ensemble. +info.chaosDoor=Attention : mène vers une destination aléatoire +info.warpDoor0=Placez sur le bloc sous une +info.warpDoor1=fissure pour créer un portail, +info.warpDoor2=ou placez n'importe où dans une +info.warpDoor3=dimension de poche pour sortir. + +entity.dimdoors.Monolith.name=Monolithe diff --git a/src/main/resources/assets/dimdoors/lang/it_IT.lang b/src/main/resources/assets/dimdoors/lang/it_IT.lang new file mode 100644 index 0000000..3848d42 --- /dev/null +++ b/src/main/resources/assets/dimdoors/lang/it_IT.lang @@ -0,0 +1,59 @@ +itemGroup.dimDoorsCreativeTab=Dimensional Doors oggetti +tile.doorGold.name=Porta d'oro +tile.transientDoor.name=Porta transitoria +tile.dimDoorGold.name=Porta d'oro dimensionale +tile.doorQuartz.name=Porta di quarzo +tile.dimDoorPersonal.name=Porta dimensionale personale +tile.blockDimWall.name=Tessuto della realtà +tile.blockAlteredWall.name=Tessuto alterato +tile.blockAncientWall.name=Tessuto antico +tile.blockDimWallPerm.name=Tessuto eterno +tile.dimDoorWarp.name=Porta distorta +tile.rift.name=Frattura +tile.BlockLimbo.name=Tessuto disfatto +tile.chaosDoor.name=Porta instabile +tile.dimDoor.name=Porta dimensionale +tile.dimHatch.name=Botola transdimensionale +item.itemGoldDoor.name=Porta d'oro +item.itemDDKey=Chiave per frattura +item.itemQuartzDoor.name=Porta di quarzo +item.itemQuartzDimDoor.name=Porta dimensionale personale +item.itemGoldDimDoor.name=Porta d'oro dimensionale +item.itemDimDoor.name=Porta dimensionale +item.itemDimDoorWarp.name=Porta distorta +item.itemLinkSignature.name=Segno di frattura +item.itemStabilizedRiftSig.name=Segno di frattura stabilizzato +item.itemRiftRemover.name=Rimovitore di frattura +item.itemStableFabric.name=Tessuto stabile +item.itemChaosDoor.name=Porta instabile +item.ItemRiftBlade.name=Lama dimensionale +item.itemWorldThread.name=Filo di mondo +info.riftkey.bound=Legato +info.riftkey.unbound=Non legato +info.dimDoor0=Piazzalo sul blocco sotto una +info.dimDoor1=frattura per attivarla o piazzalo +info.dimDoor2=da qualunque altra parte per creare +info.dimDoor3=una dimensione tascabile. +info.goldDimDoor0=Simile a una Porta dimensionale +info.goldDimDoor1=ma tiene la dimensione tascabile +info.goldDimDoor2=caricata se piazzata all'interno. +info.personalDimDoor0=Crea un sentiero alla +info.personalDimDoor1=tua dimensione tascabile +info.riftblade0=Apre porte temporanee su fratture +info.riftblade1=e ha un colpo che teletrasporta. +info.riftRemover0=Usalo presso una frattura +info.riftRemover1=esposta per rimuovere quello +info.riftRemover2=e altre fratture vicine. +info.riftSignature.bound=Porta a (%d, %d, %d) nella dimensione #%d +info.riftSignature.unbound0=Al primo clic salva la posizione; al +info.riftSignature.unbound1=secondo clic crea un paio di fratture +info.riftSignature.unbound2=che collegano le due posizioni. +info.riftSignature.stable0=Al primo clic salva la posizione; al +info.riftSignature.stable1=secondo clic crea fratture che +info.riftSignature.stable2=collegano la prima e ultima posizione. +info.chaosDoor=Attenziione: Porta a una destinazione casuale +info.warpDoor0=Piazzalo sul blocco sotto una +info.warpDoor1=frattura per creare un portale, +info.warpDoor2=o piazzalo da qualunque altra parte +info.warpDoor3=in una dimensione tascabile per uscire. +entity.dimdoors.Monolith.name=Monolito diff --git a/src/main/resources/assets/dimdoors/lang/ru_RU.lang b/src/main/resources/assets/dimdoors/lang/ru_RU.lang new file mode 100644 index 0000000..ba3a43b --- /dev/null +++ b/src/main/resources/assets/dimdoors/lang/ru_RU.lang @@ -0,0 +1,59 @@ +itemGroup.dimDoorsCreativeTab=Dimensional Doors: Предметы +tile.doorGold.name=Ð—Ð¾Ð»Ð¾Ñ‚Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +tile.transientDoor.name=Ð’Ñ€ÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +tile.dimDoorGold.name=Ð—Ð¾Ð»Ð¾Ñ‚Ð°Ñ Ð¿Ñ€Ð¾ÑтранÑÑ‚Ð²ÐµÐ½Ð½Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +tile.doorQuartz.name=ÐšÐ²Ð°Ñ€Ñ†ÐµÐ²Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +tile.dimDoorPersonal.name=Ð›Ð¸Ñ‡Ð½Ð°Ñ Ð¿Ñ€Ð¾ÑтранÑÑ‚Ð²ÐµÐ½Ð½Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +tile.blockDimWall.name=Ткань ÐœÐ¸Ñ€Ð¾Ð·Ð´Ð°Ð½Ð¸Ñ +tile.blockAlteredWall.name=Ð˜Ð·Ð¼ÐµÐ½Ñ‘Ð½Ð½Ð°Ñ Ñ‚ÐºÐ°Ð½ÑŒ +tile.blockAncientWall.name=ДревнÑÑ Ñ‚ÐºÐ°Ð½ÑŒ +tile.blockDimWallPerm.name=Ð’ÐµÑ‡Ð½Ð°Ñ Ñ‚ÐºÐ°Ð½ÑŒ +tile.dimDoorWarp.name=Дверь иÑÐºÐ°Ð¶ÐµÐ½Ð¸Ñ +tile.rift.name=Разлом +tile.BlockLimbo.name=РаÑÐ¿ÑƒÑ‚Ð°Ð½Ð½Ð°Ñ Ñ‚ÐºÐ°Ð½ÑŒ +tile.chaosDoor.name=ÐеÑÑ‚Ð°Ð±Ð¸Ð»ÑŒÐ½Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +tile.dimDoor.name=ПроÑтранÑÑ‚Ð²ÐµÐ½Ð½Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +tile.dimHatch.name=МежпроÑтранÑтвенный люк +item.itemGoldDoor.name=Ð—Ð¾Ð»Ð¾Ñ‚Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +item.itemDDKey=Ключ разлома +item.itemQuartzDoor.name=ÐšÐ²Ð°Ñ€Ñ†ÐµÐ²Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +item.itemQuartzDimDoor.name=Ð›Ð¸Ñ‡Ð½Ð°Ñ Ð¿Ñ€Ð¾ÑтранÑÑ‚Ð²ÐµÐ½Ð½Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +item.itemGoldDimDoor.name=Ð—Ð¾Ð»Ð¾Ñ‚Ð°Ñ Ð¿Ñ€Ð¾ÑтранÑÑ‚Ð²ÐµÐ½Ð½Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +item.itemDimDoor.name=ПроÑтранÑÑ‚Ð²ÐµÐ½Ð½Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +item.itemDimDoorWarp.name=Дверь иÑÐºÐ°Ð¶ÐµÐ½Ð¸Ñ +item.itemLinkSignature.name=ПодпиÑыватель разлома +item.itemStabilizedRiftSig.name=Стабилизированный подпиÑыватель разлома +item.itemRiftRemover.name=Уничтожитель разломов +item.itemStableFabric.name=Ð¡Ñ‚Ð°Ð±Ð¸Ð»ÑŒÐ½Ð°Ñ Ñ‚ÐºÐ°Ð½ÑŒ +item.itemChaosDoor.name=ÐеÑÑ‚Ð°Ð±Ð¸Ð»ÑŒÐ½Ð°Ñ Ð´Ð²ÐµÑ€ÑŒ +item.ItemRiftBlade.name=Клинок разлома +item.itemWorldThread.name=ÐœÐ¸Ñ€Ð¾Ð²Ð°Ñ Ð½Ð¸Ñ‚ÑŒ +info.riftkey.bound=СвÑзан +info.riftkey.unbound=Ðе ÑвÑзан +info.dimDoor0=ПоÑтавьте на блок под разломом, +info.dimDoor1=чтобы активировать Ñтот разлом или +info.dimDoor2=поÑтавьте куда угодно, чтобы Ñоздать +info.dimDoor3=карманное измерение. +info.goldDimDoor0=Схожа Ñ Ð¿Ñ€Ð¾ÑтранÑтвенной дверью, +info.goldDimDoor1=но она также держит карманное измерение +info.goldDimDoor2=загруженным, еÑли она размещена внутри его. +info.personalDimDoor0=Создает путь к +info.personalDimDoor1=Вашему карману +info.riftblade0=Открывает временные двери на разломах +info.riftblade1=и наноÑит урон при телепортации. +info.riftRemover0=ИÑпользуйте Ñ€Ñдом Ñ Ñ€Ð°Ð·Ð»Ð¾Ð¼Ð¾Ð¼, +info.riftRemover1=чтобы убрать его и +info.riftRemover2=другие ближайшие разломы. +info.riftSignature.bound=Ведёт в (%d, %d, %d) в измерение #%d +info.riftSignature.unbound0=Первое нажатие ÑохранÑет раÑположение; +info.riftSignature.unbound1=второе нажатие Ñоздаёт пару +info.riftSignature.unbound2=разломов, ÑоединÑющих два раÑположениÑ. +info.riftSignature.stable0=Первое нажатие ÑохранÑет раÑположение, +info.riftSignature.stable1=оÑтальные Ð½Ð°Ð¶Ð°Ñ‚Ð¸Ñ Ñоздают разломы, ÑоединÑющие +info.riftSignature.stable2=первое и поÑледнее раÑÐ¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²Ð¼ÐµÑте. +info.chaosDoor=Внимание: Ведёт неизвеÑтно куда +info.warpDoor0=ПоÑтавьте на блок под +info.warpDoor1=разломом, чтобы Ñоздать портал +info.warpDoor2=или поÑтавьте куда угодно в +info.warpDoor3=карманном измерении, чтобы выйти из него. +entity.dimdoors.Monolith.name=Монолит diff --git a/src/main/resources/assets/dimdoors/lang/zh_CN.lang b/src/main/resources/assets/dimdoors/lang/zh_CN.lang new file mode 100644 index 0000000..e5a720e --- /dev/null +++ b/src/main/resources/assets/dimdoors/lang/zh_CN.lang @@ -0,0 +1,59 @@ +itemGroup.dimDoorsCreativeTab=æ¬¡å…ƒé—¨ç‰©å“ +tile.doorGold.name=金门 +tile.transientDoor.name=瞬æ¯ä¹‹é—¨ +tile.dimDoorGold.name=金制次元门 +tile.doorQuartz.name=石英门 +tile.dimDoorPersonal.name=ç§äººæ¬¡å…ƒé—¨ +tile.blockDimWall.name=çŽ°å®žä¹‹å£ +tile.blockAlteredWall.name=å˜åŒ–ä¹‹å£ +tile.blockAncientWall.name=远å¤ä¹‹å£ +tile.blockDimWallPerm.name=æ°¸æ’ä¹‹å£ +tile.dimDoorWarp.name=扭曲之门 +tile.rift.name=裂痕 +tile.BlockLimbo.name=è¾¹å¢ƒä¹‹å£ +tile.chaosDoor.name=ä¸ç¨³å®šçš„é—¨ +tile.dimDoor.name=次元门 +tile.dimHatch.name=空间活æ¿é—¨ +item.itemGoldDoor.name=金门 +item.itemDDKey=裂痕钥匙 +item.itemQuartzDoor.name=石英门 +item.itemQuartzDimDoor.name=ç§äººæ¬¡å…ƒé—¨ +item.itemGoldDimDoor.name=金制次元门 +item.itemDimDoor.name=次元门 +item.itemDimDoorWarp.name=扭曲之门 +item.itemLinkSignature.name=裂痕å°è®° +item.itemStabilizedRiftSig.name=裂痕å°è®°(稳定) +item.itemRiftRemover.name=裂痕移除器 +item.itemStableFabric.name=稳定构造 +item.itemChaosDoor.name=ä¸ç¨³å®šé—¨ +item.ItemRiftBlade.name=裂痕之刃 +item.itemWorldThread.name=世界纤维 +info.riftkey.bound=绑定 +info.riftkey.unbound=å–æ¶ˆç»‘定 +info.dimDoor0=放在裂痕下方的方å—上 +info.dimDoor1=æ¥æ¿€æ´»è£‚ç—• +info.dimDoor2=或放在任æ„åœ°ç‚¹ç”Ÿæˆ +info.dimDoor3=一个å£è¢‹æ¬¡å…ƒ. +info.goldDimDoor0=类似于次元门 +info.goldDimDoor1=但它放在次元内部时 +info.goldDimDoor2=ä¼šä¿æŒæ¬¡å…ƒçš„加载. +info.personalDimDoor0=生æˆä¸€ä¸ªé€šå‘ä½  +info.personalDimDoor1=å£è¢‹æ¬¡å…ƒçš„路径 +info.riftblade0=在裂痕上开å¯ä¸´æ—¶çš„é—¨ +info.riftblade1=它还拥有瞬移攻击的能力. +info.riftRemover0=在外露的裂痕附近使用 +info.riftRemover1=æ¥ç§»é™¤å®ƒä»¥åŠé™„近的其他 +info.riftRemover2=裂痕. +info.riftSignature.bound=指å‘(%d, %d, %d) ä½äºŽ#%d +info.riftSignature.unbound0=第一次点击记录一个ä½ç½®; +info.riftSignature.unbound1=第二次点击在两地间创造 +info.riftSignature.unbound2=一对相互连接的裂痕. +info.riftSignature.stable0=首次点击记录一个ä½ç½®, +info.riftSignature.stable1=冿¬¡ç‚¹å‡»ç”Ÿæˆè¿žæŽ¥ä¸¤åœ°çš„ +info.riftSignature.stable2=裂痕. +info.chaosDoor=注æ„: å°†ä¼šéšæœºä¼ é€ +info.warpDoor0=放在裂痕下方的方å—上 +info.warpDoor1=æ¥åˆ¶é€ ä¼ é€é—¨, +info.warpDoor2=放在å£è¢‹æ¬¡å…ƒä¸­ +info.warpDoor3=以退出空间. +entity.dimdoors.Monolith.name=巨石 diff --git a/src/main/resources/assets/dimdoors/sounds.json b/src/main/resources/assets/dimdoors/sounds.json new file mode 100644 index 0000000..0fc825e --- /dev/null +++ b/src/main/resources/assets/dimdoors/sounds.json @@ -0,0 +1,15 @@ +{ + "crack": {"category":"hostile", "sounds":[{"name":"crack","stream":false}]}, + "creepy": {"category":"ambient", "sounds":[{"name":"creepy","stream":true}]}, + "doorLocked": {"category":"player", "sounds":[{"name":"doorLocked","stream":false}]}, + "doorLockRemoved": {"category":"player", "sounds":[{"name":"doorLockRemoved","stream":false}]}, + "keyLock": {"category":"player", "sounds":[{"name":"keyLock","stream":false}]}, + "keyUnlock": {"category":"player", "sounds":[{"name":"keyUnlock", "stream":false}]}, + "monk": {"category":"hostile", "sounds":[{"name":"monk", "stream":false}]}, + "rift": {"category":"master", "sounds":[{"name":"rift", "stream":false}]}, + "riftClose": {"category":"player", "sounds":[{"name":"riftClose", "stream":false}]}, + "riftDoor": {"category":"player", "sounds":[{"name":"riftDoor", "stream":false}]}, + "riftEnd": {"category":"player", "sounds":[{"name":"riftEnd", "stream":false}]}, + "riftStart": {"category":"player", "sounds":[{"name":"riftStart", "stream":false}]}, + "tearing": {"category":"hostile", "sounds":[{"name":"tearing", "stream":false}]} +} \ No newline at end of file diff --git a/src/main/resources/assets/dimdoors/sound/crack.ogg b/src/main/resources/assets/dimdoors/sounds/crack.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/crack.ogg rename to src/main/resources/assets/dimdoors/sounds/crack.ogg diff --git a/src/main/resources/assets/dimdoors/sound/creepy.ogg b/src/main/resources/assets/dimdoors/sounds/creepy.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/creepy.ogg rename to src/main/resources/assets/dimdoors/sounds/creepy.ogg diff --git a/src/main/resources/assets/dimdoors/sound/doorLockRemoved.mp3 b/src/main/resources/assets/dimdoors/sounds/doorLockRemoved.mp3 similarity index 100% rename from src/main/resources/assets/dimdoors/sound/doorLockRemoved.mp3 rename to src/main/resources/assets/dimdoors/sounds/doorLockRemoved.mp3 diff --git a/src/main/resources/assets/dimdoors/sound/doorLockRemoved.ogg b/src/main/resources/assets/dimdoors/sounds/doorLockRemoved.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/doorLockRemoved.ogg rename to src/main/resources/assets/dimdoors/sounds/doorLockRemoved.ogg diff --git a/src/main/resources/assets/dimdoors/sound/doorLocked.mp3 b/src/main/resources/assets/dimdoors/sounds/doorLocked.mp3 similarity index 100% rename from src/main/resources/assets/dimdoors/sound/doorLocked.mp3 rename to src/main/resources/assets/dimdoors/sounds/doorLocked.mp3 diff --git a/src/main/resources/assets/dimdoors/sound/doorLocked.ogg b/src/main/resources/assets/dimdoors/sounds/doorLocked.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/doorLocked.ogg rename to src/main/resources/assets/dimdoors/sounds/doorLocked.ogg diff --git a/src/main/resources/assets/dimdoors/sound/keyLock.mp3 b/src/main/resources/assets/dimdoors/sounds/keyLock.mp3 similarity index 100% rename from src/main/resources/assets/dimdoors/sound/keyLock.mp3 rename to src/main/resources/assets/dimdoors/sounds/keyLock.mp3 diff --git a/src/main/resources/assets/dimdoors/sound/keyLock.ogg b/src/main/resources/assets/dimdoors/sounds/keyLock.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/keyLock.ogg rename to src/main/resources/assets/dimdoors/sounds/keyLock.ogg diff --git a/src/main/resources/assets/dimdoors/sound/keyUnlock.mp3 b/src/main/resources/assets/dimdoors/sounds/keyUnlock.mp3 similarity index 100% rename from src/main/resources/assets/dimdoors/sound/keyUnlock.mp3 rename to src/main/resources/assets/dimdoors/sounds/keyUnlock.mp3 diff --git a/src/main/resources/assets/dimdoors/sound/keyUnlock.ogg b/src/main/resources/assets/dimdoors/sounds/keyUnlock.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/keyUnlock.ogg rename to src/main/resources/assets/dimdoors/sounds/keyUnlock.ogg diff --git a/src/main/resources/assets/dimdoors/sound/monk.ogg b/src/main/resources/assets/dimdoors/sounds/monk.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/monk.ogg rename to src/main/resources/assets/dimdoors/sounds/monk.ogg diff --git a/src/main/resources/assets/dimdoors/sound/rift.ogg b/src/main/resources/assets/dimdoors/sounds/rift.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/rift.ogg rename to src/main/resources/assets/dimdoors/sounds/rift.ogg diff --git a/src/main/resources/assets/dimdoors/sound/riftClose.ogg b/src/main/resources/assets/dimdoors/sounds/riftClose.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/riftClose.ogg rename to src/main/resources/assets/dimdoors/sounds/riftClose.ogg diff --git a/src/main/resources/assets/dimdoors/sound/riftDoor.ogg b/src/main/resources/assets/dimdoors/sounds/riftDoor.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/riftDoor.ogg rename to src/main/resources/assets/dimdoors/sounds/riftDoor.ogg diff --git a/src/main/resources/assets/dimdoors/sound/riftEnd.ogg b/src/main/resources/assets/dimdoors/sounds/riftEnd.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/riftEnd.ogg rename to src/main/resources/assets/dimdoors/sounds/riftEnd.ogg diff --git a/src/main/resources/assets/dimdoors/sound/riftStart.ogg b/src/main/resources/assets/dimdoors/sounds/riftStart.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/riftStart.ogg rename to src/main/resources/assets/dimdoors/sounds/riftStart.ogg diff --git a/src/main/resources/assets/dimdoors/sound/tearing.ogg b/src/main/resources/assets/dimdoors/sounds/tearing.ogg similarity index 100% rename from src/main/resources/assets/dimdoors/sound/tearing.ogg rename to src/main/resources/assets/dimdoors/sounds/tearing.ogg diff --git a/src/main/resources/assets/dimdoors/textures/blocks/BlockLimbo.psd b/src/main/resources/assets/dimdoors/textures/blocks/BlockLimbo.psd deleted file mode 100644 index 32443fe..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/blocks/BlockLimbo.psd and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/blocks/tile.BlockLimbo - Copy (2).png b/src/main/resources/assets/dimdoors/textures/blocks/tile.BlockLimbo - Copy (2).png deleted file mode 100644 index a18632c..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/blocks/tile.BlockLimbo - Copy (2).png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/blocks/tile.BlockLimbo - Copy (3).png b/src/main/resources/assets/dimdoors/textures/blocks/tile.BlockLimbo - Copy (3).png deleted file mode 100644 index 7efb9d2..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/blocks/tile.BlockLimbo - Copy (3).png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/blocks/tile.BlockLimbo - Copy.png b/src/main/resources/assets/dimdoors/textures/blocks/tile.BlockLimbo - Copy.png deleted file mode 100644 index e71f830..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/blocks/tile.BlockLimbo - Copy.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/blocks/tile.blockDimWallPerm.psd b/src/main/resources/assets/dimdoors/textures/blocks/tile.blockDimWallPerm.psd deleted file mode 100644 index d37e313..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/blocks/tile.blockDimWallPerm.psd and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith.psd b/src/main/resources/assets/dimdoors/textures/mobs/Monolith.psd deleted file mode 100644 index 72510aa..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith.psd and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith0.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith0.png deleted file mode 100644 index ec09cbe..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith0.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith1.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith1.png deleted file mode 100644 index 54215c2..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith1.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith10.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith10.png deleted file mode 100644 index 5460b62..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith10.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith11.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith11.png deleted file mode 100644 index cb01528..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith11.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith12.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith12.png deleted file mode 100644 index 65c9b07..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith12.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith13.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith13.png deleted file mode 100644 index 67630aa..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith13.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith14.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith14.png deleted file mode 100644 index 6757ad3..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith14.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith15.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith15.png deleted file mode 100644 index 3acb2e9..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith15.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith16.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith16.png deleted file mode 100644 index 59f2d23..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith16.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith17.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith17.png deleted file mode 100644 index 305166f..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith17.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith18.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith18.png deleted file mode 100644 index b02ffcf..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith18.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith2.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith2.png deleted file mode 100644 index 6b4d956..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith2.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith3.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith3.png deleted file mode 100644 index e45e6c0..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith3.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith4.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith4.png deleted file mode 100644 index a1b1df6..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith4.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith5.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith5.png deleted file mode 100644 index 1ea2a22..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith5.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith6.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith6.png deleted file mode 100644 index bd9bcc1..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith6.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith7.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith7.png deleted file mode 100644 index ce48ec0..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith7.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith8.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith8.png deleted file mode 100644 index f8a4395..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith8.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/Monolith9.png b/src/main/resources/assets/dimdoors/textures/mobs/Monolith9.png deleted file mode 100644 index 5d236d1..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/Monolith9.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/eye.psd b/src/main/resources/assets/dimdoors/textures/mobs/eye.psd deleted file mode 100644 index 54fabf7..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/eye.psd and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith0.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith0.png deleted file mode 100644 index ec09cbe..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith0.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith1.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith1.png deleted file mode 100644 index ad139ec..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith1.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith10.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith10.png deleted file mode 100644 index 5d9fbc3..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith10.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith11.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith11.png deleted file mode 100644 index f2b512c..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith11.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith12.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith12.png deleted file mode 100644 index 26cc3da..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith12.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith13.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith13.png deleted file mode 100644 index b02d041..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith13.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith14.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith14.png deleted file mode 100644 index 60c170b..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith14.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith15.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith15.png deleted file mode 100644 index 0588923..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith15.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith16.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith16.png deleted file mode 100644 index 32e07c8..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith16.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith17.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith17.png deleted file mode 100644 index 5b80bf9..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith17.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith18.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith18.png deleted file mode 100644 index 1fedb64..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith18.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith2.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith2.png deleted file mode 100644 index ad139ec..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith2.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith3.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith3.png deleted file mode 100644 index ec3f06f..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith3.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith4.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith4.png deleted file mode 100644 index bdd4165..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith4.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith5.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith5.png deleted file mode 100644 index 08a9717..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith5.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith6.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith6.png deleted file mode 100644 index a3e8ea6..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith6.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith7.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith7.png deleted file mode 100644 index b891762..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith7.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith8.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith8.png deleted file mode 100644 index dd7ad2f..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith8.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith9.png b/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith9.png deleted file mode 100644 index 7ca5b7e..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/newer Monolith/Monolith9.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/oldMonolith/Monolith.psd b/src/main/resources/assets/dimdoors/textures/mobs/oldMonolith/Monolith.psd deleted file mode 100644 index 411e055..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/oldMonolith/Monolith.psd and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith10.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith10.png deleted file mode 100644 index 5460b62..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith10.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith11.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith11.png deleted file mode 100644 index cb01528..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith11.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith12.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith12.png deleted file mode 100644 index 65c9b07..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith12.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith13.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith13.png deleted file mode 100644 index 67630aa..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith13.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith14.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith14.png deleted file mode 100644 index 6757ad3..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith14.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith15.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith15.png deleted file mode 100644 index 3acb2e9..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith15.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith16.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith16.png deleted file mode 100644 index 59f2d23..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith16.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith17.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith17.png deleted file mode 100644 index 305166f..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith17.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith18.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith18.png deleted file mode 100644 index b02ffcf..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith18.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith2.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith2.png deleted file mode 100644 index 6b4d956..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith2.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith3.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith3.png deleted file mode 100644 index e45e6c0..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith3.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith4.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith4.png deleted file mode 100644 index a1b1df6..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith4.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith5.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith5.png deleted file mode 100644 index 1ea2a22..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith5.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith6.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith6.png deleted file mode 100644 index bd9bcc1..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith6.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith7.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith7.png deleted file mode 100644 index ce48ec0..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith7.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith8.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith8.png deleted file mode 100644 index f8a4395..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith8.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith9.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith9.png deleted file mode 100644 index 5d236d1..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/Monolith9.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/monolith0.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/monolith0.png deleted file mode 100644 index ec09cbe..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/monolith0.png and /dev/null differ diff --git a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/monolith1.png b/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/monolith1.png deleted file mode 100644 index 54215c2..0000000 Binary files a/src/main/resources/assets/dimdoors/textures/mobs/testMonolith/monolith1.png and /dev/null differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 7a43be9..891a327 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,18 +1,18 @@ { -"modinfoversion":2, -"modlist": +"modListVersion":2, +"modList": [ { "modid": "dimdoors", "name": "Dimensional Doors", "description": "Bend and twist reality itself, creating pocket dimensions, rifts, and much more", -"version": "$version", +"version": "2.2.5-test", "credits": "Created by StevenRS11, Coded by StevenRS11 and SenseiKiwi, Logo and Testing by Jaitsu", "logoFile": "/dimdoors_logo.png", -"mcversion": "$mcversion", +"mcversion": "1.7.10", "url": "http://www.minecraftforum.net/topic/1650007-147smpssplan-dimensional-doors-v110-physics-what-physics-updated-with-fancy-opengl/", "updateUrl": "", -"authors": [ "StevenRS11", "SenseiKiwi" ], +"authorList": [ "StevenRS11", "SenseiKiwi" ], "parent":"", "screenshots": [], "dependencies": [ "Forge"] diff --git a/src/main/resources/schematics/core/somethingBroke.schematic b/src/main/resources/schematics/core/somethingBroke.schematic index 28a3ea8..de2d9c7 100644 Binary files a/src/main/resources/schematics/core/somethingBroke.schematic and b/src/main/resources/schematics/core/somethingBroke.schematic differ diff --git a/src/main/resources/schematics/gateways/sandstonePillars.schematic b/src/main/resources/schematics/gateways/sandstonePillars.schematic index 30315b5..9f5043c 100644 Binary files a/src/main/resources/schematics/gateways/sandstonePillars.schematic and b/src/main/resources/schematics/gateways/sandstonePillars.schematic differ diff --git a/src/main/resources/schematics/gateways/twoPillars.schematic b/src/main/resources/schematics/gateways/twoPillars.schematic index 75f538d..b56de04 100644 Binary files a/src/main/resources/schematics/gateways/twoPillars.schematic and b/src/main/resources/schematics/gateways/twoPillars.schematic differ diff --git a/src/main/resources/schematics/nether/ComplexHall_SK-CourtyardAmbush_Open_100.schematic b/src/main/resources/schematics/nether/ComplexHall_SK-CourtyardAmbush_Open_100.schematic index d19467b..fc49b35 100644 Binary files a/src/main/resources/schematics/nether/ComplexHall_SK-CourtyardAmbush_Open_100.schematic and b/src/main/resources/schematics/nether/ComplexHall_SK-CourtyardAmbush_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/ComplexHall_SK-Intersection_Open_100.schematic b/src/main/resources/schematics/nether/ComplexHall_SK-Intersection_Open_100.schematic index c1ff4e4..903b9d1 100644 Binary files a/src/main/resources/schematics/nether/ComplexHall_SK-Intersection_Open_100.schematic and b/src/main/resources/schematics/nether/ComplexHall_SK-Intersection_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/ComplexHall_SK-SoulWastes_Open_100.schematic b/src/main/resources/schematics/nether/ComplexHall_SK-SoulWastes_Open_100.schematic index ab0210e..029d4be 100644 Binary files a/src/main/resources/schematics/nether/ComplexHall_SK-SoulWastes_Open_100.schematic and b/src/main/resources/schematics/nether/ComplexHall_SK-SoulWastes_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/ComplexHall_SK-Starfall_Open_100.schematic b/src/main/resources/schematics/nether/ComplexHall_SK-Starfall_Open_100.schematic index d585689..cd06896 100644 Binary files a/src/main/resources/schematics/nether/ComplexHall_SK-Starfall_Open_100.schematic and b/src/main/resources/schematics/nether/ComplexHall_SK-Starfall_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/ComplexHall_SK-TheCauldron_Open_100.schematic b/src/main/resources/schematics/nether/ComplexHall_SK-TheCauldron_Open_100.schematic index c18a44c..bb26d45 100644 Binary files a/src/main/resources/schematics/nether/ComplexHall_SK-TheCauldron_Open_100.schematic and b/src/main/resources/schematics/nether/ComplexHall_SK-TheCauldron_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/Maze_SK-BrimstoneMines_Open_80.schematic b/src/main/resources/schematics/nether/Maze_SK-BrimstoneMines_Open_80.schematic index b62c1a9..8ce25f7 100644 Binary files a/src/main/resources/schematics/nether/Maze_SK-BrimstoneMines_Open_80.schematic and b/src/main/resources/schematics/nether/Maze_SK-BrimstoneMines_Open_80.schematic differ diff --git a/src/main/resources/schematics/nether/Maze_SK-QuartzfoldCave_Open_40.schematic b/src/main/resources/schematics/nether/Maze_SK-QuartzfoldCave_Open_40.schematic index e253950..65f9e2e 100644 Binary files a/src/main/resources/schematics/nether/Maze_SK-QuartzfoldCave_Open_40.schematic and b/src/main/resources/schematics/nether/Maze_SK-QuartzfoldCave_Open_40.schematic differ diff --git a/src/main/resources/schematics/nether/Maze_SK-SwirlsUponSwirls_Open_40.schematic b/src/main/resources/schematics/nether/Maze_SK-SwirlsUponSwirls_Open_40.schematic index 4395456..b82b97b 100644 Binary files a/src/main/resources/schematics/nether/Maze_SK-SwirlsUponSwirls_Open_40.schematic and b/src/main/resources/schematics/nether/Maze_SK-SwirlsUponSwirls_Open_40.schematic differ diff --git a/src/main/resources/schematics/nether/Maze_SK-Tangle_Open_80.schematic b/src/main/resources/schematics/nether/Maze_SK-Tangle_Open_80.schematic index b6de21e..ffb2103 100644 Binary files a/src/main/resources/schematics/nether/Maze_SK-Tangle_Open_80.schematic and b/src/main/resources/schematics/nether/Maze_SK-Tangle_Open_80.schematic differ diff --git a/src/main/resources/schematics/nether/SimpleHall_SK-AnvilValley_Open_100.schematic b/src/main/resources/schematics/nether/SimpleHall_SK-AnvilValley_Open_100.schematic index a08854f..49ad386 100644 Binary files a/src/main/resources/schematics/nether/SimpleHall_SK-AnvilValley_Open_100.schematic and b/src/main/resources/schematics/nether/SimpleHall_SK-AnvilValley_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/SimpleHall_SK-Arena_Open_100.schematic b/src/main/resources/schematics/nether/SimpleHall_SK-Arena_Open_100.schematic index 05a8cda..9ec6d4f 100644 Binary files a/src/main/resources/schematics/nether/SimpleHall_SK-Arena_Open_100.schematic and b/src/main/resources/schematics/nether/SimpleHall_SK-Arena_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/SimpleHall_SK-DarkPathLeft_Open_50.schematic b/src/main/resources/schematics/nether/SimpleHall_SK-DarkPathLeft_Open_50.schematic index 9e742bb..916ddc0 100644 Binary files a/src/main/resources/schematics/nether/SimpleHall_SK-DarkPathLeft_Open_50.schematic and b/src/main/resources/schematics/nether/SimpleHall_SK-DarkPathLeft_Open_50.schematic differ diff --git a/src/main/resources/schematics/nether/SimpleHall_SK-DarkPathRight_Open_50.schematic b/src/main/resources/schematics/nether/SimpleHall_SK-DarkPathRight_Open_50.schematic index 8e44d28..7bb184e 100644 Binary files a/src/main/resources/schematics/nether/SimpleHall_SK-DarkPathRight_Open_50.schematic and b/src/main/resources/schematics/nether/SimpleHall_SK-DarkPathRight_Open_50.schematic differ diff --git a/src/main/resources/schematics/nether/SimpleHall_SK-DiamondRoom_Open_100.schematic b/src/main/resources/schematics/nether/SimpleHall_SK-DiamondRoom_Open_100.schematic index 364c896..76e28b2 100644 Binary files a/src/main/resources/schematics/nether/SimpleHall_SK-DiamondRoom_Open_100.schematic and b/src/main/resources/schematics/nether/SimpleHall_SK-DiamondRoom_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/SimpleHall_SK-LongBridge_Open_100.schematic b/src/main/resources/schematics/nether/SimpleHall_SK-LongBridge_Open_100.schematic index 42ba696..fc7d578 100644 Binary files a/src/main/resources/schematics/nether/SimpleHall_SK-LongBridge_Open_100.schematic and b/src/main/resources/schematics/nether/SimpleHall_SK-LongBridge_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/SimpleHall_SK-SpiralStairsDown_Open_100.schematic b/src/main/resources/schematics/nether/SimpleHall_SK-SpiralStairsDown_Open_100.schematic index e887317..a0e5e6b 100644 Binary files a/src/main/resources/schematics/nether/SimpleHall_SK-SpiralStairsDown_Open_100.schematic and b/src/main/resources/schematics/nether/SimpleHall_SK-SpiralStairsDown_Open_100.schematic differ diff --git a/src/main/resources/schematics/nether/SimpleHall_SK-TheFurnace_Open_100.schematic b/src/main/resources/schematics/nether/SimpleHall_SK-TheFurnace_Open_100.schematic index fcf50b0..0cf0713 100644 Binary files a/src/main/resources/schematics/nether/SimpleHall_SK-TheFurnace_Open_100.schematic and b/src/main/resources/schematics/nether/SimpleHall_SK-TheFurnace_Open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/ComplexHall_Balgor0-CrumbledHall_Closed_75.schematic b/src/main/resources/schematics/ruins/ComplexHall_Balgor0-CrumbledHall_Closed_75.schematic index 7f924f6..567c812 100644 Binary files a/src/main/resources/schematics/ruins/ComplexHall_Balgor0-CrumbledHall_Closed_75.schematic and b/src/main/resources/schematics/ruins/ComplexHall_Balgor0-CrumbledHall_Closed_75.schematic differ diff --git a/src/main/resources/schematics/ruins/ComplexHall_Cere-JumpPass_Open_75.schematic b/src/main/resources/schematics/ruins/ComplexHall_Cere-JumpPass_Open_75.schematic index 9c242b6..a116018 100644 Binary files a/src/main/resources/schematics/ruins/ComplexHall_Cere-JumpPass_Open_75.schematic and b/src/main/resources/schematics/ruins/ComplexHall_Cere-JumpPass_Open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/ComplexHall_Cere-PuzzleWall_Open_75.schematic b/src/main/resources/schematics/ruins/ComplexHall_Cere-PuzzleWall_Open_75.schematic index 0088238..ee80448 100644 Binary files a/src/main/resources/schematics/ruins/ComplexHall_Cere-PuzzleWall_Open_75.schematic and b/src/main/resources/schematics/ruins/ComplexHall_Cere-PuzzleWall_Open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/ComplexHall_Cere-TransferTunnel_Closed_100.schematic b/src/main/resources/schematics/ruins/ComplexHall_Cere-TransferTunnel_Closed_100.schematic index 786a010..f2601c1 100644 Binary files a/src/main/resources/schematics/ruins/ComplexHall_Cere-TransferTunnel_Closed_100.schematic and b/src/main/resources/schematics/ruins/ComplexHall_Cere-TransferTunnel_Closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/ComplexHall_SK-AnchoredDescent_Open_50.schematic b/src/main/resources/schematics/ruins/ComplexHall_SK-AnchoredDescent_Open_50.schematic index 60b443c..45d20ab 100644 Binary files a/src/main/resources/schematics/ruins/ComplexHall_SK-AnchoredDescent_Open_50.schematic and b/src/main/resources/schematics/ruins/ComplexHall_SK-AnchoredDescent_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/ComplexHall_SK-HallwayHiddenTreasure-B_Closed_50.schematic b/src/main/resources/schematics/ruins/ComplexHall_SK-HallwayHiddenTreasure-B_Closed_50.schematic index b97c3d1..abc5509 100644 Binary files a/src/main/resources/schematics/ruins/ComplexHall_SK-HallwayHiddenTreasure-B_Closed_50.schematic and b/src/main/resources/schematics/ruins/ComplexHall_SK-HallwayHiddenTreasure-B_Closed_50.schematic differ diff --git a/src/main/resources/schematics/ruins/ComplexHall_SK-HiddenStairs_Open_100.schematic b/src/main/resources/schematics/ruins/ComplexHall_SK-HiddenStairs_Open_100.schematic index b9a0863..10d0193 100644 Binary files a/src/main/resources/schematics/ruins/ComplexHall_SK-HiddenStairs_Open_100.schematic and b/src/main/resources/schematics/ruins/ComplexHall_SK-HiddenStairs_Open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/ComplexHall_SK-LostGarden_Open_40.schematic b/src/main/resources/schematics/ruins/ComplexHall_SK-LostGarden_Open_40.schematic index aa2305d..fffa716 100644 Binary files a/src/main/resources/schematics/ruins/ComplexHall_SK-LostGarden_Open_40.schematic and b/src/main/resources/schematics/ruins/ComplexHall_SK-LostGarden_Open_40.schematic differ diff --git a/src/main/resources/schematics/ruins/ComplexHall_SK-RuinsOhNo_Open_50.schematic b/src/main/resources/schematics/ruins/ComplexHall_SK-RuinsOhNo_Open_50.schematic index da86903..1e96e5a 100644 Binary files a/src/main/resources/schematics/ruins/ComplexHall_SK-RuinsOhNo_Open_50.schematic and b/src/main/resources/schematics/ruins/ComplexHall_SK-RuinsOhNo_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/DeadEnd_Balgor0-ArrowHall_Closed_75.schematic b/src/main/resources/schematics/ruins/DeadEnd_Balgor0-ArrowHall_Closed_75.schematic index 12855b2..75295d3 100644 Binary files a/src/main/resources/schematics/ruins/DeadEnd_Balgor0-ArrowHall_Closed_75.schematic and b/src/main/resources/schematics/ruins/DeadEnd_Balgor0-ArrowHall_Closed_75.schematic differ diff --git a/src/main/resources/schematics/ruins/DeadEnd_Cere-FloatingAltar_Open_75.schematic b/src/main/resources/schematics/ruins/DeadEnd_Cere-FloatingAltar_Open_75.schematic index 3e9d654..7f9b422 100644 Binary files a/src/main/resources/schematics/ruins/DeadEnd_Cere-FloatingAltar_Open_75.schematic and b/src/main/resources/schematics/ruins/DeadEnd_Cere-FloatingAltar_Open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/DeadEnd_SK-EyesOfTricksters_Open_50.schematic b/src/main/resources/schematics/ruins/DeadEnd_SK-EyesOfTricksters_Open_50.schematic index dd9b40c..5c7c611 100644 Binary files a/src/main/resources/schematics/ruins/DeadEnd_SK-EyesOfTricksters_Open_50.schematic and b/src/main/resources/schematics/ruins/DeadEnd_SK-EyesOfTricksters_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/DeadEnd_SK-FarAwayInTheDark_Open_100.schematic b/src/main/resources/schematics/ruins/DeadEnd_SK-FarAwayInTheDark_Open_100.schematic index 8dd9432..511aab2 100644 Binary files a/src/main/resources/schematics/ruins/DeadEnd_SK-FarAwayInTheDark_Open_100.schematic and b/src/main/resources/schematics/ruins/DeadEnd_SK-FarAwayInTheDark_Open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/DeadEnd_SK-UnstableDesert_Open_50.schematic b/src/main/resources/schematics/ruins/DeadEnd_SK-UnstableDesert_Open_50.schematic index cfa3e00..244e838 100644 Binary files a/src/main/resources/schematics/ruins/DeadEnd_SK-UnstableDesert_Open_50.schematic and b/src/main/resources/schematics/ruins/DeadEnd_SK-UnstableDesert_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Exit_SK-HotSuspense_Open_75.schematic b/src/main/resources/schematics/ruins/Exit_SK-HotSuspense_Open_75.schematic index b658c79..e5fd15b 100644 Binary files a/src/main/resources/schematics/ruins/Exit_SK-HotSuspense_Open_75.schematic and b/src/main/resources/schematics/ruins/Exit_SK-HotSuspense_Open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/Exit_SK-LockingExitTrap_Closed_50.schematic b/src/main/resources/schematics/ruins/Exit_SK-LockingExitTrap_Closed_50.schematic index e9bed7c..496d4cd 100644 Binary files a/src/main/resources/schematics/ruins/Exit_SK-LockingExitTrap_Closed_50.schematic and b/src/main/resources/schematics/ruins/Exit_SK-LockingExitTrap_Closed_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Exit_XombyCraft-RopeBridge_Open_100.schematic b/src/main/resources/schematics/ruins/Exit_XombyCraft-RopeBridge_Open_100.schematic index d427889..590b3c4 100644 Binary files a/src/main/resources/schematics/ruins/Exit_XombyCraft-RopeBridge_Open_100.schematic and b/src/main/resources/schematics/ruins/Exit_XombyCraft-RopeBridge_Open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/Hub_Balgor0-OmniMaze_Open_50.schematic b/src/main/resources/schematics/ruins/Hub_Balgor0-OmniMaze_Open_50.schematic index 077e4e7..56aa639 100644 Binary files a/src/main/resources/schematics/ruins/Hub_Balgor0-OmniMaze_Open_50.schematic and b/src/main/resources/schematics/ruins/Hub_Balgor0-OmniMaze_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Hub_Cere-GreatHall_Open_40.schematic b/src/main/resources/schematics/ruins/Hub_Cere-GreatHall_Open_40.schematic index e639e58..4f9f440 100644 Binary files a/src/main/resources/schematics/ruins/Hub_Cere-GreatHall_Open_40.schematic and b/src/main/resources/schematics/ruins/Hub_Cere-GreatHall_Open_40.schematic differ diff --git a/src/main/resources/schematics/ruins/Hub_SK-Claustrophobia_Open_40.schematic b/src/main/resources/schematics/ruins/Hub_SK-Claustrophobia_Open_40.schematic index c0471be..b64e031 100644 Binary files a/src/main/resources/schematics/ruins/Hub_SK-Claustrophobia_Open_40.schematic and b/src/main/resources/schematics/ruins/Hub_SK-Claustrophobia_Open_40.schematic differ diff --git a/src/main/resources/schematics/ruins/Hub_SK-FractalCage_Open_40.schematic b/src/main/resources/schematics/ruins/Hub_SK-FractalCage_Open_40.schematic index d66f82a..b6d1279 100644 Binary files a/src/main/resources/schematics/ruins/Hub_SK-FractalCage_Open_40.schematic and b/src/main/resources/schematics/ruins/Hub_SK-FractalCage_Open_40.schematic differ diff --git a/src/main/resources/schematics/ruins/Hub_SK-HeartOfDisorder_Open_50.schematic b/src/main/resources/schematics/ruins/Hub_SK-HeartOfDisorder_Open_50.schematic index ab5e68e..b376e70 100644 Binary files a/src/main/resources/schematics/ruins/Hub_SK-HeartOfDisorder_Open_50.schematic and b/src/main/resources/schematics/ruins/Hub_SK-HeartOfDisorder_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Hub_SK-RandomSnow_Open_75.schematic b/src/main/resources/schematics/ruins/Hub_SK-RandomSnow_Open_75.schematic index 5a4a0ce..5f2497e 100644 Binary files a/src/main/resources/schematics/ruins/Hub_SK-RandomSnow_Open_75.schematic and b/src/main/resources/schematics/ruins/Hub_SK-RandomSnow_Open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/Hub_SK-RandomSwamp_Open_75.schematic b/src/main/resources/schematics/ruins/Hub_SK-RandomSwamp_Open_75.schematic index b3a086e..af31d90 100644 Binary files a/src/main/resources/schematics/ruins/Hub_SK-RandomSwamp_Open_75.schematic and b/src/main/resources/schematics/ruins/Hub_SK-RandomSwamp_Open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/Hub_SK-TheNexus_Open_40.schematic b/src/main/resources/schematics/ruins/Hub_SK-TheNexus_Open_40.schematic index 572dbc9..ab6c856 100644 Binary files a/src/main/resources/schematics/ruins/Hub_SK-TheNexus_Open_40.schematic and b/src/main/resources/schematics/ruins/Hub_SK-TheNexus_Open_40.schematic differ diff --git a/src/main/resources/schematics/ruins/SimpleHall_SK-LeftDownStairs_Open_50.schematic b/src/main/resources/schematics/ruins/SimpleHall_SK-LeftDownStairs_Open_50.schematic index 5ae15e7..2c6bacf 100644 Binary files a/src/main/resources/schematics/ruins/SimpleHall_SK-LeftDownStairs_Open_50.schematic and b/src/main/resources/schematics/ruins/SimpleHall_SK-LeftDownStairs_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/SimpleHall_SK-LeftUpPath_Open_50.schematic b/src/main/resources/schematics/ruins/SimpleHall_SK-LeftUpPath_Open_50.schematic index e63b1e7..097b323 100644 Binary files a/src/main/resources/schematics/ruins/SimpleHall_SK-LeftUpPath_Open_50.schematic and b/src/main/resources/schematics/ruins/SimpleHall_SK-LeftUpPath_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/SimpleHall_SK-RightDownStairs_Open_50.schematic b/src/main/resources/schematics/ruins/SimpleHall_SK-RightDownStairs_Open_50.schematic index a42b476..ce1ed6a 100644 Binary files a/src/main/resources/schematics/ruins/SimpleHall_SK-RightDownStairs_Open_50.schematic and b/src/main/resources/schematics/ruins/SimpleHall_SK-RightDownStairs_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/SimpleHall_SK-RightUpPath_Open_50.schematic b/src/main/resources/schematics/ruins/SimpleHall_SK-RightUpPath_Open_50.schematic index 783dc45..2f5de5e 100644 Binary files a/src/main/resources/schematics/ruins/SimpleHall_SK-RightUpPath_Open_50.schematic and b/src/main/resources/schematics/ruins/SimpleHall_SK-RightUpPath_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/SimpleHall_SK-SpiralHallway_Open_100.schematic b/src/main/resources/schematics/ruins/SimpleHall_SK-SpiralHallway_Open_100.schematic index 417191f..59772ee 100644 Binary files a/src/main/resources/schematics/ruins/SimpleHall_SK-SpiralHallway_Open_100.schematic and b/src/main/resources/schematics/ruins/SimpleHall_SK-SpiralHallway_Open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/SimpleHall_SK-UTurnLeft_Open_50.schematic b/src/main/resources/schematics/ruins/SimpleHall_SK-UTurnLeft_Open_50.schematic index f363a13..a9ad157 100644 Binary files a/src/main/resources/schematics/ruins/SimpleHall_SK-UTurnLeft_Open_50.schematic and b/src/main/resources/schematics/ruins/SimpleHall_SK-UTurnLeft_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/SimpleHall_SK-UTurnRight_Open_50.schematic b/src/main/resources/schematics/ruins/SimpleHall_SK-UTurnRight_Open_50.schematic index cc180b4..15d19bf 100644 Binary files a/src/main/resources/schematics/ruins/SimpleHall_SK-UTurnRight_Open_50.schematic and b/src/main/resources/schematics/ruins/SimpleHall_SK-UTurnRight_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/SimpleHall_SK-WatchedForkLeft_Closed_80.schematic b/src/main/resources/schematics/ruins/SimpleHall_SK-WatchedForkLeft_Closed_80.schematic index 4601cc0..5700805 100644 Binary files a/src/main/resources/schematics/ruins/SimpleHall_SK-WatchedForkLeft_Closed_80.schematic and b/src/main/resources/schematics/ruins/SimpleHall_SK-WatchedForkLeft_Closed_80.schematic differ diff --git a/src/main/resources/schematics/ruins/SimpleHall_SK-WatchedForkRight_Closed_80.schematic b/src/main/resources/schematics/ruins/SimpleHall_SK-WatchedForkRight_Closed_80.schematic index d5be666..b29e24e 100644 Binary files a/src/main/resources/schematics/ruins/SimpleHall_SK-WatchedForkRight_Closed_80.schematic and b/src/main/resources/schematics/ruins/SimpleHall_SK-WatchedForkRight_Closed_80.schematic differ diff --git a/src/main/resources/schematics/ruins/Trap_SK-FakeTNTTrap-B_Closed_50.schematic b/src/main/resources/schematics/ruins/Trap_SK-FakeTNTTrap-B_Closed_50.schematic index c2a5b17..da75950 100644 Binary files a/src/main/resources/schematics/ruins/Trap_SK-FakeTNTTrap-B_Closed_50.schematic and b/src/main/resources/schematics/ruins/Trap_SK-FakeTNTTrap-B_Closed_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Trap_SK-NicolesTower_Open_50.schematic b/src/main/resources/schematics/ruins/Trap_SK-NicolesTower_Open_50.schematic index ce43da5..94dc562 100644 Binary files a/src/main/resources/schematics/ruins/Trap_SK-NicolesTower_Open_50.schematic and b/src/main/resources/schematics/ruins/Trap_SK-NicolesTower_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Trap_SK-RaceTheLight_Closed_50.schematic b/src/main/resources/schematics/ruins/Trap_SK-RaceTheLight_Closed_50.schematic index 8206a43..523e533 100644 Binary files a/src/main/resources/schematics/ruins/Trap_SK-RaceTheLight_Closed_50.schematic and b/src/main/resources/schematics/ruins/Trap_SK-RaceTheLight_Closed_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Trap_SK-RestlessCorridor_Open_40.schematic b/src/main/resources/schematics/ruins/Trap_SK-RestlessCorridor_Open_40.schematic index 99a5ebf..6e7ca2a 100644 Binary files a/src/main/resources/schematics/ruins/Trap_SK-RestlessCorridor_Open_40.schematic and b/src/main/resources/schematics/ruins/Trap_SK-RestlessCorridor_Open_40.schematic differ diff --git a/src/main/resources/schematics/ruins/Trap_SK-SimpleLeftTrap_Closed_50.schematic b/src/main/resources/schematics/ruins/Trap_SK-SimpleLeftTrap_Closed_50.schematic index cc8efed..1957677 100644 Binary files a/src/main/resources/schematics/ruins/Trap_SK-SimpleLeftTrap_Closed_50.schematic and b/src/main/resources/schematics/ruins/Trap_SK-SimpleLeftTrap_Closed_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Trap_SK-SimpleRightTrap_Closed_50.schematic b/src/main/resources/schematics/ruins/Trap_SK-SimpleRightTrap_Closed_50.schematic index 7fc1d34..2c27928 100644 Binary files a/src/main/resources/schematics/ruins/Trap_SK-SimpleRightTrap_Closed_50.schematic and b/src/main/resources/schematics/ruins/Trap_SK-SimpleRightTrap_Closed_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Trap_SK-TrappedStairsDown_Closed_50.schematic b/src/main/resources/schematics/ruins/Trap_SK-TrappedStairsDown_Closed_50.schematic index df11dad..f6bce82 100644 Binary files a/src/main/resources/schematics/ruins/Trap_SK-TrappedStairsDown_Closed_50.schematic and b/src/main/resources/schematics/ruins/Trap_SK-TrappedStairsDown_Closed_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Trap_SK-TrappedStairsUp_Closed_50.schematic b/src/main/resources/schematics/ruins/Trap_SK-TrappedStairsUp_Closed_50.schematic index ab1d150..bfb7bdd 100644 Binary files a/src/main/resources/schematics/ruins/Trap_SK-TrappedStairsUp_Closed_50.schematic and b/src/main/resources/schematics/ruins/Trap_SK-TrappedStairsUp_Closed_50.schematic differ diff --git a/src/main/resources/schematics/ruins/Trap_SK-UTrapRight_Open_50.schematic b/src/main/resources/schematics/ruins/Trap_SK-UTrapRight_Open_50.schematic index 79c0005..3ba8ebd 100644 Binary files a/src/main/resources/schematics/ruins/Trap_SK-UTrapRight_Open_50.schematic and b/src/main/resources/schematics/ruins/Trap_SK-UTrapRight_Open_50.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_buggyTopEntry1_open_100.schematic b/src/main/resources/schematics/ruins/complexHall_buggyTopEntry1_open_100.schematic index 6da42a7..8d70849 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_buggyTopEntry1_open_100.schematic and b/src/main/resources/schematics/ruins/complexHall_buggyTopEntry1_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_exitRuinsWithHiddenDoor_open_100.schematic b/src/main/resources/schematics/ruins/complexHall_exitRuinsWithHiddenDoor_open_100.schematic index e18f8e7..9884a03 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_exitRuinsWithHiddenDoor_open_100.schematic and b/src/main/resources/schematics/ruins/complexHall_exitRuinsWithHiddenDoor_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_hallwayHiddenTreasure_closed_100.schematic b/src/main/resources/schematics/ruins/complexHall_hallwayHiddenTreasure_closed_100.schematic index 0edc59d..7baa6e5 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_hallwayHiddenTreasure_closed_100.schematic and b/src/main/resources/schematics/ruins/complexHall_hallwayHiddenTreasure_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_largeBrokenHall_closed_100.schematic b/src/main/resources/schematics/ruins/complexHall_largeBrokenHall_closed_100.schematic index a2ccc3f..a23e892 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_largeBrokenHall_closed_100.schematic and b/src/main/resources/schematics/ruins/complexHall_largeBrokenHall_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_mediumPillarStairs_open_100.schematic b/src/main/resources/schematics/ruins/complexHall_mediumPillarStairs_open_100.schematic index 5470f3c..cf48047 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_mediumPillarStairs_open_100.schematic and b/src/main/resources/schematics/ruins/complexHall_mediumPillarStairs_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_pitStairs_open_100.schematic b/src/main/resources/schematics/ruins/complexHall_pitStairs_open_100.schematic index 74effb4..b8761de 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_pitStairs_open_100.schematic and b/src/main/resources/schematics/ruins/complexHall_pitStairs_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_ruinsO_open_100.schematic b/src/main/resources/schematics/ruins/complexHall_ruinsO_open_100.schematic index f89fd2a..d919619 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_ruinsO_open_100.schematic and b/src/main/resources/schematics/ruins/complexHall_ruinsO_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_smallBranchWithExit_closed_100.schematic b/src/main/resources/schematics/ruins/complexHall_smallBranchWithExit_closed_100.schematic index 37a9c09..e9f01c7 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_smallBranchWithExit_closed_100.schematic and b/src/main/resources/schematics/ruins/complexHall_smallBranchWithExit_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_smallRotundaWithExit_closed_100.schematic b/src/main/resources/schematics/ruins/complexHall_smallRotundaWithExit_closed_100.schematic index 6321186..71451d6 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_smallRotundaWithExit_closed_100.schematic and b/src/main/resources/schematics/ruins/complexHall_smallRotundaWithExit_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/complexHall_tntPuzzleTrap_closed_50.schematic b/src/main/resources/schematics/ruins/complexHall_tntPuzzleTrap_closed_50.schematic index c0aa954..b808dd1 100644 Binary files a/src/main/resources/schematics/ruins/complexHall_tntPuzzleTrap_closed_50.schematic and b/src/main/resources/schematics/ruins/complexHall_tntPuzzleTrap_closed_50.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_azersDungeonO_closed_100.schematic b/src/main/resources/schematics/ruins/deadEnd_azersDungeonO_closed_100.schematic index b18fe71..2de4729 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_azersDungeonO_closed_100.schematic and b/src/main/resources/schematics/ruins/deadEnd_azersDungeonO_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_brokenPillarsO_open_100.schematic b/src/main/resources/schematics/ruins/deadEnd_brokenPillarsO_open_100.schematic index ffeb507..0e3fc1d 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_brokenPillarsO_open_100.schematic and b/src/main/resources/schematics/ruins/deadEnd_brokenPillarsO_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_diamondTowerTemple1_open_100.schematic b/src/main/resources/schematics/ruins/deadEnd_diamondTowerTemple1_open_100.schematic index d05cb34..df8188a 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_diamondTowerTemple1_open_100.schematic and b/src/main/resources/schematics/ruins/deadEnd_diamondTowerTemple1_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_fallingTrapO_open_100.schematic b/src/main/resources/schematics/ruins/deadEnd_fallingTrapO_open_100.schematic index 58da1a8..410ba3e 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_fallingTrapO_open_100.schematic and b/src/main/resources/schematics/ruins/deadEnd_fallingTrapO_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_hiddenStaircaseO_open_100.schematic b/src/main/resources/schematics/ruins/deadEnd_hiddenStaircaseO_open_100.schematic index ae42008..9d47bbf 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_hiddenStaircaseO_open_100.schematic and b/src/main/resources/schematics/ruins/deadEnd_hiddenStaircaseO_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_lavaTrapO_open_100.schematic b/src/main/resources/schematics/ruins/deadEnd_lavaTrapO_open_100.schematic index fc1fc84..b253a40 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_lavaTrapO_open_100.schematic and b/src/main/resources/schematics/ruins/deadEnd_lavaTrapO_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_randomTree_open_75.schematic b/src/main/resources/schematics/ruins/deadEnd_randomTree_open_75.schematic index 8176701..07b5ace 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_randomTree_open_75.schematic and b/src/main/resources/schematics/ruins/deadEnd_randomTree_open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_smallDesert_open_75.schematic b/src/main/resources/schematics/ruins/deadEnd_smallDesert_open_75.schematic index 9a39dc5..390935a 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_smallDesert_open_75.schematic and b/src/main/resources/schematics/ruins/deadEnd_smallDesert_open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_smallHiddenTowerO_open_100.schematic b/src/main/resources/schematics/ruins/deadEnd_smallHiddenTowerO_open_100.schematic index 7d9acdb..912585f 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_smallHiddenTowerO_open_100.schematic and b/src/main/resources/schematics/ruins/deadEnd_smallHiddenTowerO_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_smallPond_open_75.schematic b/src/main/resources/schematics/ruins/deadEnd_smallPond_open_75.schematic index 48e606e..c4234ba 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_smallPond_open_75.schematic and b/src/main/resources/schematics/ruins/deadEnd_smallPond_open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_smallSilverfishRoom_closed_100.schematic b/src/main/resources/schematics/ruins/deadEnd_smallSilverfishRoom_closed_100.schematic index 12a22f6..a677550 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_smallSilverfishRoom_closed_100.schematic and b/src/main/resources/schematics/ruins/deadEnd_smallSilverfishRoom_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/deadEnd_tntTrapO_open_100.schematic b/src/main/resources/schematics/ruins/deadEnd_tntTrapO_open_100.schematic index 82c5ee0..fbfed73 100644 Binary files a/src/main/resources/schematics/ruins/deadEnd_tntTrapO_open_100.schematic and b/src/main/resources/schematics/ruins/deadEnd_tntTrapO_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/exit_exitCube_open_100.schematic b/src/main/resources/schematics/ruins/exit_exitCube_open_100.schematic index a023fdb..8bc228a 100644 Binary files a/src/main/resources/schematics/ruins/exit_exitCube_open_100.schematic and b/src/main/resources/schematics/ruins/exit_exitCube_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/exit_lockingExitHall_closed_100.schematic b/src/main/resources/schematics/ruins/exit_lockingExitHall_closed_100.schematic index a1c5576..4006765 100644 Binary files a/src/main/resources/schematics/ruins/exit_lockingExitHall_closed_100.schematic and b/src/main/resources/schematics/ruins/exit_lockingExitHall_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/exit_smallExitPrison_open_100.schematic b/src/main/resources/schematics/ruins/exit_smallExitPrison_open_100.schematic index 39cf65d..ba3ae26 100644 Binary files a/src/main/resources/schematics/ruins/exit_smallExitPrison_open_100.schematic and b/src/main/resources/schematics/ruins/exit_smallExitPrison_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/hub_4WayBasicHall_closed_200.schematic b/src/main/resources/schematics/ruins/hub_4WayBasicHall_closed_200.schematic index f89311c..617995d 100644 Binary files a/src/main/resources/schematics/ruins/hub_4WayBasicHall_closed_200.schematic and b/src/main/resources/schematics/ruins/hub_4WayBasicHall_closed_200.schematic differ diff --git a/src/main/resources/schematics/ruins/hub_4WayHallExit_closed_200.schematic b/src/main/resources/schematics/ruins/hub_4WayHallExit_closed_200.schematic index cfed38e..8326e88 100644 Binary files a/src/main/resources/schematics/ruins/hub_4WayHallExit_closed_200.schematic and b/src/main/resources/schematics/ruins/hub_4WayHallExit_closed_200.schematic differ diff --git a/src/main/resources/schematics/ruins/hub_doorTotemRuins_open_100.schematic b/src/main/resources/schematics/ruins/hub_doorTotemRuins_open_100.schematic index 820fd50..336d71b 100644 Binary files a/src/main/resources/schematics/ruins/hub_doorTotemRuins_open_100.schematic and b/src/main/resources/schematics/ruins/hub_doorTotemRuins_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/hub_fortRuins_open_100.schematic b/src/main/resources/schematics/ruins/hub_fortRuins_open_100.schematic index 11ce023..f08bf49 100644 Binary files a/src/main/resources/schematics/ruins/hub_fortRuins_open_100.schematic and b/src/main/resources/schematics/ruins/hub_fortRuins_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/hub_hallwayTrapRooms1_closed_100.schematic b/src/main/resources/schematics/ruins/hub_hallwayTrapRooms1_closed_100.schematic index 6fcd735..dfa00e9 100644 Binary files a/src/main/resources/schematics/ruins/hub_hallwayTrapRooms1_closed_100.schematic and b/src/main/resources/schematics/ruins/hub_hallwayTrapRooms1_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/hub_longDoorHallway_closed_100.schematic b/src/main/resources/schematics/ruins/hub_longDoorHallway_closed_100.schematic index 84ebdd5..ddac61f 100644 Binary files a/src/main/resources/schematics/ruins/hub_longDoorHallway_closed_100.schematic and b/src/main/resources/schematics/ruins/hub_longDoorHallway_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/hub_smallMultilevelMaze_closed_100.schematic b/src/main/resources/schematics/ruins/hub_smallMultilevelMaze_closed_100.schematic index 333eec8..91882e9 100644 Binary files a/src/main/resources/schematics/ruins/hub_smallMultilevelMaze_closed_100.schematic and b/src/main/resources/schematics/ruins/hub_smallMultilevelMaze_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/maze_smallMaze1_closed_100.schematic b/src/main/resources/schematics/ruins/maze_smallMaze1_closed_100.schematic index 1e22232..b15abe5 100644 Binary files a/src/main/resources/schematics/ruins/maze_smallMaze1_closed_100.schematic and b/src/main/resources/schematics/ruins/maze_smallMaze1_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/simpleHall_collapsedSingleTunnel1_closed_100.schematic b/src/main/resources/schematics/ruins/simpleHall_collapsedSingleTunnel1_closed_100.schematic index 9a74344..0bb4667 100644 Binary files a/src/main/resources/schematics/ruins/simpleHall_collapsedSingleTunnel1_closed_100.schematic and b/src/main/resources/schematics/ruins/simpleHall_collapsedSingleTunnel1_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/simpleHall_simpleDropHall_closed_100.schematic b/src/main/resources/schematics/ruins/simpleHall_simpleDropHall_closed_100.schematic index d8071e2..bec5a38 100644 Binary files a/src/main/resources/schematics/ruins/simpleHall_simpleDropHall_closed_100.schematic and b/src/main/resources/schematics/ruins/simpleHall_simpleDropHall_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/simpleHall_simpleSmallT1_closed_100.schematic b/src/main/resources/schematics/ruins/simpleHall_simpleSmallT1_closed_100.schematic index 0f985ea..6eb2cd0 100644 Binary files a/src/main/resources/schematics/ruins/simpleHall_simpleSmallT1_closed_100.schematic and b/src/main/resources/schematics/ruins/simpleHall_simpleSmallT1_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/simpleHall_simpleStairsDown_closed_100.schematic b/src/main/resources/schematics/ruins/simpleHall_simpleStairsDown_closed_100.schematic index 9293334..2b967b1 100644 Binary files a/src/main/resources/schematics/ruins/simpleHall_simpleStairsDown_closed_100.schematic and b/src/main/resources/schematics/ruins/simpleHall_simpleStairsDown_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/simpleHall_simpleStairsUp_closed_100.schematic b/src/main/resources/schematics/ruins/simpleHall_simpleStairsUp_closed_100.schematic index 6dbaeb0..844a2e2 100644 Binary files a/src/main/resources/schematics/ruins/simpleHall_simpleStairsUp_closed_100.schematic and b/src/main/resources/schematics/ruins/simpleHall_simpleStairsUp_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/simpleHall_singleStraightHall1_closed_100.schematic b/src/main/resources/schematics/ruins/simpleHall_singleStraightHall1_closed_100.schematic index 989c30d..ba7d7bf 100644 Binary files a/src/main/resources/schematics/ruins/simpleHall_singleStraightHall1_closed_100.schematic and b/src/main/resources/schematics/ruins/simpleHall_singleStraightHall1_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/simpleHall_smallSimpleLeft_closed_100.schematic b/src/main/resources/schematics/ruins/simpleHall_smallSimpleLeft_closed_100.schematic index bc6a78a..79992a7 100644 Binary files a/src/main/resources/schematics/ruins/simpleHall_smallSimpleLeft_closed_100.schematic and b/src/main/resources/schematics/ruins/simpleHall_smallSimpleLeft_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/simpleHall_smallSimpleRight_closed_100.schematic b/src/main/resources/schematics/ruins/simpleHall_smallSimpleRight_closed_100.schematic index 1d45820..58d89b4 100644 Binary files a/src/main/resources/schematics/ruins/simpleHall_smallSimpleRight_closed_100.schematic and b/src/main/resources/schematics/ruins/simpleHall_smallSimpleRight_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_fakeTNTTrap_closed_100.schematic b/src/main/resources/schematics/ruins/trap_fakeTNTTrap_closed_100.schematic index 8cfd92f..f48d3a0 100644 Binary files a/src/main/resources/schematics/ruins/trap_fakeTNTTrap_closed_100.schematic and b/src/main/resources/schematics/ruins/trap_fakeTNTTrap_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_hallwayPitFallTrap_closed_200.schematic b/src/main/resources/schematics/ruins/trap_hallwayPitFallTrap_closed_200.schematic index 4f878be..5b94778 100644 Binary files a/src/main/resources/schematics/ruins/trap_hallwayPitFallTrap_closed_200.schematic and b/src/main/resources/schematics/ruins/trap_hallwayPitFallTrap_closed_200.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_lavaPyramid_open_100.schematic b/src/main/resources/schematics/ruins/trap_lavaPyramid_open_100.schematic index 2291949..d9876f0 100644 Binary files a/src/main/resources/schematics/ruins/trap_lavaPyramid_open_100.schematic and b/src/main/resources/schematics/ruins/trap_lavaPyramid_open_100.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_pistonFallRuins_open_75.schematic b/src/main/resources/schematics/ruins/trap_pistonFallRuins_open_75.schematic index 0ed8a39..89aeb66 100644 Binary files a/src/main/resources/schematics/ruins/trap_pistonFallRuins_open_75.schematic and b/src/main/resources/schematics/ruins/trap_pistonFallRuins_open_75.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_pistonFloorHall_closed_150.schematic b/src/main/resources/schematics/ruins/trap_pistonFloorHall_closed_150.schematic index 0446077..ad132b4 100644 Binary files a/src/main/resources/schematics/ruins/trap_pistonFloorHall_closed_150.schematic and b/src/main/resources/schematics/ruins/trap_pistonFloorHall_closed_150.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_pistonFloorPlatform2_closed_100.schematic b/src/main/resources/schematics/ruins/trap_pistonFloorPlatform2_closed_100.schematic index 9cef5ac..cc33744 100644 Binary files a/src/main/resources/schematics/ruins/trap_pistonFloorPlatform2_closed_100.schematic and b/src/main/resources/schematics/ruins/trap_pistonFloorPlatform2_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_pistonFloorPlatform_closed_100.schematic b/src/main/resources/schematics/ruins/trap_pistonFloorPlatform_closed_100.schematic index dcae5ce..1a2d757 100644 Binary files a/src/main/resources/schematics/ruins/trap_pistonFloorPlatform_closed_100.schematic and b/src/main/resources/schematics/ruins/trap_pistonFloorPlatform_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_pistonHallway_closed_100.schematic b/src/main/resources/schematics/ruins/trap_pistonHallway_closed_100.schematic index e7b891e..f8efdc3 100644 Binary files a/src/main/resources/schematics/ruins/trap_pistonHallway_closed_100.schematic and b/src/main/resources/schematics/ruins/trap_pistonHallway_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_pistonSmasherHall_closed_100.schematic b/src/main/resources/schematics/ruins/trap_pistonSmasherHall_closed_100.schematic index 92d7fb5..a2ee7f1 100644 Binary files a/src/main/resources/schematics/ruins/trap_pistonSmasherHall_closed_100.schematic and b/src/main/resources/schematics/ruins/trap_pistonSmasherHall_closed_100.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_raceTheTNTHall_closed_1.schematic b/src/main/resources/schematics/ruins/trap_raceTheTNTHall_closed_1.schematic index b3489e2..01ba26c 100644 Binary files a/src/main/resources/schematics/ruins/trap_raceTheTNTHall_closed_1.schematic and b/src/main/resources/schematics/ruins/trap_raceTheTNTHall_closed_1.schematic differ diff --git a/src/main/resources/schematics/ruins/trap_wallFallcomboPistonHall_closed_200.schematic b/src/main/resources/schematics/ruins/trap_wallFallcomboPistonHall_closed_200.schematic index 1be3b92..f1a58c4 100644 Binary files a/src/main/resources/schematics/ruins/trap_wallFallcomboPistonHall_closed_200.schematic and b/src/main/resources/schematics/ruins/trap_wallFallcomboPistonHall_closed_200.schematic differ