mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-19 07:11:14 +00:00
begin tectonic update process
This commit is contained in:
+1
-1
@@ -44,7 +44,7 @@ public class PaletteConfigType implements ConfigType<PaletteTemplate, Palette> {
|
||||
return new PaletteImpl.Singleton(main.getWorldHandle().createBlockData(((String) c).substring(6))); // Return single palette for BLOCK: shortcut.
|
||||
Palette obj = registry.get((String) c);
|
||||
if(obj == null)
|
||||
throw new LoadException("No such " + t.getTypeName() + " matching \"" + c + "\" was found in this registry.");
|
||||
throw new LoadException("No such " + t.getType().getTypeName() + " matching \"" + c + "\" was found in this registry.");
|
||||
return obj;
|
||||
});
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,7 +1,7 @@
|
||||
package com.dfsek.terra.addons.palette;
|
||||
|
||||
import com.dfsek.tectonic.annotations.Abstractable;
|
||||
import com.dfsek.tectonic.annotations.Default;
|
||||
import com.dfsek.tectonic.annotations.Final;
|
||||
import com.dfsek.tectonic.annotations.Value;
|
||||
import com.dfsek.terra.addons.palette.palette.PaletteLayerHolder;
|
||||
import com.dfsek.terra.api.config.AbstractableTemplate;
|
||||
@@ -12,15 +12,14 @@ import java.util.List;
|
||||
@SuppressWarnings({"FieldMayBeFinal", "unused"})
|
||||
public class PaletteTemplate implements AbstractableTemplate {
|
||||
@Value("noise")
|
||||
@Abstractable
|
||||
@Default
|
||||
private NoiseSeeded noise = NoiseSeeded.zero(2);
|
||||
|
||||
@Value("id")
|
||||
@Final
|
||||
private String id;
|
||||
|
||||
@Value("layers")
|
||||
@Abstractable
|
||||
private List<PaletteLayerHolder> palette;
|
||||
|
||||
public String getID() {
|
||||
|
||||
+5
-4
@@ -8,16 +8,17 @@ import com.dfsek.terra.api.noise.NoiseSampler;
|
||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||
import com.dfsek.terra.api.util.seeded.NoiseSeeded;
|
||||
|
||||
import java.lang.reflect.AnnotatedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class PaletteLayerLoader implements TypeLoader<PaletteLayerHolder> {
|
||||
private static final Type BLOCK_DATA_PROBABILITY_COLLECTION_TYPE;
|
||||
private static final AnnotatedType BLOCK_DATA_PROBABILITY_COLLECTION_TYPE;
|
||||
|
||||
static {
|
||||
try {
|
||||
BLOCK_DATA_PROBABILITY_COLLECTION_TYPE = PaletteLayerLoader.class.getDeclaredField("blockStateProbabilityCollection").getGenericType();
|
||||
BLOCK_DATA_PROBABILITY_COLLECTION_TYPE = PaletteLayerLoader.class.getDeclaredField("blockStateProbabilityCollection").getAnnotatedType();
|
||||
} catch(NoSuchFieldException e) {
|
||||
throw new Error("this should never happen. i dont know what you did to make this happen but something is very wrong.", e);
|
||||
}
|
||||
@@ -27,13 +28,13 @@ public class PaletteLayerLoader implements TypeLoader<PaletteLayerHolder> {
|
||||
private ProbabilityCollection<BlockState> blockStateProbabilityCollection;
|
||||
|
||||
@Override
|
||||
public PaletteLayerHolder load(Type type, Object o, ConfigLoader configLoader) throws LoadException {
|
||||
public PaletteLayerHolder load(AnnotatedType type, Object o, ConfigLoader configLoader) throws LoadException {
|
||||
Map<String, Object> map = (Map<String, Object>) o;
|
||||
ProbabilityCollection<BlockState> collection = (ProbabilityCollection<BlockState>) configLoader.loadType(BLOCK_DATA_PROBABILITY_COLLECTION_TYPE, map.get("materials"));
|
||||
|
||||
NoiseSampler sampler = null;
|
||||
if(map.containsKey("noise")) {
|
||||
sampler = configLoader.loadClass(NoiseSeeded.class, map.get("noise")).apply(2403L);
|
||||
sampler = configLoader.loadType(NoiseSeeded.class, map.get("noise")).apply(2403L);
|
||||
}
|
||||
|
||||
if(collection == null) throw new LoadException("Collection is null: " + map.get("materials"));
|
||||
|
||||
Reference in New Issue
Block a user