Created build.gradle
Restructured folder structure for ForgeGradle Signed-off-by: deathrat <deathrat43@gmail.com>
This commit is contained in:
@@ -0,0 +1,412 @@
|
||||
package StevenDimDoors.mod_pocketDim.helpers;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BlockRotationHelper
|
||||
{
|
||||
public HashMap<Integer,HashMap<Integer,HashMap<Integer,Integer>>> rotationMappings = new HashMap<Integer,HashMap<Integer,HashMap<Integer,Integer>>>();
|
||||
|
||||
public BlockRotationHelper()
|
||||
{
|
||||
this.InitializeRotationMap();
|
||||
}
|
||||
|
||||
public void InitializeRotationMap()
|
||||
{
|
||||
HashMap<Integer,HashMap<Integer, Integer>> orientation0 = new HashMap<Integer,HashMap<Integer, Integer>>();
|
||||
|
||||
HashMap<Integer,Integer> stairs0 = new HashMap<Integer,Integer>();
|
||||
|
||||
stairs0.put(0, 2);
|
||||
stairs0.put(1, 3);
|
||||
stairs0.put(2, 1);
|
||||
stairs0.put(3, 0);
|
||||
stairs0.put(7, 4);
|
||||
stairs0.put(6, 5);
|
||||
stairs0.put(5, 7);
|
||||
stairs0.put(4, 6);
|
||||
|
||||
HashMap<Integer,Integer> chestsLadders0 = new HashMap<Integer,Integer>();
|
||||
|
||||
chestsLadders0.put(2, 5);
|
||||
chestsLadders0.put(3, 4);
|
||||
chestsLadders0.put(4, 2);
|
||||
chestsLadders0.put(5, 3);
|
||||
|
||||
HashMap<Integer,Integer> vine0 = new HashMap<Integer,Integer>();
|
||||
|
||||
vine0.put(1, 2);
|
||||
vine0.put(2, 4);
|
||||
vine0.put(4, 8);
|
||||
vine0.put(8, 1);
|
||||
|
||||
HashMap<Integer,Integer> leverButtonTorch0 = new HashMap<Integer,Integer>();
|
||||
|
||||
leverButtonTorch0.put(12, 9);
|
||||
leverButtonTorch0.put(11, 10);
|
||||
leverButtonTorch0.put(10, 12);
|
||||
leverButtonTorch0.put(9, 11);
|
||||
leverButtonTorch0.put(2, 4);
|
||||
leverButtonTorch0.put(3, 2);
|
||||
leverButtonTorch0.put(1, 3);
|
||||
leverButtonTorch0.put(4, 1);
|
||||
|
||||
HashMap<Integer,Integer> pistonDropperDispenser0 = new HashMap<Integer,Integer>();
|
||||
|
||||
pistonDropperDispenser0.put(4, 2);
|
||||
pistonDropperDispenser0.put(5, 3);
|
||||
pistonDropperDispenser0.put(13, 11);
|
||||
pistonDropperDispenser0.put(3, 4);
|
||||
pistonDropperDispenser0.put(2, 5);
|
||||
pistonDropperDispenser0.put(11, 12);
|
||||
pistonDropperDispenser0.put(10, 13);
|
||||
pistonDropperDispenser0.put(12, 10);
|
||||
|
||||
HashMap<Integer,Integer> repeaterComparatorDoorTripwire0 = new HashMap<Integer,Integer>();
|
||||
|
||||
repeaterComparatorDoorTripwire0.put(0, 1);
|
||||
repeaterComparatorDoorTripwire0.put(1, 2);
|
||||
repeaterComparatorDoorTripwire0.put(2, 3);
|
||||
repeaterComparatorDoorTripwire0.put(3, 0);
|
||||
repeaterComparatorDoorTripwire0.put(4, 5);
|
||||
repeaterComparatorDoorTripwire0.put(5, 6);
|
||||
repeaterComparatorDoorTripwire0.put(6, 7);
|
||||
repeaterComparatorDoorTripwire0.put(7, 4);
|
||||
repeaterComparatorDoorTripwire0.put(8, 9);
|
||||
repeaterComparatorDoorTripwire0.put(9, 10);
|
||||
repeaterComparatorDoorTripwire0.put(10, 11);
|
||||
repeaterComparatorDoorTripwire0.put(11, 8);
|
||||
repeaterComparatorDoorTripwire0.put(12, 13);
|
||||
repeaterComparatorDoorTripwire0.put(13, 14);
|
||||
repeaterComparatorDoorTripwire0.put(14, 15);
|
||||
repeaterComparatorDoorTripwire0.put(15, 12);
|
||||
|
||||
HashMap<Integer,Integer> rails0 = new HashMap<Integer,Integer>();
|
||||
rails0.put(0, 1);
|
||||
rails0.put(1, 0);
|
||||
rails0.put(8, 9);
|
||||
rails0.put(9, 6);
|
||||
rails0.put(6, 7);
|
||||
rails0.put(7, 8);
|
||||
|
||||
|
||||
HashMap<Integer,Integer> railsSpecial0 = new HashMap<Integer,Integer>();
|
||||
railsSpecial0.put(0, 1);
|
||||
railsSpecial0.put(1, 0);
|
||||
railsSpecial0.put(8, 9);
|
||||
railsSpecial0.put(9, 8);
|
||||
|
||||
|
||||
HashMap<Integer,HashMap<Integer, Integer>> orientation1 = new HashMap<Integer,HashMap<Integer, Integer>>();
|
||||
|
||||
HashMap<Integer,Integer> stairs1 = new HashMap<Integer,Integer>();
|
||||
|
||||
stairs1.put(0, 1);
|
||||
stairs1.put(1, 0);
|
||||
stairs1.put(2, 3);
|
||||
stairs1.put(3, 2);
|
||||
stairs1.put(7, 6);
|
||||
stairs1.put(6, 7);
|
||||
stairs1.put(5, 4);
|
||||
stairs1.put(4, 5);
|
||||
|
||||
HashMap<Integer,Integer> chestsLadders1 = new HashMap<Integer,Integer>();
|
||||
|
||||
chestsLadders1.put(2, 3);
|
||||
chestsLadders1.put(3, 2);
|
||||
chestsLadders1.put(4, 5);
|
||||
chestsLadders1.put(5, 4);
|
||||
|
||||
HashMap<Integer,Integer> vine1 = new HashMap<Integer,Integer>();
|
||||
|
||||
vine1.put(1, 4);
|
||||
vine1.put(2, 8);
|
||||
vine1.put(4, 1);
|
||||
vine1.put(8, 2);
|
||||
|
||||
HashMap<Integer,Integer> leverButtonTorch1 = new HashMap<Integer,Integer>();
|
||||
|
||||
leverButtonTorch1.put(12, 9);
|
||||
leverButtonTorch1.put(11, 10);
|
||||
leverButtonTorch1.put(10, 12);
|
||||
leverButtonTorch1.put(9, 11);
|
||||
leverButtonTorch1.put(2, 4);
|
||||
leverButtonTorch1.put(3, 2);
|
||||
leverButtonTorch1.put(1, 3);
|
||||
leverButtonTorch1.put(4, 1);
|
||||
|
||||
HashMap<Integer,Integer> pistonDropperDispenser1 = new HashMap<Integer,Integer>();
|
||||
|
||||
pistonDropperDispenser1.put(12, 11);
|
||||
pistonDropperDispenser1.put(11, 12);
|
||||
pistonDropperDispenser1.put(10, 9);
|
||||
pistonDropperDispenser1.put(9, 10);
|
||||
pistonDropperDispenser1.put(2, 1);
|
||||
pistonDropperDispenser1.put(3, 4);
|
||||
pistonDropperDispenser1.put(1, 2);
|
||||
pistonDropperDispenser1.put(4,3);
|
||||
|
||||
|
||||
HashMap<Integer,Integer> repeaterComparatorDoorTripwire1 = new HashMap<Integer,Integer>();
|
||||
|
||||
repeaterComparatorDoorTripwire1.put(0, 2);
|
||||
repeaterComparatorDoorTripwire1.put(1, 3);
|
||||
repeaterComparatorDoorTripwire1.put(2, 0);
|
||||
repeaterComparatorDoorTripwire1.put(3, 1);
|
||||
repeaterComparatorDoorTripwire1.put(4, 6);
|
||||
repeaterComparatorDoorTripwire1.put(5, 7);
|
||||
repeaterComparatorDoorTripwire1.put(6, 4);
|
||||
repeaterComparatorDoorTripwire1.put(7, 5);
|
||||
repeaterComparatorDoorTripwire1.put(8, 10);
|
||||
repeaterComparatorDoorTripwire1.put(9, 11);
|
||||
repeaterComparatorDoorTripwire1.put(10, 8);
|
||||
repeaterComparatorDoorTripwire1.put(11, 9);
|
||||
repeaterComparatorDoorTripwire1.put(12, 14);
|
||||
repeaterComparatorDoorTripwire1.put(13, 15);
|
||||
repeaterComparatorDoorTripwire1.put(14, 12);
|
||||
repeaterComparatorDoorTripwire1.put(15, 13);
|
||||
|
||||
HashMap<Integer,Integer> rails1 = new HashMap<Integer,Integer>();
|
||||
rails1.put(0, 0);
|
||||
rails1.put(1, 1);
|
||||
rails1.put(8, 6);
|
||||
rails1.put(9, 7);
|
||||
rails1.put(6, 8);
|
||||
rails1.put(7, 9);
|
||||
|
||||
|
||||
HashMap<Integer,Integer> railsSpecial1 = new HashMap<Integer,Integer>();
|
||||
railsSpecial1.put(1, 1);
|
||||
railsSpecial1.put(0, 0);
|
||||
railsSpecial1.put(8, 8);
|
||||
railsSpecial1.put(9, 9);
|
||||
|
||||
HashMap<Integer,HashMap<Integer, Integer>> orientation2 = new HashMap<Integer,HashMap<Integer, Integer>>();
|
||||
|
||||
HashMap<Integer,Integer> stairs2 = new HashMap<Integer,Integer>();
|
||||
|
||||
stairs2.put(2, 0);
|
||||
stairs2.put(3, 1);
|
||||
stairs2.put(1, 2);
|
||||
stairs2.put(0, 3);
|
||||
stairs2.put(4, 7);
|
||||
stairs2.put(5, 6);
|
||||
stairs2.put(7, 5);
|
||||
stairs2.put(6, 4);
|
||||
|
||||
HashMap<Integer,Integer> chestsLadders2 = new HashMap<Integer,Integer>();
|
||||
|
||||
chestsLadders2.put(2, 4);
|
||||
chestsLadders2.put(3, 5);
|
||||
chestsLadders2.put(4, 3);
|
||||
chestsLadders2.put(5, 2);
|
||||
|
||||
HashMap<Integer,Integer> vine2 = new HashMap<Integer,Integer>();
|
||||
|
||||
vine2.put(1, 8);
|
||||
vine2.put(2, 1);
|
||||
vine2.put(4, 2);
|
||||
vine2.put(8, 4);
|
||||
|
||||
HashMap<Integer,Integer> leverButtonTorch2 = new HashMap<Integer,Integer>();
|
||||
|
||||
leverButtonTorch2.put(9, 12);
|
||||
leverButtonTorch2.put(10, 11);
|
||||
leverButtonTorch2.put(12, 10);
|
||||
leverButtonTorch2.put(11, 9);
|
||||
leverButtonTorch2.put(4, 2);
|
||||
leverButtonTorch2.put(2, 3);
|
||||
leverButtonTorch2.put(3, 1);
|
||||
leverButtonTorch2.put(1, 4);
|
||||
|
||||
HashMap<Integer,Integer> pistonDropperDispenser2 = new HashMap<Integer,Integer>();
|
||||
|
||||
pistonDropperDispenser2.put(2, 4);
|
||||
pistonDropperDispenser2.put(3, 5);
|
||||
pistonDropperDispenser2.put(11, 13);
|
||||
pistonDropperDispenser2.put(10, 12);
|
||||
pistonDropperDispenser2.put(4, 3);
|
||||
pistonDropperDispenser2.put(5, 2);
|
||||
pistonDropperDispenser2.put(12, 11);
|
||||
pistonDropperDispenser2.put(13,10);
|
||||
|
||||
|
||||
HashMap<Integer,Integer> repeaterComparatorDoorTripwire2 = new HashMap<Integer,Integer>();
|
||||
|
||||
repeaterComparatorDoorTripwire2.put(1, 0);
|
||||
repeaterComparatorDoorTripwire2.put(2, 1);
|
||||
repeaterComparatorDoorTripwire2.put(3, 2);
|
||||
repeaterComparatorDoorTripwire2.put(0, 3);
|
||||
repeaterComparatorDoorTripwire2.put(5, 4);
|
||||
repeaterComparatorDoorTripwire2.put(6, 5);
|
||||
repeaterComparatorDoorTripwire2.put(7, 6);
|
||||
repeaterComparatorDoorTripwire2.put(4, 7);
|
||||
repeaterComparatorDoorTripwire2.put(9, 8);
|
||||
repeaterComparatorDoorTripwire2.put(10, 9);
|
||||
repeaterComparatorDoorTripwire2.put(11, 10);
|
||||
repeaterComparatorDoorTripwire2.put(8, 11);
|
||||
repeaterComparatorDoorTripwire2.put(13, 12);
|
||||
repeaterComparatorDoorTripwire2.put(14, 13);
|
||||
repeaterComparatorDoorTripwire2.put(15, 14);
|
||||
repeaterComparatorDoorTripwire2.put(12, 15);
|
||||
|
||||
HashMap<Integer,Integer> rails2 = new HashMap<Integer,Integer>();
|
||||
rails2.put(0, 1);
|
||||
rails2.put(1, 0);
|
||||
rails2.put(8, 7);
|
||||
rails2.put(9, 8);
|
||||
rails2.put(6, 9);
|
||||
rails2.put(7, 6);
|
||||
|
||||
|
||||
HashMap<Integer,Integer> railsSpecial2 = new HashMap<Integer,Integer>();
|
||||
railsSpecial2.put(0, 1);
|
||||
railsSpecial2.put(1, 0);
|
||||
railsSpecial2.put(8, 9);
|
||||
railsSpecial2.put(9, 8);
|
||||
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
this.rotationMappings.put(2, orientation2);
|
||||
this.rotationMappings.put(1, orientation1);
|
||||
this.rotationMappings.put(0, orientation0);
|
||||
}
|
||||
|
||||
public int getRotatedBlock(int metaData, int desiredOrientation, int blockID)
|
||||
{
|
||||
if(this.rotationMappings.containsKey(desiredOrientation))
|
||||
{
|
||||
if(this.rotationMappings.get(desiredOrientation).containsKey(blockID))
|
||||
{
|
||||
if(this.rotationMappings.get(desiredOrientation).get(blockID).containsKey(metaData))
|
||||
{
|
||||
return this.rotationMappings.get(desiredOrientation).get(blockID).get(metaData);
|
||||
}
|
||||
}
|
||||
}
|
||||
return metaData ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package StevenDimDoors.mod_pocketDim.helpers;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.IChunkLoader;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
||||
public class ChunkLoaderHelper implements LoadingCallback
|
||||
{
|
||||
|
||||
@Override
|
||||
public void ticketsLoaded(List<Ticket> tickets, World world)
|
||||
{
|
||||
for (Ticket ticket : tickets)
|
||||
{
|
||||
int goldDimDoorX = ticket.getModData().getInteger("goldDimDoorX");
|
||||
int goldDimDoorY = ticket.getModData().getInteger("goldDimDoorY");
|
||||
int goldDimDoorZ = ticket.getModData().getInteger("goldDimDoorZ");
|
||||
if(world.getBlockId(goldDimDoorX, goldDimDoorY, goldDimDoorZ)!=mod_pocketDim.properties.GoldDimDoorID)
|
||||
{
|
||||
ForgeChunkManager.releaseTicket(ticket);
|
||||
}
|
||||
else
|
||||
{
|
||||
IChunkLoader tile = (IChunkLoader) world.getBlockTileEntity(goldDimDoorX, goldDimDoorY, goldDimDoorZ);
|
||||
tile.forceChunkLoading(ticket,goldDimDoorX,goldDimDoorZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadChunkForcedWorlds(FMLServerStartingEvent event)
|
||||
{
|
||||
for(NewDimData data : PocketManager.getDimensions())
|
||||
{
|
||||
if(data.isPocketDimension())
|
||||
{
|
||||
String chunkDir = DimensionManager.getCurrentSaveRootDirectory()+"/DimensionalDoors/pocketDimID" + data.id();
|
||||
|
||||
File file = new File(chunkDir);
|
||||
|
||||
if(file.exists())
|
||||
{
|
||||
if(ForgeChunkManager.savedWorldHasForcedChunkTickets(file))
|
||||
{
|
||||
PocketManager.loadDimension(data.id());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package StevenDimDoors.mod_pocketDim.helpers;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.IDimRegistrationCallback;
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.ClientLinkData;
|
||||
|
||||
public class Compactor
|
||||
{
|
||||
|
||||
@SuppressWarnings("unused") // ?
|
||||
private static class DimComparator implements Comparator<NewDimData>
|
||||
{
|
||||
@Override
|
||||
public int compare(NewDimData a, NewDimData b)
|
||||
{
|
||||
return a.id() - b.id();
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Collection<? extends NewDimData> values, DataOutputStream output) throws IOException
|
||||
{
|
||||
// SenseiKiwi: Just encode the data straight up for now. I'll implement fancier compression later.
|
||||
output.writeInt(values.size());
|
||||
for (NewDimData dimension : values)
|
||||
{
|
||||
output.writeInt(dimension.id());
|
||||
output.writeInt(dimension.root().id());
|
||||
output.writeInt(dimension.linkCount());
|
||||
for (DimLink link : dimension.links())
|
||||
{
|
||||
Point4D.write(link.source(), output);
|
||||
output.writeInt(link.orientation());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Note to self: the root ID can be "compressed" by grouping
|
||||
// dimensions by their root ID and then only sending it once
|
||||
|
||||
/*
|
||||
// To compress the dimension IDs, we'll sort them by ID
|
||||
// and write the _difference_ between their ID numbers.
|
||||
NewDimData[] dimensions = new NewDimData[values.size()];
|
||||
dimensions = values.toArray(dimensions);
|
||||
Arrays.sort(dimensions, new DimComparator());
|
||||
*/
|
||||
}
|
||||
|
||||
public static void readDimensions(DataInputStream 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.
|
||||
|
||||
HashSet<Integer> rootIDs = new HashSet<Integer>();
|
||||
|
||||
int dimCount = input.readInt();
|
||||
for (int k = 0; k < dimCount; k++)
|
||||
{
|
||||
int id = input.readInt();
|
||||
int rootID = input.readInt();
|
||||
|
||||
if (rootIDs.add(rootID))
|
||||
{
|
||||
callback.registerDimension(rootID, rootID);
|
||||
}
|
||||
// Don't check if (id != rootID) - we want to retrieve the reference anyway
|
||||
NewDimData dimension = callback.registerDimension(id, rootID);
|
||||
int linkCount = input.readInt();
|
||||
for (int h = 0; h < linkCount; h++)
|
||||
{
|
||||
ClientLinkData link = ClientLinkData.read(input);
|
||||
Point4D source = link.point;
|
||||
dimension.createLink(source.getX(), source.getY(), source.getZ(), LinkTypes.CLIENT_SIDE,link.orientation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package StevenDimDoors.mod_pocketDim.helpers;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
public class DeleteFolder
|
||||
{
|
||||
public static boolean deleteFolder(File file)
|
||||
{
|
||||
try
|
||||
{
|
||||
File[] files = file.listFiles();
|
||||
|
||||
if(files==null)
|
||||
{
|
||||
file.delete();
|
||||
return true;
|
||||
}
|
||||
for(File inFile : files)
|
||||
{
|
||||
DeleteFolder.deleteFolder(inFile);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,659 @@
|
||||
package StevenDimDoors.mod_pocketDim.helpers;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.Random;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.DungeonData;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.DungeonSchematic;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfig;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfigReader;
|
||||
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonType;
|
||||
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
|
||||
import StevenDimDoors.mod_pocketDim.util.ConfigurationProcessingException;
|
||||
import StevenDimDoors.mod_pocketDim.util.FileFilters;
|
||||
import StevenDimDoors.mod_pocketDim.util.WeightedContainer;
|
||||
|
||||
public class DungeonHelper
|
||||
{
|
||||
private static DungeonHelper instance = null;
|
||||
private static DDProperties properties = null;
|
||||
|
||||
public static final Pattern SCHEMATIC_NAME_PATTERN = Pattern.compile("[A-Za-z0-9_\\-]+");
|
||||
public static final Pattern DUNGEON_NAME_PATTERN = Pattern.compile("[A-Za-z0-9\\-]+");
|
||||
|
||||
public static final String SCHEMATIC_FILE_EXTENSION = ".schematic";
|
||||
|
||||
private static final String DEFAULT_ERROR_SCHEMATIC_PATH = "/schematics/core/somethingBroke.schematic";
|
||||
private static final String DUNGEON_CREATION_GUIDE_SOURCE_PATH = "/mods/DimDoors/text/How_to_add_dungeons.txt";
|
||||
private static final String RUINS_PACK_PATH = "/schematics/ruins";
|
||||
private static final String BUNDLED_RUINS_LIST_PATH = "/schematics/ruins.txt";
|
||||
private static final String STANDARD_CONFIG_FILE_NAME = "rules.txt";
|
||||
|
||||
private static final int NETHER_DIMENSION_ID = -1;
|
||||
|
||||
private static final int MIN_PACK_SWITCH_CHANCE = 0;
|
||||
private static final int PACK_SWITCH_CHANCE_PER_LEVEL = 1;
|
||||
private static final int MAX_PACK_SWITCH_CHANCE = 500;
|
||||
private static final int START_PACK_SWITCH_CHANCE = MAX_PACK_SWITCH_CHANCE / 9;
|
||||
|
||||
private static final int DEFAULT_DUNGEON_WEIGHT = 100;
|
||||
public static final int MIN_DUNGEON_WEIGHT = 1; //Prevents MC's random selection algorithm from throwing an exception
|
||||
public static final int MAX_DUNGEON_WEIGHT = 10000; //Used to prevent overflows and math breaking down
|
||||
|
||||
private static final int MAX_EXPORT_RADIUS = 50;
|
||||
public static final short MAX_DUNGEON_WIDTH = 2 * MAX_EXPORT_RADIUS + 1;
|
||||
public static final short MAX_DUNGEON_HEIGHT = MAX_DUNGEON_WIDTH;
|
||||
public static final short MAX_DUNGEON_LENGTH = MAX_DUNGEON_WIDTH;
|
||||
|
||||
private ArrayList<DungeonData> untaggedDungeons = new ArrayList<DungeonData>();
|
||||
private ArrayList<DungeonData> registeredDungeons = new ArrayList<DungeonData>();
|
||||
|
||||
private DungeonPack RuinsPack;
|
||||
private HashMap<String, DungeonPack> dungeonPackMapping = new HashMap<String, DungeonPack>();
|
||||
private ArrayList<DungeonPack> dungeonPackList = new ArrayList<DungeonPack>();
|
||||
|
||||
private DungeonData defaultError;
|
||||
|
||||
private DungeonHelper()
|
||||
{
|
||||
//Load our reference to the DDProperties singleton
|
||||
if (properties == null)
|
||||
properties = DDProperties.instance();
|
||||
|
||||
registerDungeons();
|
||||
}
|
||||
|
||||
public static DungeonHelper initialize()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new DungeonHelper();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Cannot initialize DungeonHelper twice");
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static DungeonHelper instance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
//This is to prevent some frustrating bugs that could arise when classes
|
||||
//are loaded in the wrong order. Trust me, I had to squash a few...
|
||||
throw new IllegalStateException("Instance of DungeonHelper requested before initialization");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void registerDungeons()
|
||||
{
|
||||
File file = new File(properties.CustomSchematicDirectory);
|
||||
if (file.exists() || file.mkdir())
|
||||
{
|
||||
copyfile.copyFile(DUNGEON_CREATION_GUIDE_SOURCE_PATH, file.getAbsolutePath() + "/How_to_add_dungeons.txt");
|
||||
}
|
||||
|
||||
DungeonPackConfigReader reader = new DungeonPackConfigReader();
|
||||
registerBundledDungeons(reader);
|
||||
registerCustomDungeons(properties.CustomSchematicDirectory, reader);
|
||||
}
|
||||
|
||||
private static DungeonPackConfig loadDungeonPackConfig(String configPath, String name, boolean isInternal, DungeonPackConfigReader reader)
|
||||
{
|
||||
try
|
||||
{
|
||||
DungeonPackConfig config;
|
||||
if (isInternal)
|
||||
{
|
||||
config = reader.readFromResource(configPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
config = reader.readFromFile(configPath);
|
||||
}
|
||||
config.setName(name);
|
||||
return config;
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
System.err.println("Could not find a dungeon pack config file: " + configPath);
|
||||
}
|
||||
catch (Exception e) // handles IOException and ConfigurationProcessingException
|
||||
{
|
||||
System.err.println(e.getMessage());
|
||||
if (e.getCause() != null)
|
||||
{
|
||||
System.err.println(e.getCause());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void registerDungeonPack(String directory, Iterable<String> schematics, boolean isInternal, boolean verbose, DungeonPackConfigReader reader)
|
||||
{
|
||||
//First determine the pack's name and validate it
|
||||
File packDirectory = new File(directory);
|
||||
String name = packDirectory.getName().toUpperCase();
|
||||
//TODO: ADD VALIDATION HERE?
|
||||
|
||||
//Check for naming conflicts
|
||||
//That could happen if a user has a custom pack with a name that conflicts with a bundled pack,
|
||||
//or if a user is running Linux and has two directories with names differing only by capitalization.
|
||||
|
||||
DungeonPack pack = dungeonPackMapping.get(name);
|
||||
if (pack == null)
|
||||
{
|
||||
//Load the pack's configuration file
|
||||
|
||||
String configPath;
|
||||
if (isInternal)
|
||||
{
|
||||
configPath = directory + "/" + STANDARD_CONFIG_FILE_NAME;
|
||||
}
|
||||
else
|
||||
{
|
||||
configPath = directory + File.separator + STANDARD_CONFIG_FILE_NAME;
|
||||
}
|
||||
DungeonPackConfig config = loadDungeonPackConfig(configPath, name, isInternal, reader);
|
||||
if (config == null)
|
||||
{
|
||||
System.err.println("Could not load config file: " + configPath);
|
||||
return;
|
||||
}
|
||||
|
||||
//Register the pack
|
||||
pack = new DungeonPack(config);
|
||||
dungeonPackMapping.put(name, pack);
|
||||
dungeonPackList.add(pack);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Show a warning that there is a naming conflict but keep going. People can use this to extend
|
||||
//our built-in packs with custom schematics without tampering with our mod's JAR file.
|
||||
System.err.println("A dungeon pack has the same name as another pack that has already been loaded: " + directory);
|
||||
System.err.println("We will try to load its schematics but will not check its config file.");
|
||||
}
|
||||
|
||||
//Register the dungeons! ^_^
|
||||
for (String schematicPath : schematics)
|
||||
{
|
||||
registerDungeon(schematicPath, pack, isInternal, verbose);
|
||||
}
|
||||
}
|
||||
|
||||
public List<DungeonData> getRegisteredDungeons()
|
||||
{
|
||||
return Collections.unmodifiableList(this.registeredDungeons);
|
||||
}
|
||||
|
||||
public List<DungeonData> getUntaggedDungeons()
|
||||
{
|
||||
return Collections.unmodifiableList(this.untaggedDungeons);
|
||||
}
|
||||
|
||||
public DungeonData getDefaultErrorDungeon()
|
||||
{
|
||||
return defaultError;
|
||||
}
|
||||
|
||||
public DungeonPack getDungeonPack(String name)
|
||||
{
|
||||
//TODO: This function might be obsolete after the new save format is implemented.
|
||||
return dungeonPackMapping.get(name.toUpperCase());
|
||||
}
|
||||
|
||||
private DungeonPack getDimDungeonPack(NewDimData data)
|
||||
{
|
||||
DungeonPack pack;
|
||||
DungeonData dungeon = data.dungeon();
|
||||
if (dungeon != null)
|
||||
{
|
||||
pack = dungeon.dungeonType().Owner;
|
||||
|
||||
//Make sure the pack isn't null. This can happen for dungeons with the special UNKNOWN type.
|
||||
if (pack == null)
|
||||
{
|
||||
pack = RuinsPack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.id() == NETHER_DIMENSION_ID)
|
||||
{
|
||||
//TODO: Change this to the nether-side pack later ^_^
|
||||
pack = RuinsPack;
|
||||
}
|
||||
else
|
||||
{
|
||||
pack = RuinsPack;
|
||||
}
|
||||
}
|
||||
return pack;
|
||||
}
|
||||
|
||||
public DimLink createCustomDungeonDoor(World world, int x, int y, int z)
|
||||
{
|
||||
//Create a link above the specified position. Link to a new pocket dimension.
|
||||
NewDimData dimension = PocketManager.getDimensionData(world);
|
||||
DimLink link = dimension.createLink(x, y + 1, z, LinkTypes.POCKET,3);
|
||||
|
||||
//Place a Warp Door linked to that pocket
|
||||
ItemDimensionalDoor.placeDoorBlock(world, x, y, z, 3, mod_pocketDim.warpDoor);
|
||||
|
||||
return link;
|
||||
}
|
||||
|
||||
public boolean validateDungeonType(String type, DungeonPack pack)
|
||||
{
|
||||
return pack.isKnownType(type);
|
||||
}
|
||||
|
||||
public boolean validateSchematicName(String name, DungeonPack pack)
|
||||
{
|
||||
String[] dungeonData;
|
||||
|
||||
if (!name.endsWith(SCHEMATIC_FILE_EXTENSION))
|
||||
return false;
|
||||
|
||||
dungeonData = name.substring(0, name.length() - SCHEMATIC_FILE_EXTENSION.length()).split("_");
|
||||
|
||||
//Check for a valid number of parts
|
||||
if (dungeonData.length < 3 || dungeonData.length > 4)
|
||||
return false;
|
||||
|
||||
//Check if the dungeon type is valid
|
||||
if (!validateDungeonType(dungeonData[0], pack))
|
||||
return false;
|
||||
|
||||
//Check if the name is valid
|
||||
if (!SCHEMATIC_NAME_PATTERN.matcher(dungeonData[1]).matches())
|
||||
return false;
|
||||
|
||||
//Check if the open/closed flag is present
|
||||
if (!dungeonData[2].equalsIgnoreCase("open") && !dungeonData[2].equalsIgnoreCase("closed"))
|
||||
return false;
|
||||
|
||||
//If the weight is present, check that it is valid
|
||||
if (dungeonData.length == 4)
|
||||
{
|
||||
try
|
||||
{
|
||||
int weight = Integer.parseInt(dungeonData[3]);
|
||||
if (weight < MIN_DUNGEON_WEIGHT || weight > MAX_DUNGEON_WEIGHT)
|
||||
return false;
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
//Not a number
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void registerDungeon(String schematicPath, DungeonPack pack, boolean isInternal, boolean verbose)
|
||||
{
|
||||
//We use schematicPath as the real path for internal files (inside our JAR) because it seems
|
||||
//that File tries to interpret it as a local drive path and mangles it.
|
||||
File schematicFile = new File(schematicPath);
|
||||
String name = schematicFile.getName();
|
||||
String path = isInternal ? schematicPath : schematicFile.getAbsolutePath();
|
||||
try
|
||||
{
|
||||
if (validateSchematicName(name, pack))
|
||||
{
|
||||
//Strip off the file extension while splitting the file name
|
||||
String[] dungeonData = name.substring(0, name.length() - SCHEMATIC_FILE_EXTENSION.length()).split("_");
|
||||
|
||||
DungeonType dungeonType = pack.getType(dungeonData[0]);
|
||||
boolean isOpen = dungeonData[2].equalsIgnoreCase("open");
|
||||
int weight = (dungeonData.length == 4) ? Integer.parseInt(dungeonData[3]) : DEFAULT_DUNGEON_WEIGHT;
|
||||
|
||||
//Add this custom dungeon to the list corresponding to its type
|
||||
DungeonData dungeon = new DungeonData(path, isInternal, dungeonType, isOpen, weight);
|
||||
|
||||
pack.addDungeon(dungeon);
|
||||
registeredDungeons.add(dungeon);
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println("Registered dungeon: " + name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
System.out.println("The following dungeon name is invalid for its given pack. It will not be generated naturally: " + schematicPath);
|
||||
}
|
||||
untaggedDungeons.add(new DungeonData(path, isInternal, DungeonType.UNKNOWN_TYPE, true, DEFAULT_DUNGEON_WEIGHT));
|
||||
System.out.println("Registered untagged dungeon: " + name);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("Failed to register dungeon: " + name);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerCustomDungeons(String path, DungeonPackConfigReader reader)
|
||||
{
|
||||
File[] schematics;
|
||||
File[] packDirectories;
|
||||
File[] packFiles;
|
||||
ArrayList<String> packFilePaths;
|
||||
File directory = new File(path);
|
||||
FileFilter schematicFileFilter = new FileFilters.FileExtensionFilter(SCHEMATIC_FILE_EXTENSION);
|
||||
|
||||
//Check that the Ruins pack has been loaded
|
||||
if (RuinsPack == null)
|
||||
{
|
||||
throw new IllegalStateException("Cannot register custom dungeons without first loading the Ruins dungeon pack.");
|
||||
}
|
||||
|
||||
//Load stray dungeons directly in the custom dungeons folder
|
||||
schematics = directory.listFiles(schematicFileFilter);
|
||||
if (schematics != null)
|
||||
{
|
||||
for (File schematicFile : schematics)
|
||||
{
|
||||
registerDungeon(schematicFile.getPath(), RuinsPack, false, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("Could not retrieve the list of schematics stored in the custom dungeons directory!");
|
||||
}
|
||||
schematics = null; //Release memory
|
||||
|
||||
//Load the custom dungeon packs
|
||||
packDirectories = directory.listFiles(new FileFilters.DirectoryFilter());
|
||||
if (packDirectories != null)
|
||||
{
|
||||
//Loop through each directory, which is assumed to be a dungeon pack
|
||||
for (File packDirectory : packDirectories)
|
||||
{
|
||||
//List the schematics within the dungeon pack directory
|
||||
packFiles = packDirectory.listFiles(schematicFileFilter);
|
||||
if (packFiles != null)
|
||||
{
|
||||
//Copy the pack files' paths into an ArrayList for use with registerDungeonPack()
|
||||
packFilePaths = new ArrayList<String>(packFiles.length);
|
||||
for (File packFile : packFiles)
|
||||
{
|
||||
packFilePaths.add(packFile.getPath());
|
||||
}
|
||||
|
||||
registerDungeonPack(packDirectory.getAbsolutePath(), packFilePaths, false, true, reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("Could not retrieve the list of schematics in a dungeon pack: " + packDirectory.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("Could not retrieve the list of dungeon pack directories in the custom dungeons directory!");
|
||||
}
|
||||
}
|
||||
|
||||
private void registerBundledDungeons(DungeonPackConfigReader reader)
|
||||
{
|
||||
//Register the core schematics
|
||||
//These are used for debugging and in case of unusual errors while loading dungeons
|
||||
defaultError = new DungeonData(DEFAULT_ERROR_SCHEMATIC_PATH, true, DungeonType.UNKNOWN_TYPE, true, DEFAULT_DUNGEON_WEIGHT);
|
||||
|
||||
//Open the list of dungeons packaged with our mod and register their schematics
|
||||
registerBundledPack(BUNDLED_RUINS_LIST_PATH, RUINS_PACK_PATH, "Ruins", reader);
|
||||
RuinsPack = getDungeonPack("Ruins");
|
||||
|
||||
System.out.println("Finished registering bundled dungeon packs");
|
||||
}
|
||||
|
||||
private void registerBundledPack(String listPath, String packPath, String name, DungeonPackConfigReader reader)
|
||||
{
|
||||
System.out.println("Registering bundled dungeon pack: " + name);
|
||||
|
||||
InputStream listStream = this.getClass().getResourceAsStream(listPath);
|
||||
// chance of leak?
|
||||
if (listStream == null)
|
||||
{
|
||||
System.err.println("Unable to open list of bundled dungeon schematics for " + name);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//Read the list of schematics that come with a bundled pack
|
||||
BufferedReader listReader = new BufferedReader(new InputStreamReader(listStream));
|
||||
ArrayList<String> schematics = new ArrayList<String>();
|
||||
String schematicPath = listReader.readLine();
|
||||
while (schematicPath != null)
|
||||
{
|
||||
schematicPath = schematicPath.trim();
|
||||
if (!schematicPath.isEmpty())
|
||||
{
|
||||
schematics.add(schematicPath);
|
||||
}
|
||||
schematicPath = listReader.readLine();
|
||||
}
|
||||
listReader.close();
|
||||
|
||||
//Register the pack
|
||||
registerDungeonPack(packPath, schematics, true, false, reader);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("An exception occurred while reading the list of bundled dungeon schematics for " + name);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exportDungeon(World world, int centerX, int centerY, int centerZ, String exportPath)
|
||||
{
|
||||
//Write schematic data to a file
|
||||
try
|
||||
{
|
||||
DungeonSchematic dungeon = DungeonSchematic.copyFromWorld(world,
|
||||
centerX - MAX_EXPORT_RADIUS, centerY - MAX_EXPORT_RADIUS, centerZ - MAX_EXPORT_RADIUS,
|
||||
MAX_DUNGEON_WIDTH, MAX_DUNGEON_HEIGHT, MAX_DUNGEON_LENGTH, true);
|
||||
dungeon.applyExportFilters(properties);
|
||||
dungeon.writeToFile(exportPath);
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public DungeonData selectDungeon(NewDimData dimension, Random random)
|
||||
{
|
||||
DungeonPack pack = getDimDungeonPack(dimension);
|
||||
DungeonData selection;
|
||||
DungeonPackConfig config;
|
||||
DungeonPack selectedPack;
|
||||
|
||||
try
|
||||
{
|
||||
config = pack.getConfig();
|
||||
selectedPack = pack;
|
||||
|
||||
//Are we allowed to switch to another dungeon pack?
|
||||
if (config.allowPackChangeOut())
|
||||
{
|
||||
//Calculate the chance of switching to a different pack type
|
||||
int packSwitchChance;
|
||||
if (dimension.depth() == 1)
|
||||
{
|
||||
packSwitchChance = START_PACK_SWITCH_CHANCE;
|
||||
}
|
||||
else
|
||||
{
|
||||
packSwitchChance = MIN_PACK_SWITCH_CHANCE + dimension.parent().packDepth() * PACK_SWITCH_CHANCE_PER_LEVEL;
|
||||
}
|
||||
|
||||
//Decide randomly whether to switch packs or not
|
||||
if (random.nextInt(MAX_PACK_SWITCH_CHANCE) < packSwitchChance)
|
||||
{
|
||||
//Find another pack
|
||||
selectedPack = getRandomDungeonPack(pack, random);
|
||||
}
|
||||
}
|
||||
|
||||
//Pick the next dungeon
|
||||
selection = selectedPack.getNextDungeon(dimension, random);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("An exception occurred while selecting a dungeon:");
|
||||
e.printStackTrace();
|
||||
|
||||
if (!pack.isEmpty())
|
||||
{
|
||||
selection = pack.getRandomDungeon(random);
|
||||
}
|
||||
else
|
||||
{
|
||||
selection = defaultError;
|
||||
}
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private DungeonPack getRandomDungeonPack(DungeonPack current, Random random)
|
||||
{
|
||||
DungeonPack selection = current;
|
||||
ArrayList<WeightedContainer<DungeonPack>> packs = new ArrayList<WeightedContainer<DungeonPack>>(dungeonPackList.size());
|
||||
|
||||
//Load up a list of weighted items with any usable dungeon packs that is not the current pack
|
||||
for (DungeonPack pack : dungeonPackList)
|
||||
{
|
||||
DungeonPackConfig config = pack.getConfig();
|
||||
if (pack != current && config.allowPackChangeIn() && !pack.isEmpty())
|
||||
{
|
||||
packs.add(new WeightedContainer<DungeonPack>(pack, config.getPackWeight()));
|
||||
}
|
||||
}
|
||||
if (!packs.isEmpty())
|
||||
{
|
||||
//Pick a random dungeon pack
|
||||
selection = ((WeightedContainer<DungeonPack>) WeightedRandom.getRandomItem(random, packs)).getData();
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
|
||||
public Collection<String> getDungeonNames() {
|
||||
|
||||
//Use a HashSet to guarantee that all dungeon names will be distinct.
|
||||
//This shouldn't be necessary if we keep proper lists without repetitions,
|
||||
//but it's a fool-proof workaround.
|
||||
HashSet<String> dungeonNames = new HashSet<String>();
|
||||
dungeonNames.addAll( parseDungeonNames(registeredDungeons) );
|
||||
dungeonNames.addAll( parseDungeonNames(untaggedDungeons) );
|
||||
|
||||
//Sort dungeon names alphabetically
|
||||
ArrayList<String> sortedNames = new ArrayList<String>(dungeonNames);
|
||||
Collections.sort(sortedNames, String.CASE_INSENSITIVE_ORDER);
|
||||
return sortedNames;
|
||||
}
|
||||
|
||||
private static ArrayList<String> parseDungeonNames(ArrayList<DungeonData> dungeons)
|
||||
{
|
||||
String name;
|
||||
File schematic;
|
||||
ArrayList<String> names = new ArrayList<String>(dungeons.size());
|
||||
|
||||
for (DungeonData dungeon : dungeons)
|
||||
{
|
||||
//Retrieve the file name and strip off the file extension
|
||||
schematic = new File(dungeon.schematicPath());
|
||||
name = schematic.getName();
|
||||
name = name.substring(0, name.length() - SCHEMATIC_FILE_EXTENSION.length());
|
||||
names.add(name);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public static ArrayList<DungeonData> getDungeonChainHistory(NewDimData dimension, DungeonPack pack, int maxSize)
|
||||
{
|
||||
if (dimension == null)
|
||||
{
|
||||
throw new IllegalArgumentException("dimension cannot be null.");
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
NewDimData tail = dimension;
|
||||
DungeonData dungeon = tail.dungeon();
|
||||
ArrayList<DungeonData> history = new ArrayList<DungeonData>();
|
||||
|
||||
while (count < maxSize && dungeon != null && dungeon.dungeonType().Owner == pack)
|
||||
{
|
||||
history.add(dungeon);
|
||||
tail = tail.parent();
|
||||
dungeon = tail.dungeon();
|
||||
count++;
|
||||
}
|
||||
return history;
|
||||
}
|
||||
|
||||
public static ArrayList<DungeonData> getFlatDungeonTree(NewDimData dimension, int maxSize)
|
||||
{
|
||||
NewDimData root = dimension;
|
||||
ArrayList<DungeonData> dungeons = new ArrayList<DungeonData>();
|
||||
Queue<NewDimData> pendingDimensions = new LinkedList<NewDimData>();
|
||||
|
||||
if (root.dungeon() == null)
|
||||
{
|
||||
return dungeons;
|
||||
}
|
||||
pendingDimensions.add(root);
|
||||
|
||||
while (dungeons.size() < maxSize && !pendingDimensions.isEmpty())
|
||||
{
|
||||
NewDimData current = pendingDimensions.remove();
|
||||
for (NewDimData child : current.children())
|
||||
{
|
||||
if (child.dungeon() != null)
|
||||
{
|
||||
dungeons.add(child.dungeon());
|
||||
pendingDimensions.add(child);
|
||||
}
|
||||
if (dungeons.size() == maxSize)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dungeons;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package StevenDimDoors.mod_pocketDim.helpers;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
|
||||
public class copyfile
|
||||
{
|
||||
public static boolean copyFile(String ori, String dest)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Note: For this to work properly, you must use getClass() on an instance of the class,
|
||||
//not on the value obtained from .class. That was what caused this code to fail before.
|
||||
//SchematicLoader didn't have this problem because we used instances of it.
|
||||
InputStream in = mod_pocketDim.instance.getClass().getResourceAsStream(ori);
|
||||
OutputStream out = new FileOutputStream(dest);
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Unable to get resource: " + ori);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,297 @@
|
||||
package StevenDimDoors.mod_pocketDim.helpers;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||
|
||||
public class yCoordHelper
|
||||
{
|
||||
private static final int MAXIMUM_UNCOVERED_Y = 245;
|
||||
|
||||
private yCoordHelper() { }
|
||||
|
||||
public static int getFirstUncovered(World world, int x, int yStart, int z)
|
||||
{
|
||||
return getFirstUncovered(world, x, yStart, z, false);
|
||||
}
|
||||
|
||||
public static int getFirstUncovered(World world, int x, int yStart, int z, boolean fromTop)
|
||||
{
|
||||
Chunk chunk = world.getChunkProvider().loadChunk(x >> 4, z >> 4);
|
||||
|
||||
int localX = x < 0 ? (x % 16) + 16 : (x % 16);
|
||||
int localZ = z < 0 ? (z % 16) + 16 : (z % 16);
|
||||
int height = MAXIMUM_UNCOVERED_Y;
|
||||
int y;
|
||||
|
||||
if (!fromTop)
|
||||
{
|
||||
boolean covered = true;
|
||||
for (y = yStart; y < height && covered; y++)
|
||||
{
|
||||
covered = isCoveredBlock(chunk, localX, y - 1, localZ) || isCoveredBlock(chunk, localX, y, localZ);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean covered = false;
|
||||
for (y = MAXIMUM_UNCOVERED_Y; y > 1 && !covered; y--)
|
||||
{
|
||||
covered = isCoveredBlock(chunk, localX, y - 1, localZ);
|
||||
}
|
||||
if (!covered) y = 63;
|
||||
y++;
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
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];
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
material = block.blockMaterial;
|
||||
return (material.isLiquid() || !material.isReplaceable());
|
||||
}
|
||||
|
||||
public static Point3D findSafeCubeUp(World world, int x, int startY, int z)
|
||||
{
|
||||
// Search for a 3x3x3 cube of air with blocks underneath
|
||||
// We can also match against a 3x2x3 box with
|
||||
// We shift the search area into the bounds of a chunk for the sake of simplicity,
|
||||
// so that we don't need to worry about working across chunks.
|
||||
|
||||
int localX = x < 0 ? (x % 16) + 16 : (x % 16);
|
||||
int localZ = z < 0 ? (z % 16) + 16 : (z % 16);
|
||||
int cornerX = x - localX;
|
||||
int cornerZ = z - localZ;
|
||||
localX = MathHelper.clamp_int(localX, 1, 14);
|
||||
localZ = MathHelper.clamp_int(localZ, 1, 14);
|
||||
|
||||
Chunk chunk = initializeChunkArea(world, x >> 4, z >> 4);
|
||||
|
||||
int height = world.getActualHeight();
|
||||
int y, dx, dz, blockID;
|
||||
boolean isSafe;
|
||||
Block block;
|
||||
|
||||
// Initialize layers to a huge negative number so that we won't
|
||||
// consider an area as usable unless it gets reset to 0 first
|
||||
// when we find a foundation upon which to build.
|
||||
int layers = -1000000;
|
||||
|
||||
// Check if a 3x3 layer of blocks is empty
|
||||
// If we find a layer that contains replaceable blocks, it can
|
||||
// serve as the base where we'll place the player and door.
|
||||
for (y = Math.max(startY - 1, 0); y < height; y++)
|
||||
{
|
||||
isSafe = true;
|
||||
for (dx = -1; dx <= 1 && isSafe; dx++)
|
||||
{
|
||||
for (dz = -1; dz <= 1 && isSafe; dz++)
|
||||
{
|
||||
blockID = chunk.getBlockID(localX + dx, y, localZ + dz);
|
||||
if (blockID != 0)
|
||||
{
|
||||
block = Block.blocksList[blockID];
|
||||
if (!block.blockMaterial.isReplaceable())
|
||||
{
|
||||
isSafe = false;
|
||||
}
|
||||
layers = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isSafe)
|
||||
{
|
||||
layers++;
|
||||
if (layers == 3)
|
||||
{
|
||||
return new Point3D(localX + cornerX, y - 2, localZ + cornerZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Point3D findSafeCubeDown(World world, int x, int startY, int z)
|
||||
{
|
||||
// Search for a 3x3x3 cube of air with blocks underneath
|
||||
// We can also match against a 3x2x3 box with
|
||||
// We shift the search area into the bounds of a chunk for the sake of simplicity,
|
||||
// so that we don't need to worry about working across chunks.
|
||||
|
||||
int localX = x < 0 ? (x % 16) + 16 : (x % 16);
|
||||
int localZ = z < 0 ? (z % 16) + 16 : (z % 16);
|
||||
int cornerX = x - localX;
|
||||
int cornerZ = z - localZ;
|
||||
localX = MathHelper.clamp_int(localX, 1, 14);
|
||||
localZ = MathHelper.clamp_int(localZ, 1, 14);
|
||||
|
||||
Chunk chunk = initializeChunkArea(world, x >> 4, z >> 4);
|
||||
|
||||
int height = world.getActualHeight();
|
||||
int y, dx, dz, blockID;
|
||||
boolean isSafe;
|
||||
boolean hasBlocks;
|
||||
Block block;
|
||||
int layers = 0;
|
||||
|
||||
// Check if a 3x3 layer of blocks is empty
|
||||
// If we find a layer that contains replaceable blocks, it can
|
||||
// serve as the base where we'll place the player and door.
|
||||
for (y = Math.min(startY + 2, height - 1); y >= 0; y--)
|
||||
{
|
||||
isSafe = true;
|
||||
hasBlocks = false;
|
||||
for (dx = -1; dx <= 1 && isSafe; dx++)
|
||||
{
|
||||
for (dz = -1; dz <= 1 && isSafe; dz++)
|
||||
{
|
||||
blockID = chunk.getBlockID(localX + dx, y, localZ + dz);
|
||||
if (blockID != 0)
|
||||
{
|
||||
block = Block.blocksList[blockID];
|
||||
if (!block.blockMaterial.isReplaceable())
|
||||
{
|
||||
if (layers >= 3)
|
||||
{
|
||||
return new Point3D(localX + cornerX, y + 1, localZ + cornerZ);
|
||||
}
|
||||
isSafe = false;
|
||||
}
|
||||
hasBlocks = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isSafe)
|
||||
{
|
||||
layers++;
|
||||
if (hasBlocks)
|
||||
{
|
||||
if (layers >= 3)
|
||||
{
|
||||
return new Point3D(localX + cornerX, y, localZ + cornerZ);
|
||||
}
|
||||
layers = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Chunk initializeChunkArea(World world, int chunkX, int chunkZ)
|
||||
{
|
||||
// We initialize a 3x3 area of chunks instead of just initializing
|
||||
// the target chunk because things generated in adjacent chunks
|
||||
// (e.g. trees) might intrude into the target chunk.
|
||||
|
||||
IChunkProvider provider = world.getChunkProvider();
|
||||
Chunk target = provider.loadChunk(chunkX, chunkZ);
|
||||
for (int dx = -1; dx <= 1; dx++)
|
||||
{
|
||||
for (int dz = -1; dz <= 1; dz++)
|
||||
{
|
||||
if (!provider.chunkExists(chunkX + dx, chunkZ + dz))
|
||||
{
|
||||
provider.loadChunk(chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
public static Point3D findDropPoint(World world, int x, int startY, int z)
|
||||
{
|
||||
// Find a simple 2-block-high air gap
|
||||
// Search across a 3x3 column
|
||||
final int GAP_HEIGHT = 2;
|
||||
|
||||
int localX = x < 0 ? (x % 16) + 16 : (x % 16);
|
||||
int localZ = z < 0 ? (z % 16) + 16 : (z % 16);
|
||||
int cornerX = x - localX;
|
||||
int cornerZ = z - localZ;
|
||||
localX = MathHelper.clamp_int(localX, 1, 14);
|
||||
localZ = MathHelper.clamp_int(localZ, 1, 14);
|
||||
|
||||
Chunk chunk = initializeChunkArea(world, x >> 4, z >> 4);
|
||||
|
||||
int y, dx, dz, index;
|
||||
int height = world.getActualHeight();
|
||||
int[] gaps = new int[9];
|
||||
|
||||
// Check 3x3 layers of blocks for air spaces
|
||||
for (y = Math.min(startY, height - 1); y > 0; y--)
|
||||
{
|
||||
for (dx = -1, index = 0; dx <= 1; dx++)
|
||||
{
|
||||
for (dz = -1; dz <= 1; dz++, index++)
|
||||
{
|
||||
if (chunk.getBlockID(localX + dx, y, localZ + dz) != 0)
|
||||
{
|
||||
gaps[index] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gaps[index]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check if an acceptable gap exists in the center of the search column
|
||||
if (gaps[index / 2] == GAP_HEIGHT)
|
||||
{
|
||||
return new Point3D(localX + cornerX, y + GAP_HEIGHT - 1, localZ + cornerZ);
|
||||
}
|
||||
// Check the other positions in the column
|
||||
for (dx = -1, index = 0; dx <= 1; dx++)
|
||||
{
|
||||
for (dz = -1; dz <= 1; dz++, index++)
|
||||
{
|
||||
if (gaps[index] == GAP_HEIGHT)
|
||||
{
|
||||
return new Point3D(localX + cornerX + dx, y + GAP_HEIGHT - 1, localZ + cornerZ + dz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int adjustDestinationY(int y, int worldHeight, int entranceY, int dungeonHeight)
|
||||
{
|
||||
//The goal here is to guarantee that the dungeon fits within the vertical bounds
|
||||
//of the world while shifting it as little as possible.
|
||||
int destY = y;
|
||||
|
||||
//Is the top of the dungeon going to be at Y < worldHeight?
|
||||
int pocketTop = (dungeonHeight - 1) + destY - entranceY;
|
||||
if (pocketTop >= worldHeight)
|
||||
{
|
||||
destY = (worldHeight - 1) - (dungeonHeight - 1) + entranceY;
|
||||
}
|
||||
|
||||
//Is the bottom of the dungeon at Y >= 0?
|
||||
if (destY < entranceY)
|
||||
{
|
||||
destY = entranceY;
|
||||
}
|
||||
return destY;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user