mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 06:40:55 +00:00
Change Java whitespace handling in .editorconfig (#425)
* Change whitespace handling in .editorconfig * Reformat code * fix format error * Reformat code --------- Co-authored-by: Zoë Gidiere <duplexsys@protonmail.com>
This commit is contained in:
+9
-9
@@ -20,19 +20,19 @@ import com.dfsek.terra.api.inject.annotations.Inject;
|
||||
public class BiomeAddon implements AddonInitializer {
|
||||
@Inject
|
||||
private Platform platform;
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseAddon addon;
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
platform.getEventManager()
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(addon, ConfigPackPreLoadEvent.class)
|
||||
.then(event -> {
|
||||
event.getPack().registerConfigType(new BiomeConfigType(event.getPack()), addon.key("BIOME"), 1000);
|
||||
event.getPack().applyLoader(PaletteHolder.class, new PaletteHolderLoader());
|
||||
})
|
||||
.failThrough();
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(addon, ConfigPackPreLoadEvent.class)
|
||||
.then(event -> {
|
||||
event.getPack().registerConfigType(new BiomeConfigType(event.getPack()), addon.key("BIOME"), 1000);
|
||||
event.getPack().applyLoader(PaletteHolder.class, new PaletteHolderLoader());
|
||||
})
|
||||
.failThrough();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -19,21 +19,21 @@ public class BiomeConfigType implements ConfigType<BiomeTemplate, Biome> {
|
||||
public static final TypeKey<Biome> BIOME_TYPE_TOKEN = new TypeKey<>() {
|
||||
};
|
||||
private final BiomeFactory factory;
|
||||
|
||||
|
||||
public BiomeConfigType(ConfigPack pack) {
|
||||
this.factory = new BiomeFactory(pack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BiomeTemplate getTemplate(ConfigPack pack, Platform platform) {
|
||||
return new BiomeTemplate(pack, platform);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ConfigFactory<BiomeTemplate, Biome> getFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TypeKey<Biome> getTypeKey() {
|
||||
return BIOME_TYPE_TOKEN;
|
||||
|
||||
+2
-2
@@ -15,11 +15,11 @@ import com.dfsek.terra.api.world.biome.Biome;
|
||||
|
||||
public class BiomeFactory implements ConfigFactory<BiomeTemplate, Biome> {
|
||||
private final ConfigPack pack;
|
||||
|
||||
|
||||
public BiomeFactory(ConfigPack pack) {
|
||||
this.pack = pack;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Biome build(BiomeTemplate template, Platform platform) {
|
||||
return new UserDefinedBiome(template.getVanilla(), template);
|
||||
|
||||
+12
-12
@@ -27,19 +27,19 @@ import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
@SuppressWarnings({ "FieldMayBeFinal", "unused" })
|
||||
public class BiomeTemplate implements AbstractableTemplate, ValidatedConfigTemplate {
|
||||
private final ConfigPack pack;
|
||||
|
||||
|
||||
@Value("id")
|
||||
@Final
|
||||
private @Meta String id;
|
||||
|
||||
|
||||
@Value("extends")
|
||||
@Final
|
||||
@Default
|
||||
private List<String> extended = Collections.emptyList();
|
||||
|
||||
|
||||
@Value("vanilla")
|
||||
private @Meta PlatformBiome vanilla;
|
||||
|
||||
|
||||
@Value("color")
|
||||
@Final
|
||||
@Default
|
||||
@@ -47,37 +47,37 @@ public class BiomeTemplate implements AbstractableTemplate, ValidatedConfigTempl
|
||||
@Value("tags")
|
||||
@Default
|
||||
private @Meta Set<@Meta String> tags = new HashSet<>();
|
||||
|
||||
|
||||
public BiomeTemplate(ConfigPack pack, Platform platform) {
|
||||
this.pack = pack;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
color |= 0xff000000; // Alpha adjustment
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getExtended() {
|
||||
return extended;
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
public ConfigPack getPack() {
|
||||
return pack;
|
||||
}
|
||||
|
||||
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public PlatformBiome getVanilla() {
|
||||
return vanilla;
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,11 +14,11 @@ import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
||||
|
||||
public class PaletteSettingsImpl implements PaletteSettings {
|
||||
private final PaletteHolder palette;
|
||||
|
||||
|
||||
public PaletteSettingsImpl(PaletteHolder palette) {
|
||||
this.palette = palette;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Palette getPalette(int y) {
|
||||
return palette.getPalette(y);
|
||||
|
||||
+9
-9
@@ -23,9 +23,9 @@ public class UserDefinedBiome implements Biome {
|
||||
private final BiomeTemplate config;
|
||||
private final int color;
|
||||
private final Set<String> tags;
|
||||
|
||||
|
||||
private final Context context = new Context();
|
||||
|
||||
|
||||
public UserDefinedBiome(PlatformBiome vanilla, BiomeTemplate config) {
|
||||
this.vanilla = vanilla;
|
||||
this.id = config.getID();
|
||||
@@ -35,12 +35,12 @@ public class UserDefinedBiome implements Biome {
|
||||
tags.add("BIOME:" + id);
|
||||
tags.add("ALL");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{BIOME:" + getID() + "}";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the Vanilla biomes to represent the custom biome.
|
||||
*
|
||||
@@ -50,26 +50,26 @@ public class UserDefinedBiome implements Biome {
|
||||
public PlatformBiome getPlatformBiome() {
|
||||
return vanilla;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public BiomeTemplate getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Context getContext() {
|
||||
return context;
|
||||
|
||||
+2
-2
@@ -13,12 +13,12 @@ import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
||||
public class PaletteHolder {
|
||||
private final Palette[] palettes;
|
||||
private final int offset;
|
||||
|
||||
|
||||
protected PaletteHolder(Palette[] palettes, int offset) {
|
||||
this.palettes = palettes;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
|
||||
public Palette getPalette(int y) {
|
||||
int index = y + offset;
|
||||
return index >= 0
|
||||
|
||||
+4
-4
@@ -15,17 +15,17 @@ import com.dfsek.terra.api.world.chunk.generation.util.Palette;
|
||||
|
||||
public class PaletteHolderBuilder {
|
||||
private final TreeMap<Integer, Palette> paletteMap = new TreeMap<>();
|
||||
|
||||
|
||||
public PaletteHolderBuilder add(int y, Palette palette) {
|
||||
paletteMap.put(y, palette);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public PaletteHolder build() {
|
||||
|
||||
|
||||
int min = Math.min(paletteMap.keySet().stream().min(Integer::compareTo).orElse(0), 0);
|
||||
int max = Math.max(paletteMap.keySet().stream().max(Integer::compareTo).orElse(255), 255);
|
||||
|
||||
|
||||
Palette[] palettes = new Palette[paletteMap.lastKey() + 1 - min];
|
||||
for(int y = min; y <= Math.max(paletteMap.lastKey(), max); y++) {
|
||||
Palette d = null;
|
||||
|
||||
Reference in New Issue
Block a user