mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-06 15:56:14 +00:00
fabric pass 1
This commit is contained in:
@@ -2,7 +2,7 @@ package com.dfsek.terra.api.util.logging;
|
||||
|
||||
import com.dfsek.terra.api.Logger;
|
||||
|
||||
public class DebugLogger {
|
||||
public class DebugLogger implements Logger {
|
||||
private final Logger logger;
|
||||
private boolean debug = false;
|
||||
|
||||
@@ -22,15 +22,15 @@ public class DebugLogger {
|
||||
if(debug) logger.info(message);
|
||||
}
|
||||
|
||||
public void warn(String message) {
|
||||
public void warning(String message) {
|
||||
if(debug) logger.warning(message);
|
||||
}
|
||||
|
||||
public void error(String message) {
|
||||
public void severe(String message) {
|
||||
if(debug) logger.severe(message);
|
||||
}
|
||||
|
||||
public void stack(Exception e) {
|
||||
public void stack(Throwable e) {
|
||||
if(debug) e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,4 +338,34 @@ public class ConfigPackImpl implements ConfigPack {
|
||||
public String getVersion() {
|
||||
return template.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean vanillaMobs() {
|
||||
return template.vanillaMobs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean vanillaStructures() {
|
||||
return template.vanillaStructures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean vanillaCaves() {
|
||||
return template.vanillaCaves();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disableStructures() {
|
||||
return template.disableStructures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getLocatable() {
|
||||
return template.getLocatable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doBetaCarvers() {
|
||||
return template.doBetaCarvers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,21 @@ public class WorldConfigImpl implements WorldConfig {
|
||||
return pack.getTemplate().disableStructures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return pack.getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthor() {
|
||||
return pack.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return pack.getVersion();
|
||||
}
|
||||
|
||||
public Set<TerraStructure> getStructures() {
|
||||
return new HashSet<>(getRegistry(TerraStructure.class).entries());
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.dfsek.terra.registry.master;
|
||||
|
||||
import com.dfsek.tectonic.exception.ConfigException;
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.config.pack.ConfigPackImpl;
|
||||
import com.dfsek.terra.registry.OpenRegistryImpl;
|
||||
|
||||
@@ -12,10 +13,10 @@ import java.util.zip.ZipFile;
|
||||
/**
|
||||
* Class to hold config packs
|
||||
*/
|
||||
public class ConfigRegistry extends OpenRegistryImpl<ConfigPackImpl> {
|
||||
public class ConfigRegistry extends OpenRegistryImpl<ConfigPack> {
|
||||
public void load(File folder, TerraPlugin main) throws ConfigException {
|
||||
ConfigPackImpl pack = new ConfigPackImpl(folder, main);
|
||||
add(pack.getTemplate().getID(), pack);
|
||||
ConfigPack pack = new ConfigPackImpl(folder, main);
|
||||
add(pack.getID(), pack);
|
||||
}
|
||||
|
||||
public boolean loadAll(TerraPlugin main) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.world;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.event.events.world.TerraWorldLoadEvent;
|
||||
import com.dfsek.terra.api.vector.Location;
|
||||
import com.dfsek.terra.api.world.TerraWorld;
|
||||
@@ -24,10 +25,10 @@ public class TerraWorldImpl implements TerraWorld {
|
||||
private final BlockData air;
|
||||
|
||||
|
||||
public TerraWorldImpl(World w, ConfigPackImpl c, TerraPlugin main) {
|
||||
public TerraWorldImpl(World w, ConfigPack c, TerraPlugin main) {
|
||||
if(!w.isTerraWorld()) throw new IllegalArgumentException("World " + w + " is not a Terra World!");
|
||||
this.world = w;
|
||||
config = c.toWorldConfig(this);
|
||||
config = (WorldConfigImpl) c.toWorldConfig(this);
|
||||
this.provider = config.getProvider();
|
||||
air = main.getWorldHandle().createBlockData("minecraft:air");
|
||||
main.getEventManager().callEvent(new TerraWorldLoadEvent(this, c));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.world.generation.generators;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.math.range.ConstantRange;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.TerraWorld;
|
||||
@@ -43,7 +44,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
private final ConfigPackImpl configPack;
|
||||
private final ConfigPack configPack;
|
||||
private final TerraPlugin main;
|
||||
private final BlockType water;
|
||||
private final PaletteImpl.Singleton blank;
|
||||
@@ -51,7 +52,7 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
|
||||
private final Carver carver;
|
||||
|
||||
public DefaultChunkGenerator3D(ConfigPackImpl c, TerraPlugin main) {
|
||||
public DefaultChunkGenerator3D(ConfigPack c, TerraPlugin main) {
|
||||
this.configPack = c;
|
||||
this.main = main;
|
||||
|
||||
@@ -67,7 +68,7 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigPackImpl getConfigPack() {
|
||||
public ConfigPack getConfigPack() {
|
||||
return configPack;
|
||||
}
|
||||
|
||||
@@ -131,7 +132,7 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(configPack.getTemplate().doBetaCarvers()) {
|
||||
if(configPack.doBetaCarvers()) {
|
||||
carver.carve(world, chunkX, chunkZ, chunk);
|
||||
}
|
||||
return chunk;
|
||||
|
||||
Reference in New Issue
Block a user