-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New World constructor with ability to set max region quantity. New te…
…st to check autosave works
- Loading branch information
Pavel Fedin
committed
Dec 4, 2016
1 parent
d0c53ff
commit c79994f
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import mregioneer.mcaliases.World; | ||
import mregioneer.utils.Point3d; | ||
import org.ini4j.Ini; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.util.Random; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
public class TestRegionAutoRemove { | ||
@Test | ||
public void testAdd() { | ||
World world; | ||
try { | ||
//initializing path to region folder | ||
String presets_url = TestReadWrite.class.getClassLoader().getResource("local_presets.ini").getPath(); | ||
Ini ini = new Ini(new File(presets_url)); | ||
String path_to_mca_folder = ini.get("paths", "world_path", String.class); | ||
|
||
world = new World(new File(path_to_mca_folder), 1); | ||
|
||
Random rand = new Random(1); | ||
byte id = (byte) rand.nextInt(24); | ||
|
||
Point3d point1 = new Point3d(1, 1, 64); | ||
Point3d point2 = new Point3d(-2,-2,64); | ||
|
||
world.changeBlockID(point1, id); | ||
world.changeBlockID(point2, id); | ||
|
||
world.save(); | ||
|
||
assertTrue(world.getBlockId(point1) == world.getBlockId(point2)); | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |