mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-25 13:30:10 +00:00
implement properties in janky pregen
This commit is contained in:
1 parent
75fbda5a9f
commit
bd0726db37
3 files changed
+20
-5
No files matched your search
@@ -10,8 +10,19 @@ public class Data implements BlockData, MaterialData {
|
|||||||
|
|
||||||
public Data(String data) {
|
public Data(String data) {
|
||||||
this.data = new CompoundTag();
|
this.data = new CompoundTag();
|
||||||
if(data.contains("[")) noProp = data.substring(0, data.indexOf('[')); // Strip properties for now TODO: actually do properties lol
|
if(data.contains("[")) {
|
||||||
else noProp = data;
|
noProp = data.substring(0, data.indexOf('[')); // Strip properties
|
||||||
|
String properties = data.substring(data.indexOf('[') + 1, data.indexOf(']'));
|
||||||
|
String[] props = properties.split(",");
|
||||||
|
CompoundTag pTag = new CompoundTag();
|
||||||
|
for(String property : props) {
|
||||||
|
String name = property.substring(0, property.indexOf('='));
|
||||||
|
String val = property.substring(property.indexOf('=') + 1);
|
||||||
|
|
||||||
|
pTag.putString(name, val);
|
||||||
|
}
|
||||||
|
this.data.put("Properties", pTag);
|
||||||
|
} else noProp = data;
|
||||||
this.data.putString("Name", noProp);
|
this.data.putString("Name", noProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,10 +34,10 @@ public class Data implements BlockData, MaterialData {
|
|||||||
this.data = tag;
|
this.data = tag;
|
||||||
}
|
}
|
||||||
String id = data.getString("Name");
|
String id = data.getString("Name");
|
||||||
if(id.contains("[")) noProp = id.substring(0, id.indexOf('[')); // Strip properties for now TODO: actually do properties lol
|
noProp = id;
|
||||||
else noProp = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialData getMaterial() {
|
public MaterialData getMaterial() {
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -64,7 +64,10 @@ public class DirectWorld implements World {
|
|||||||
public Chunk getChunkAt(int x, int z) {
|
public Chunk getChunkAt(int x, int z) {
|
||||||
MCAFile file = compute(x, z);
|
MCAFile file = compute(x, z);
|
||||||
net.querz.mca.Chunk chunk = file.getChunk(x, z);
|
net.querz.mca.Chunk chunk = file.getChunk(x, z);
|
||||||
if(chunk == null) chunk = net.querz.mca.Chunk.newChunk();
|
if(chunk == null) {
|
||||||
|
chunk = net.querz.mca.Chunk.newChunk();
|
||||||
|
file.setChunk(x, z, chunk);
|
||||||
|
}
|
||||||
return new DirectChunkData(chunk, this, x, z);
|
return new DirectChunkData(chunk, this, x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class Generator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(Map.Entry<Long, MCAFile> entry : world.getFiles().entrySet()) {
|
for(Map.Entry<Long, MCAFile> entry : world.getFiles().entrySet()) {
|
||||||
|
if(entry.getValue() == null) continue;
|
||||||
entry.getValue().cleanupPalettesAndBlockStates();
|
entry.getValue().cleanupPalettesAndBlockStates();
|
||||||
int x = (int) (entry.getKey() >> 32);
|
int x = (int) (entry.getKey() >> 32);
|
||||||
int z = (int) (long) entry.getKey();
|
int z = (int) (long) entry.getKey();
|
||||||
|
|||||||
Reference in new issue
Block a user