This commit is contained in:
dfsek
2021-02-06 22:03:46 -07:00
parent 985443e228
commit 85efa44673
10 changed files with 17 additions and 121 deletions

View File

@@ -1,10 +0,0 @@
package com.dfsek.terra.api.math.parsii.defined;
import com.dfsek.terra.api.util.seeded.SeededBuilder;
public class DefinedFunctionTemplate implements SeededBuilder<UserDefinedFunction> {
@Override
public UserDefinedFunction apply(Long aLong) {
return null;
}
}

View File

@@ -65,7 +65,7 @@ public class Vector2 implements Cloneable {
/**
* Add this vector to another.
*
* @param other Vector to increment
* @param other Vector to add
* @return Mutated vector, for chaining.
*/
public Vector2 add(Vector2 other) {

View File

@@ -9,7 +9,7 @@ public interface BiomeGrid extends Handle {
*
* @param x - 0-15
* @param z - 0-15
* @return TerraBiome value
* @return Biome value
*/
@NotNull
Biome getBiome(int x, int z);
@@ -20,7 +20,7 @@ public interface BiomeGrid extends Handle {
* @param x - 0-15
* @param y - 0-255
* @param z - 0-15
* @return TerraBiome value
* @return Biome value
*/
@NotNull
Biome getBiome(int x, int y, int z);
@@ -30,7 +30,7 @@ public interface BiomeGrid extends Handle {
*
* @param x - 0-15
* @param z - 0-15
* @param bio - TerraBiome value
* @param bio - Biome value
*/
void setBiome(int x, int z, @NotNull Biome bio);
@@ -40,7 +40,7 @@ public interface BiomeGrid extends Handle {
* @param x - 0-15
* @param y - 0-255
* @param z - 0-15
* @param bio - TerraBiome value
* @param bio - Biome value
*/
void setBiome(int x, int y, int z, @NotNull Biome bio);
}

View File

@@ -44,9 +44,9 @@ import java.util.concurrent.ExecutionException;
public class StructureScript {
private final Block block;
private final String id;
String tempID;
private final Cache<Location, StructureBuffer> cache;
private final TerraPlugin main;
String tempID;
public StructureScript(InputStream inputStream, TerraPlugin main, ScriptRegistry registry, LootRegistry lootRegistry, SamplerCache cache) throws ParseException {
Parser parser;
@@ -143,14 +143,12 @@ public class StructureScript {
}
private boolean applyBlock(TerraImplementationArguments arguments) {
synchronized(block) {
try {
return !block.apply(arguments).getLevel().equals(Block.ReturnLevel.FAIL);
} catch(RuntimeException e) {
main.getLogger().severe("Failed to generate structure at " + arguments.getBuffer().getOrigin() + ": " + e.getMessage());
main.getDebugLogger().stack(e);
return false;
}
try {
return !block.apply(arguments).getLevel().equals(Block.ReturnLevel.FAIL);
} catch(RuntimeException e) {
main.getLogger().severe("Failed to generate structure at " + arguments.getBuffer().getOrigin() + ": " + e.getMessage());
main.getDebugLogger().stack(e);
return false;
}
}
}

View File

@@ -9,8 +9,7 @@ import com.dfsek.terra.api.world.biome.Generator;
import java.util.Set;
/**
* Interface to be implemented by a custom generator's TerraBiome enum.<br>
* Represents a custom biome, and contains methods to retrieve information about each type.
* Represents a custom biome
*/
public interface TerraBiome {

View File

@@ -1,57 +0,0 @@
package com.dfsek.terra.debug.gui;
import com.dfsek.terra.api.core.TerraPlugin;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
public class DebugFrame extends JFrame implements ActionListener {
private static final long serialVersionUID = 9133084939622854303L;
private final int x;
private final int z;
private final BufferedImage img;
private final TerraPlugin main;
public DebugFrame(BufferedImage image, String s, TerraPlugin main) {
super(s);
this.x = image.getWidth();
this.z = image.getHeight();
this.img = image;
this.main = main;
new Timer(500, this).start();
}
@Override
public void paint(Graphics g) {
super.paintComponents(g);
/*
for(Player p : Bukkit.getOnlinePlayers()) {
int xp = (int) (((double) FastMath.floorMod(p.getLocation().getBlockX() - (img.getWidth() / 2), x) / x) * getWidth());
int zp = (int) (((double) FastMath.floorMod(p.getLocation().getBlockZ() - (img.getHeight() / 2), z) / z) * getHeight());
ImageLoader loader = main.getWorld(p.getWorld()).getConfig().getTemplate().getImageLoader();
if(loader != null && loader.getAlign().equals(ImageLoader.Align.NONE)) {
xp = (int) (((double) FastMath.floorMod(p.getLocation().getBlockX(), x) / x) * getWidth());
zp = (int) (((double) FastMath.floorMod(p.getLocation().getBlockZ(), z) / z) * getHeight());
}
String str = ((UserDefinedBiome) main.getWorld(p.getWorld()).getGrid().getBiome(p.getLocation(), GenerationPhase.POPULATE)).getID();
g.setColor(new Color(255, 255, 255, 128));
g.fillRect(xp + 13, zp - 13, (int) (8 + 8.25 * str.length()), 33);
g.setColor(Color.BLACK);
g.drawString(p.getName(), xp + 15, zp);
g.drawString(str, xp + 15, zp + 15);
g.fillOval(xp, zp, 10, 10);
g.setColor(Color.RED);
g.fillOval(xp + 3, zp + 3, 5, 5);
}
*/
}
@Override
public void actionPerformed(ActionEvent e) {
this.repaint();
}
}

View File

@@ -1,34 +0,0 @@
package com.dfsek.terra.debug.gui;
import com.dfsek.terra.api.core.TerraPlugin;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
public class DebugGUI extends Thread {
private final BufferedImage img;
private final TerraPlugin main;
public DebugGUI(BufferedImage img, TerraPlugin main) {
this.img = img;
this.main = main;
}
@Override
public void run() {
DebugFrame frame = new DebugFrame(img, "Image2Map DebugLogger GUI", main);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setSize(1000, 1000);
frame.setResizable(false);
ImageIcon imageIcon = new ImageIcon(img.getScaledInstance(1000, 1000, Image.SCALE_SMOOTH));
JLabel jLabel = new JLabel();
jLabel.setIcon(imageIcon);
frame.getContentPane().add(jLabel, BorderLayout.CENTER);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}

View File

@@ -25,7 +25,7 @@ command:
biome-found: "Bioom geleë te (%1$s, %2$s)"
unable-to-locate: "Kan bioom nie opspoor nie."
invalid-radius: "Ongeldige radius: \"%s\""
invalid: "Ongeldige TerraBiome-ID: \"%s\""
invalid: "Ongeldige Biome-ID: \"%s\""
in: "Jy is in \"%s\""
ore:
main-menu:

View File

@@ -56,7 +56,7 @@ command:
gui:
main-menu:
- "-------------Terra/image/gui-------------"
- "raw - Öffnet eine GUI mit TerraBiome-Rohdaten"
- "raw - Öffnet eine GUI mit Biome-Rohdaten"
- "step - Daten erneut rendern, um Ränder deutlicher darzustellen"
debug: "Der Debug-Modus muss aktiviert sein, um die Debug-GUI verwenden zu können! Die Debug-GUI ist NICHT PRODUKTIONSSICHER!"
render:

View File

@@ -26,7 +26,7 @@ command:
biome-found: "Located biome at (%1$s, %2$s)"
unable-to-locate: "Unable to locate biome."
invalid-radius: "Invalid radius: \"%s\""
invalid: "Invalid TerraBiome ID: \"%s\""
invalid: "Invalid Biome ID: \"%s\""
in: "You are in \"%s\""
packs:
main: "Currently installed config packs:"
@@ -61,7 +61,7 @@ command:
gui:
main-menu:
- "-------------Terra/image/gui-------------"
- "raw - Open GUI with raw TerraBiome data"
- "raw - Open GUI with raw Biome data"
- "step - Re-render data to show borders more clearly"
debug: "Debug mode must be enabled to use the debug GUI! The debug GUI is NOT PRODUCTION SAFE!"
render: