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