-
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.
More delegating methods. New Test showing writing ids by blocks is ba…
…d strategy
- Loading branch information
Pavel Fedin
committed
Nov 27, 2016
1 parent
1c0edcb
commit 4bab776
Showing
6 changed files
with
156 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
package ru.wpstuio.amorphine.mcaliases; | ||
|
||
|
||
import ru.wpstuio.amorphine.utils.Coordinates3d; | ||
|
||
public class Block { | ||
private int x; | ||
private int z; | ||
private int y; | ||
private final int x; | ||
private final int z; | ||
private final int y; | ||
|
||
private short id_a; | ||
private short id_b; | ||
|
||
private TileEntity tileEntity = null; | ||
|
||
public Block(Coordinates3d cords, short id_a) { | ||
this.x = cords.getX(); | ||
this.z = cords.getZ(); | ||
this.y = cords.getY(); | ||
|
||
this.id_a = id_a; | ||
} | ||
} |
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
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
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,47 @@ | ||
import org.ini4j.Ini; | ||
import org.junit.Test; | ||
import ru.wpstuio.amorphine.mcaliases.World; | ||
import ru.wpstuio.amorphine.utils.Coordinates3d; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
|
||
public class TestReadWrite2 { | ||
@Test | ||
public void testAdd() { | ||
|
||
World world; | ||
byte id_to_make = 13; | ||
|
||
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)); | ||
|
||
Coordinates3d cords; | ||
for(int inty = 66; inty < 100; inty++){ | ||
for(int intz = -10; intz < 10; intz++){ | ||
for(int intx = -10; intx < 10; intx++){ | ||
world.changeBlockID(new Coordinates3d(intx, inty, intz), id_to_make); | ||
} | ||
} | ||
} | ||
world.save(); | ||
|
||
world = new World(new File (path_to_mca_folder)); | ||
cords = new Coordinates3d(1, 66 ,1); | ||
byte id = world.getBlockId(cords); | ||
|
||
assertTrue(id == id_to_make); | ||
|
||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |