mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-19 07:11:14 +00:00
rename main parameters/fields to platform
This commit is contained in:
+6
-6
@@ -17,17 +17,17 @@ import com.dfsek.terra.api.inject.annotations.Inject;
|
||||
@Version("1.0.0")
|
||||
public class BiomeAddon extends TerraAddon {
|
||||
@Inject
|
||||
private Platform main;
|
||||
private Platform platform;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
main.getEventManager()
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(this, ConfigPackPreLoadEvent.class)
|
||||
.then(event -> {
|
||||
platform.getEventManager()
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(this, ConfigPackPreLoadEvent.class)
|
||||
.then(event -> {
|
||||
event.getPack().registerConfigType(new BiomeConfigType(event.getPack()), "BIOME", 5);
|
||||
event.getPack().applyLoader(PaletteHolder.class, new PaletteHolderLoader());
|
||||
})
|
||||
.failThrough();
|
||||
.failThrough();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -35,8 +35,8 @@ public class BiomeConfigType implements ConfigType<BiomeTemplate, TerraBiome> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeTemplate getTemplate(ConfigPack pack, Platform main) {
|
||||
return new BiomeTemplate(pack, main);
|
||||
public BiomeTemplate getTemplate(ConfigPack pack, Platform platform) {
|
||||
return new BiomeTemplate(pack, platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class BiomeFactory implements ConfigFactory<BiomeTemplate, TerraBiome> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerraBiome build(BiomeTemplate template, Platform main) {
|
||||
public TerraBiome build(BiomeTemplate template, Platform platform) {
|
||||
UserDefinedGenerationSettings generator = new UserDefinedGenerationSettings(template.getNoiseEquation(),
|
||||
template.getElevationEquation(),
|
||||
template.getCarvingEquation(), template.getBiomeNoise(),
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public class BiomeTemplate implements AbstractableTemplate, ValidatedConfigTempl
|
||||
private @Meta Map<String, @Meta Integer> colors = new HashMap<>();
|
||||
// Plain ol' map, so platforms can decide what to do with colors (if anything).
|
||||
|
||||
public BiomeTemplate(ConfigPack pack, Platform main) {
|
||||
public BiomeTemplate(ConfigPack pack, Platform platform) {
|
||||
this.pack = pack;
|
||||
}
|
||||
|
||||
|
||||
+7
-6
@@ -1,10 +1,11 @@
|
||||
package com.dfsek.terra.addons.biome.command.biome;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.World;
|
||||
import com.dfsek.terra.api.world.biome.TerraBiome;
|
||||
@@ -23,15 +24,15 @@ public class AsyncBiomeFinder implements Runnable {
|
||||
protected final int centerX;
|
||||
protected final int centerZ;
|
||||
protected final World world;
|
||||
protected final Platform main;
|
||||
protected final Platform platform;
|
||||
private final Consumer<Vector3> callback;
|
||||
protected int searchSize = 1;
|
||||
|
||||
public AsyncBiomeFinder(BiomeProvider provider, TerraBiome target, @NotNull Vector3 origin, World world, int startRadius, int maxRadius,
|
||||
Consumer<Vector3> callback, Platform main) {
|
||||
Consumer<Vector3> callback, Platform platform) {
|
||||
this.provider = provider;
|
||||
this.target = target;
|
||||
this.main = main;
|
||||
this.platform = platform;
|
||||
this.startRadius = startRadius;
|
||||
this.maxRadius = maxRadius;
|
||||
this.centerX = origin.getBlockX();
|
||||
@@ -41,7 +42,7 @@ public class AsyncBiomeFinder implements Runnable {
|
||||
}
|
||||
|
||||
public Vector3 finalizeVector(Vector3 orig) {
|
||||
return orig.multiply(main.getTerraConfig().getBiomeSearchResolution());
|
||||
return orig.multiply(platform.getTerraConfig().getBiomeSearchResolution());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,7 +91,7 @@ public class AsyncBiomeFinder implements Runnable {
|
||||
* @return TerraBiome at coordinates
|
||||
*/
|
||||
public boolean isValid(int x, int z, TerraBiome target) {
|
||||
int res = main.getTerraConfig().getBiomeSearchResolution();
|
||||
int res = platform.getTerraConfig().getBiomeSearchResolution();
|
||||
return getProvider().getBiome(x * res, z * res, world.getSeed()).equals(target);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
@PlayerCommand
|
||||
public class BiomeCommand implements CommandTemplate {
|
||||
@Inject
|
||||
private Platform main;
|
||||
private Platform platform;
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender) {
|
||||
|
||||
+4
-4
@@ -51,7 +51,7 @@ public class BiomeLocateCommand implements CommandTemplate {
|
||||
private boolean teleport;
|
||||
|
||||
@Inject
|
||||
private Platform main;
|
||||
private Platform platform;
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender) {
|
||||
@@ -59,7 +59,7 @@ public class BiomeLocateCommand implements CommandTemplate {
|
||||
Player player = (Player) sender;
|
||||
|
||||
new Thread(new AsyncBiomeFinder(player.world().getBiomeProvider(), biome,
|
||||
player.position().clone().multiply((1D / main.getTerraConfig().getBiomeSearchResolution())),
|
||||
player.position().clone().multiply((1D / platform.getTerraConfig().getBiomeSearchResolution())),
|
||||
player.world(), 0, radius, location -> {
|
||||
if(location != null) {
|
||||
sender.sendMessage(
|
||||
@@ -67,11 +67,11 @@ public class BiomeLocateCommand implements CommandTemplate {
|
||||
location.getBlockX(), location.getBlockZ(),
|
||||
location.add(new Vector3(0, player.position().getY(), 0)).distance(player.position())));
|
||||
if(teleport) {
|
||||
main.runPossiblyUnsafeTask(
|
||||
platform.runPossiblyUnsafeTask(
|
||||
() -> player.position(new Vector3(location.getX(), player.position().getY(), location.getZ())));
|
||||
}
|
||||
} else sender.sendMessage("Unable to locate biome \"" + biome.getID() + "\"");
|
||||
}, main), "Biome Location Thread").start();
|
||||
}, platform), "Biome Location Thread").start();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import com.dfsek.terra.api.world.biome.TerraBiome;
|
||||
|
||||
public class BiomeArgumentParser implements ArgumentParser<TerraBiome> {
|
||||
@Inject
|
||||
private Platform main;
|
||||
private Platform platform;
|
||||
|
||||
@Override
|
||||
public TerraBiome parse(CommandSender sender, String arg) {
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import com.dfsek.terra.api.world.biome.TerraBiome;
|
||||
|
||||
public class BiomeTabCompleter implements TabCompleter {
|
||||
@Inject
|
||||
private Platform main;
|
||||
private Platform platform;
|
||||
|
||||
@Override
|
||||
public List<String> complete(CommandSender sender) {
|
||||
|
||||
Reference in New Issue
Block a user