Skip to content

Commit

Permalink
Some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Fedin committed Nov 28, 2016
1 parent a50683a commit 3c746b3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package ru.wpstuio.amorphine.exception;

/**
* Created by amorphine on 28.11.16.
*/
public class EmptySection extends Exception {

}
5 changes: 5 additions & 0 deletions src/main/java/ru/wpstuio/amorphine/mcaliases/Chunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public void changeBlockId(int x, int y, int z, byte id) {
block_bytes_tag.data[offset] = id;
}

/**
* Writes main block id with given coordinates
* @param cords
* @param id
*/
public void changeBlockId(Coordinates3d cords, byte id) {
int local_x = localBlockFromBlock(cords.getX());
int local_y = localBlockFromBlock(cords.getY());
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/ru/wpstuio/amorphine/mcaliases/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ public void save() throws IOException {
}
}

/**
* Writes block id with given coordinates
* @param cords
* @param id
* @throws IOException
*/
public void changeBlockId(Coordinates3d cords, byte id) throws IOException {
int block_global_x = cords.getX();
int block_global_z = cords.getZ();
Expand All @@ -132,6 +138,11 @@ public void changeBlockId(Coordinates3d cords, byte id) throws IOException {

}

/**
* Returns block id with given coordinates
* @param cords
* @return
*/
public byte getBlockId(Coordinates3d cords) {
int block_global_x = cords.getX();
int block_global_z = cords.getZ();
Expand Down
20 changes: 13 additions & 7 deletions src/main/java/ru/wpstuio/amorphine/mcaliases/Section.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ public class Section {
private final byte index;
private CompoundTag tag;

public byte getIndex() {
return index;
}

public CompoundTag getTag() {
return tag;
}

public Section(byte index, CompoundTag tag) {
this.index = index;
Expand Down Expand Up @@ -46,6 +39,19 @@ public Section(byte index) {
this.tag = main_tag;
}

public byte getIndex() {
return index;
}

public CompoundTag getTag() {
return tag;
}

/**
* Returns tag with given name
* @param name string name of the tag to be returned
* @return
*/
public Tag get(String name) {
return this.tag.get(name);
}
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/ru/wpstuio/amorphine/mcaliases/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public World(File world_dir) throws IOException {
}
}

/**
* Save all cashed regions to their files
* @throws IOException
*/
public void save() throws IOException {
for(Map.Entry entry: regions.entrySet()) {
Region region = (Region) entry.getValue();
Expand Down Expand Up @@ -83,6 +87,12 @@ public Region getRegion(int x, int z) {
}
}

/**
* Changes specified block basic id to with the given one
* @param cords
* @param id
* @throws IOException
*/
public void changeBlockID(Coordinates3d cords, byte id) throws IOException {
int region_x = regionFromBlock(cords.getX());
int region_z = regionFromBlock(cords.getZ());
Expand All @@ -91,6 +101,11 @@ public void changeBlockID(Coordinates3d cords, byte id) throws IOException {
region.changeBlockId(cords, id);
}

/**
* Returns id of the block with specified XYZ coordinates
* @param cords
* @return
*/
public byte getBlockId(Coordinates3d cords) {
int region_x = regionFromBlock(cords.getX());
int region_z = regionFromBlock(cords.getZ());
Expand Down

0 comments on commit 3c746b3

Please sign in to comment.