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
@@ -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;
}
}
@@ -65,7 +65,7 @@ public class Vector2 implements Cloneable {
/** /**
* Add this vector to another. * Add this vector to another.
* *
* @param other Vector to increment * @param other Vector to add
* @return Mutated vector, for chaining. * @return Mutated vector, for chaining.
*/ */
public Vector2 add(Vector2 other) { public Vector2 add(Vector2 other) {
@@ -9,7 +9,7 @@ public interface BiomeGrid extends Handle {
* *
* @param x - 0-15 * @param x - 0-15
* @param z - 0-15 * @param z - 0-15
* @return TerraBiome value * @return Biome value
*/ */
@NotNull @NotNull
Biome getBiome(int x, int z); Biome getBiome(int x, int z);
@@ -20,7 +20,7 @@ public interface BiomeGrid extends Handle {
* @param x - 0-15 * @param x - 0-15
* @param y - 0-255 * @param y - 0-255
* @param z - 0-15 * @param z - 0-15
* @return TerraBiome value * @return Biome value
*/ */
@NotNull @NotNull
Biome getBiome(int x, int y, int z); Biome getBiome(int x, int y, int z);
@@ -30,7 +30,7 @@ public interface BiomeGrid extends Handle {
* *
* @param x - 0-15 * @param x - 0-15
* @param z - 0-15 * @param z - 0-15
* @param bio - TerraBiome value * @param bio - Biome value
*/ */
void setBiome(int x, int z, @NotNull Biome bio); void setBiome(int x, int z, @NotNull Biome bio);
@@ -40,7 +40,7 @@ public interface BiomeGrid extends Handle {
* @param x - 0-15 * @param x - 0-15
* @param y - 0-255 * @param y - 0-255
* @param z - 0-15 * @param z - 0-15
* @param bio - TerraBiome value * @param bio - Biome value
*/ */
void setBiome(int x, int y, int z, @NotNull Biome bio); void setBiome(int x, int y, int z, @NotNull Biome bio);
} }
@@ -44,9 +44,9 @@ import java.util.concurrent.ExecutionException;
public class StructureScript { public class StructureScript {
private final Block block; private final Block block;
private final String id; private final String id;
String tempID;
private final Cache<Location, StructureBuffer> cache; private final Cache<Location, StructureBuffer> cache;
private final TerraPlugin main; private final TerraPlugin main;
String tempID;
public StructureScript(InputStream inputStream, TerraPlugin main, ScriptRegistry registry, LootRegistry lootRegistry, SamplerCache cache) throws ParseException { public StructureScript(InputStream inputStream, TerraPlugin main, ScriptRegistry registry, LootRegistry lootRegistry, SamplerCache cache) throws ParseException {
Parser parser; Parser parser;
@@ -143,7 +143,6 @@ public class StructureScript {
} }
private boolean applyBlock(TerraImplementationArguments arguments) { private boolean applyBlock(TerraImplementationArguments arguments) {
synchronized(block) {
try { try {
return !block.apply(arguments).getLevel().equals(Block.ReturnLevel.FAIL); return !block.apply(arguments).getLevel().equals(Block.ReturnLevel.FAIL);
} catch(RuntimeException e) { } catch(RuntimeException e) {
@@ -152,5 +151,4 @@ public class StructureScript {
return false; return false;
} }
} }
}
} }
@@ -9,8 +9,7 @@ import com.dfsek.terra.api.world.biome.Generator;
import java.util.Set; import java.util.Set;
/** /**
* Interface to be implemented by a custom generator's TerraBiome enum.<br> * Represents a custom biome
* Represents a custom biome, and contains methods to retrieve information about each type.
*/ */
public interface TerraBiome { public interface TerraBiome {
@@ -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();
}
}
@@ -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);
}
}
@@ -25,7 +25,7 @@ command:
biome-found: "Bioom geleë te (%1$s, %2$s)" biome-found: "Bioom geleë te (%1$s, %2$s)"
unable-to-locate: "Kan bioom nie opspoor nie." unable-to-locate: "Kan bioom nie opspoor nie."
invalid-radius: "Ongeldige radius: \"%s\"" invalid-radius: "Ongeldige radius: \"%s\""
invalid: "Ongeldige TerraBiome-ID: \"%s\"" invalid: "Ongeldige Biome-ID: \"%s\""
in: "Jy is in \"%s\"" in: "Jy is in \"%s\""
ore: ore:
main-menu: main-menu:
@@ -56,7 +56,7 @@ command:
gui: gui:
main-menu: main-menu:
- "-------------Terra/image/gui-------------" - "-------------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" - "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!" debug: "Der Debug-Modus muss aktiviert sein, um die Debug-GUI verwenden zu können! Die Debug-GUI ist NICHT PRODUKTIONSSICHER!"
render: render:
@@ -26,7 +26,7 @@ command:
biome-found: "Located biome at (%1$s, %2$s)" biome-found: "Located biome at (%1$s, %2$s)"
unable-to-locate: "Unable to locate biome." unable-to-locate: "Unable to locate biome."
invalid-radius: "Invalid radius: \"%s\"" invalid-radius: "Invalid radius: \"%s\""
invalid: "Invalid TerraBiome ID: \"%s\"" invalid: "Invalid Biome ID: \"%s\""
in: "You are in \"%s\"" in: "You are in \"%s\""
packs: packs:
main: "Currently installed config packs:" main: "Currently installed config packs:"
@@ -61,7 +61,7 @@ command:
gui: gui:
main-menu: main-menu:
- "-------------Terra/image/gui-------------" - "-------------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" - "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!" debug: "Debug mode must be enabled to use the debug GUI! The debug GUI is NOT PRODUCTION SAFE!"
render: render: