mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
implement StringIdentifiable
This commit is contained in:
@@ -16,6 +16,6 @@ public class ScriptCompleter implements TabCompleter {
|
||||
|
||||
@Override
|
||||
public List<String> complete(CommandSender sender) {
|
||||
return ((Player) sender).world().getConfig().getRegistry(Structure.class).entries().stream().map(Structure::getId).collect(Collectors.toList());
|
||||
return ((Player) sender).world().getConfig().getRegistry(Structure.class).entries().stream().map(Structure::getID).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TerraScriptAddon extends TerraAddon {
|
||||
for(Map.Entry<String, InputStream> entry : entries) {
|
||||
try {
|
||||
StructureScript structureScript = new StructureScript(entry.getValue(), main, structureRegistry, lootRegistry, event.getPack().getRegistryFactory().create());
|
||||
structureRegistry.register(structureScript.getId(), structureScript);
|
||||
structureRegistry.register(structureScript.getID(), structureScript);
|
||||
} catch(ParseException e) {
|
||||
throw new LoadException("Failed to load script: ", e);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public class StructureScript implements Structure {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.dfsek.terra.api.config;
|
||||
|
||||
import com.dfsek.tectonic.config.ConfigTemplate;
|
||||
import com.dfsek.terra.api.StringIdentifiable;
|
||||
|
||||
public interface AbstractableTemplate extends ConfigTemplate {
|
||||
String getID();
|
||||
public interface AbstractableTemplate extends ConfigTemplate, StringIdentifiable {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.api.config;
|
||||
|
||||
import com.dfsek.terra.api.StringIdentifiable;
|
||||
import com.dfsek.terra.api.addon.TerraAddon;
|
||||
import com.dfsek.terra.api.registry.CheckedRegistry;
|
||||
import com.dfsek.terra.api.registry.meta.RegistryFactory;
|
||||
@@ -17,7 +18,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ConfigPack extends LoaderRegistrar, LoaderHolder, RegistryHolder {
|
||||
public interface ConfigPack extends LoaderRegistrar, LoaderHolder, RegistryHolder, StringIdentifiable {
|
||||
BiomeProvider getBiomeProviderBuilder();
|
||||
|
||||
<T> CheckedRegistry<T> getOrCreateRegistry(Type clazz);
|
||||
@@ -39,8 +40,6 @@ public interface ConfigPack extends LoaderRegistrar, LoaderHolder, RegistryHolde
|
||||
|
||||
Set<TerraAddon> addons();
|
||||
|
||||
String getID();
|
||||
|
||||
String getAuthor();
|
||||
|
||||
String getVersion();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.api.config;
|
||||
|
||||
import com.dfsek.terra.api.StringIdentifiable;
|
||||
import com.dfsek.terra.api.registry.Registry;
|
||||
import com.dfsek.terra.api.world.World;
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
@@ -7,7 +8,7 @@ import com.dfsek.terra.api.world.generator.SamplerCache;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface WorldConfig {
|
||||
public interface WorldConfig extends StringIdentifiable {
|
||||
<T> Registry<T> getRegistry(Class<T> clazz);
|
||||
|
||||
World getWorld();
|
||||
@@ -30,8 +31,6 @@ public interface WorldConfig {
|
||||
|
||||
boolean disableStructures();
|
||||
|
||||
String getID();
|
||||
|
||||
String getAuthor();
|
||||
|
||||
String getVersion();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.api.structure;
|
||||
|
||||
import com.dfsek.terra.api.StringIdentifiable;
|
||||
import com.dfsek.terra.api.structure.buffer.Buffer;
|
||||
import com.dfsek.terra.api.structure.rotation.Rotation;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
@@ -8,7 +9,7 @@ import com.dfsek.terra.api.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public interface Structure {
|
||||
public interface Structure extends StringIdentifiable {
|
||||
/**
|
||||
* Paste the structure at a location
|
||||
*
|
||||
@@ -31,6 +32,4 @@ public interface Structure {
|
||||
|
||||
@SuppressWarnings("try")
|
||||
boolean generateDirect(Vector3 location, World world, Random random, Rotation rotation);
|
||||
|
||||
String getId();
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.dfsek.terra.api.structure.configured;
|
||||
|
||||
import com.dfsek.terra.api.StringIdentifiable;
|
||||
import com.dfsek.terra.api.structure.Structure;
|
||||
import com.dfsek.terra.api.structure.StructureSpawn;
|
||||
import com.dfsek.terra.api.util.Range;
|
||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||
|
||||
public interface ConfiguredStructure {
|
||||
public interface ConfiguredStructure extends StringIdentifiable {
|
||||
ProbabilityCollection<Structure> getStructure();
|
||||
|
||||
Range getSpawnStart();
|
||||
|
||||
StructureSpawn getSpawn();
|
||||
|
||||
String getID();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user