Fix transparency

This commit is contained in:
IntegratedQuantum 2019-03-26 18:29:18 +01:00
parent e20df9e42a
commit c7a277da8e
2 changed files with 14 additions and 5 deletions

View File

@ -6,8 +6,6 @@ import java.util.List;
import io.cubyz.CubyzLogger;
public class Registry<T extends IRegistryElement> {
private int IDs = 0;
private HashMap<String, T> hashMap = new HashMap<>();
private boolean debug = Boolean.parseBoolean(System.getProperty("registry.debugEnabled", "false"));
private boolean alwaysError = Boolean.parseBoolean(System.getProperty("registry.dumpAsError", "true"));
@ -36,8 +34,6 @@ public class Registry<T extends IRegistryElement> {
System.err.flush();
return;
}
element.setID(IDs);
IDs++;
hashMap.put(element.getRegistryID().toString(), element);
if (debug) {
CubyzLogger.instance.info("Registered " + getType(element.getClass()) + " as " + element.getRegistryID());

View File

@ -224,11 +224,24 @@ public class LocalWorld extends World {
public void generate() {
Random r = new Random();
int ID = 0;
seed = r.nextInt();
blocks = new Block[CubzRegistries.BLOCK_REGISTRY.registered().length];
for (IRegistryElement ire : CubzRegistries.BLOCK_REGISTRY.registered()) {
Block b = (Block) ire;
blocks[b.ID] = b;
if(!b.isTransparent()) {
blocks[ID] = b;
b.ID = ID;
ID++;
}
}
for (IRegistryElement ire : CubzRegistries.BLOCK_REGISTRY.registered()) {
Block b = (Block) ire;
if(b.isTransparent()) {
blocks[ID] = b;
b.ID = ID;
ID++;
}
}
}