-
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 alias - Section. Fixed problems connected with writing/reading bl…
…ocks into 'not existing' sections (sections with air only)
- Loading branch information
Pavel Fedin
committed
Nov 28, 2016
1 parent
dc76631
commit a50683a
Showing
3 changed files
with
72 additions
and
11 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/main/java/ru/wpstuio/amorphine/exception/EmptySection.java
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,8 @@ | ||
package ru.wpstuio.amorphine.exception; | ||
|
||
/** | ||
* Created by amorphine on 28.11.16. | ||
*/ | ||
public class EmptySection extends Exception { | ||
|
||
} |
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 |
---|---|---|
@@ -1,14 +1,52 @@ | ||
package ru.wpstuio.amorphine.mcaliases; | ||
|
||
import com.mojang.nbt.ByteArrayTag; | ||
import com.mojang.nbt.ByteTag; | ||
import com.mojang.nbt.CompoundTag; | ||
import com.mojang.nbt.Tag; | ||
|
||
import java.util.Arrays; | ||
|
||
|
||
public class Section { | ||
private byte index; | ||
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; | ||
this.tag = tag; | ||
} | ||
|
||
public Section(byte index) { | ||
this.index = index; | ||
|
||
CompoundTag main_tag = new CompoundTag(); | ||
|
||
byte[] byte4096 = new byte[4096]; | ||
Arrays.fill(byte4096, (byte) 0); | ||
|
||
byte[] byte2048 = new byte[2048]; | ||
Arrays.fill(byte2048, (byte) 0); | ||
|
||
main_tag.put("Add", new ByteArrayTag("Add", byte2048.clone())); | ||
main_tag.put("Blocks", new ByteArrayTag("Blocks", byte4096.clone())); | ||
main_tag.put("SkyLight", new ByteArrayTag("SkyLight", byte2048.clone())); | ||
main_tag.put("Y", new ByteTag("Y", index)); | ||
main_tag.put("BlockLight", new ByteArrayTag("BlockLight", byte2048.clone())); | ||
main_tag.put("Data", new ByteArrayTag("Data", byte2048.clone())); | ||
|
||
this.tag = main_tag; | ||
} | ||
|
||
public Tag get(String name) { | ||
return this.tag.get(name); | ||
} | ||
} |