mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
implement properties in janky pregen
This commit is contained in:
@@ -10,8 +10,19 @@ public class Data implements BlockData, MaterialData {
|
||||
|
||||
public Data(String data) {
|
||||
this.data = new CompoundTag();
|
||||
if(data.contains("[")) noProp = data.substring(0, data.indexOf('[')); // Strip properties for now TODO: actually do properties lol
|
||||
else noProp = data;
|
||||
if(data.contains("[")) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -23,10 +34,10 @@ public class Data implements BlockData, MaterialData {
|
||||
this.data = tag;
|
||||
}
|
||||
String id = data.getString("Name");
|
||||
if(id.contains("[")) noProp = id.substring(0, id.indexOf('[')); // Strip properties for now TODO: actually do properties lol
|
||||
else noProp = id;
|
||||
noProp = id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MaterialData getMaterial() {
|
||||
return this;
|
||||
|
||||
@@ -64,7 +64,10 @@ public class DirectWorld implements World {
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
MCAFile file = compute(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);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ public class Generator {
|
||||
}
|
||||
|
||||
for(Map.Entry<Long, MCAFile> entry : world.getFiles().entrySet()) {
|
||||
if(entry.getValue() == null) continue;
|
||||
entry.getValue().cleanupPalettesAndBlockStates();
|
||||
int x = (int) (entry.getKey() >> 32);
|
||||
int z = (int) (long) entry.getKey();
|
||||
|
||||
Reference in New Issue
Block a user