block data fixes

This commit is contained in:
Sen 2025-06-23 10:18:24 +02:00
parent cde7bf84c1
commit eb815a8e21
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
54 changed files with 167 additions and 207 deletions

View file

@ -28,7 +28,6 @@ import common.init.BlockRegistry;
import common.init.Blocks;
import common.init.EntityRegistry;
import common.log.Log;
import common.properties.Property;
import common.tags.TagObject;
import common.tileentity.TileEntity;
import common.util.BlockPos;
@ -38,41 +37,6 @@ import common.world.BlockArray;
import common.world.State;
public class Region {
private static Set<Property> getSavedProperties(Block block) {
Set<Property> stored = Sets.newHashSet();
Map<Property, Comparable> map = Maps.newHashMap();
for(int z = 0; z < 16; z++) {
State sub = block.getStateFromMeta(z);
for(Entry<Property, Comparable> entry : sub.getProperties().entrySet()) {
if(map.containsKey(entry.getKey())) {
if(!map.get(entry.getKey()).equals(entry.getValue()))
stored.add(entry.getKey());
}
else {
map.put(entry.getKey(), entry.getValue());
}
}
}
for(int z = 0; z < 16; z++) {
State sub = block.getStateFromMeta(z);
Map<Property, Comparable> smap = sub.getProperties();
for(Property prop : map.keySet()) {
if(!smap.containsKey(prop))
stored.add(prop);
}
}
return stored;
}
private static String filterProperties(State state, Set<Property> stored) {
StringBuilder sb = new StringBuilder(BlockRegistry.getNameFromBlock(state.getBlock()));
for(Entry<Property, Comparable> entry : state.getProperties().entrySet()) {
if(stored.contains(entry.getKey()))
sb.append(',').append(entry.getKey().getName()).append('=').append(entry.getKey().getName(entry.getValue()));
}
return sb.toString();
}
private static boolean makeMap(TagObject tag) {
Set<String> removed = Sets.newHashSet();
for(String id : tag.keySet()) {
@ -86,10 +50,9 @@ public class Region {
for(int z = 0; z < 4096; z++) {
Block block = BlockRegistry.getBlockById(z);
if(block != Blocks.air) {
Set<Property> stored = getSavedProperties(block);
for(int n = 0; n < 16; n++) {
State state = block.getStateFromMeta(n);
String id = filterProperties(state, stored);
String id = state.getId();
List<Character> ids = current.get(id);
char mid = (char)BlockRegistry.STATEMAP.get(state);
if(ids == null) {