mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
Add more configurability to caves.
This commit is contained in:
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
5
GOOD_PRACTICE.md
Normal file
5
GOOD_PRACTICE.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Things to do:
|
||||
* **Namespace your terrain objects!**
|
||||
Example: Call your forest biome `mycoolgenerator:FOREST` rather than just `FOREST`
|
||||
Why? This way, if someone wishes to install 2 config packs, for different worlds, they don't
|
||||
run into conflicting IDs!
|
||||
2
pom.xml
2
pom.xml
@@ -83,7 +83,7 @@
|
||||
<dependency>
|
||||
<groupId>org.polydev</groupId>
|
||||
<artifactId>gaea</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.7.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -5,12 +5,14 @@ import com.dfsek.terra.biome.TerraBiomeGrid;
|
||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||
import com.dfsek.terra.config.BiomeConfig;
|
||||
import com.dfsek.terra.config.CarverConfig;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.polydev.gaea.world.BlockPalette;
|
||||
import org.polydev.gaea.world.carving.Carver;
|
||||
import org.polydev.gaea.world.carving.Worm;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class UserDefinedCarver extends Carver {
|
||||
@@ -21,7 +23,7 @@ public class UserDefinedCarver extends Carver {
|
||||
private final double[] radiusMultiplier;
|
||||
private final MaxMin length;
|
||||
private final MaxMin radius;
|
||||
public UserDefinedCarver(MaxMin height, MaxMin radius, MaxMin length, double[] start, double[] mutate, double[] radiusMultiplier) {
|
||||
public UserDefinedCarver(MaxMin height, MaxMin radius, MaxMin length, double[] start, double[] mutate, double[] radiusMultiplier) {
|
||||
super(height.getMin(), height.getMax());
|
||||
this.radius = radius;
|
||||
this.length = length;
|
||||
|
||||
@@ -207,13 +207,10 @@ public class BiomeConfig extends YamlConfiguration {
|
||||
paths
|
||||
.filter(path -> FilenameUtils.wildcardMatch(path.toFile().getName(), "*.yml"))
|
||||
.forEach(path -> {
|
||||
logger.info("Loading biome from " + path.toString());
|
||||
try {
|
||||
BiomeConfig biome = new BiomeConfig(path.toFile());
|
||||
biomes.put(biome.getBiomeID(), biome);
|
||||
logger.info("Friendly name: " + biome.getFriendlyName());
|
||||
logger.info("ID: " + biome.getBiomeID());
|
||||
logger.info("Noise equation: " + biome.get("noise-equation"));
|
||||
logger.info("Loaded Biome with name " + biome.getFriendlyName() + ", ID " + biome.getBiomeID() + " and noise equation " + biome.get("noise-equation") + " from " + path.toString());
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch(InvalidConfigurationException | IllegalArgumentException e) {
|
||||
|
||||
@@ -84,12 +84,10 @@ public class BiomeGridConfig extends YamlConfiguration {
|
||||
paths
|
||||
.filter(path -> FilenameUtils.wildcardMatch(path.toFile().getName(), "*.yml"))
|
||||
.forEach(path -> {
|
||||
main.getLogger().info("Loading BiomeGrid from " + path.toString());
|
||||
try {
|
||||
BiomeGridConfig grid = new BiomeGridConfig(path.toFile());
|
||||
biomeGrids.put(grid.getGridID(), grid);
|
||||
main.getLogger().info("Friendly name: " + grid.getFriendlyName());
|
||||
main.getLogger().info("ID: " + grid.getGridID());
|
||||
main.getLogger().info("Loaded BiomeGrid with name " + grid.getFriendlyName() + ", ID " + grid.getGridID() + " from " + path.toString());
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch(InvalidConfigurationException | IllegalArgumentException e) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.dfsek.terra.config;
|
||||
import com.dfsek.terra.MaxMin;
|
||||
import com.dfsek.terra.carving.UserDefinedCarver;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -18,36 +19,32 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CarverConfig extends YamlConfiguration {
|
||||
private static final Map<String, CarverConfig> caveConfig = new HashMap<>();
|
||||
private UserDefinedCarver carver;
|
||||
private MaxMin length;
|
||||
private MaxMin height;
|
||||
private String id;
|
||||
private final Set<Material> replaceableInner = new HashSet<>();
|
||||
private final Set<Material> replaceableOuter = new HashSet<>();
|
||||
private boolean replaceIsBlacklistInner;
|
||||
private boolean replaceIsBlacklistOuter;
|
||||
public CarverConfig(File file) throws IOException, InvalidConfigurationException {
|
||||
super();
|
||||
this.load(file);
|
||||
}
|
||||
|
||||
|
||||
public MaxMin getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public MaxMin getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public UserDefinedCarver getCarver() {
|
||||
return carver;
|
||||
}
|
||||
@@ -55,32 +52,45 @@ public class CarverConfig extends YamlConfiguration {
|
||||
@Override
|
||||
public void load(@NotNull File file) throws IOException, InvalidConfigurationException {
|
||||
super.load(file);
|
||||
BlockPalette inner;
|
||||
if(Objects.requireNonNull(getString("palette.interior")).startsWith("BLOCK:")) {
|
||||
inner = new BlockPalette().addBlockData(new ProbabilityCollection<BlockData>().add(Bukkit.createBlockData(getString("palette.interior").substring(6)), 1), 1);
|
||||
} else {
|
||||
inner = PaletteConfig.fromID(getString("palette.interior")).getPalette();
|
||||
}
|
||||
|
||||
BlockPalette walls;
|
||||
if(Objects.requireNonNull(getString("palette.walls")).startsWith("BLOCK:")) {
|
||||
walls = new BlockPalette().addBlockData(new ProbabilityCollection<BlockData>().add(Bukkit.createBlockData(getString("palette.walls").substring(6)), 1), 1);
|
||||
} else {
|
||||
walls = PaletteConfig.fromID(getString("palette.walls")).getPalette();
|
||||
if(contains("palette.inner.replace")) {
|
||||
for(String s : getStringList("palette.inner.replace")) {
|
||||
replaceableInner.add(Bukkit.createBlockData(s).getMaterial());
|
||||
}
|
||||
}
|
||||
if(contains("palette.outer.replace")) {
|
||||
for(String s : getStringList("palette.outer.replace")) {
|
||||
replaceableOuter.add(Bukkit.createBlockData(s).getMaterial());
|
||||
}
|
||||
}
|
||||
replaceIsBlacklistInner = getBoolean("palette.inner.replace-blacklist", false);
|
||||
replaceIsBlacklistOuter = getBoolean("palette.outer.replace-blacklist", false);
|
||||
|
||||
|
||||
double[] start = new double[] {getDouble("start.x"), getDouble("start.y"), getDouble("start.z")};
|
||||
double[] mutate = new double[] {getDouble("mutate.x"), getDouble("mutate.y"), getDouble("mutate.z"), getDouble("mutate.radius")};
|
||||
double[] radiusMultiplier = new double[] {getDouble("start.radius.multiply.x"), getDouble("start.radius.multiply.y"), getDouble("start.radius.multiply.z")};
|
||||
length = new MaxMin(getInt("length.min"), getInt("length.max"));
|
||||
MaxMin length = new MaxMin(getInt("length.min"), getInt("length.max"));
|
||||
MaxMin radius = new MaxMin(getInt("start.radius.min"), getInt("start.radius.max"));
|
||||
height = new MaxMin(getInt("start.height.min"), getInt("start.height.max"));
|
||||
double radMutate = getDouble("mutate.radius");
|
||||
MaxMin height = new MaxMin(getInt("start.height.min"), getInt("start.height.max"));
|
||||
id = getString("id");
|
||||
carver = new UserDefinedCarver(height, radius, length, start, mutate, radiusMultiplier);
|
||||
}
|
||||
|
||||
public boolean isReplaceableInner(Material m) {
|
||||
if(replaceIsBlacklistInner) {
|
||||
return !replaceableInner.contains(m);
|
||||
}
|
||||
return replaceableInner.contains(m);
|
||||
}
|
||||
|
||||
public boolean isReplaceableOuter(Material m) {
|
||||
if(replaceIsBlacklistOuter) {
|
||||
return !replaceableOuter.contains(m);
|
||||
}
|
||||
return replaceableOuter.contains(m);
|
||||
}
|
||||
|
||||
protected static void loadCaves(JavaPlugin main) {
|
||||
// TODO: Merge all load methods
|
||||
Logger logger = main.getLogger();
|
||||
@@ -91,11 +101,10 @@ public class CarverConfig extends YamlConfiguration {
|
||||
paths
|
||||
.filter(path -> FilenameUtils.wildcardMatch(path.toFile().getName(), "*.yml"))
|
||||
.forEach(path -> {
|
||||
logger.info("Loading cave from " + path.toString());
|
||||
try {
|
||||
CarverConfig cave = new CarverConfig(path.toFile());
|
||||
caveConfig.put(cave.getID(), cave);
|
||||
logger.info("ID: " + cave.getID());
|
||||
logger.info("Loaded Carver with ID " + cave.getID() + " from " + path.toString());
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch(InvalidConfigurationException | IllegalArgumentException e) {
|
||||
|
||||
@@ -99,11 +99,9 @@ public class FaunaConfig extends YamlConfiguration implements Fauna {
|
||||
.filter(path -> FilenameUtils.wildcardMatch(path.toFile().getName(), "*.yml"))
|
||||
.forEach(path -> {
|
||||
try {
|
||||
logger.info("Loading fauna from " + path.toString());
|
||||
FaunaConfig fauna = new FaunaConfig(path.toFile());
|
||||
faunaConfig.put(fauna.getID(), fauna);
|
||||
logger.info("Friendly name: " + fauna.getFriendlyName());
|
||||
logger.info("ID: " + fauna.getID());
|
||||
logger.info("Loaded Fauna with name " + fauna.getFriendlyName() + ", ID " + fauna.getID() + " from " + path.toString());
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch(InvalidConfigurationException | IllegalArgumentException e) {
|
||||
|
||||
@@ -57,7 +57,6 @@ public class OreConfig extends YamlConfiguration {
|
||||
|
||||
try {
|
||||
replaceable = ConfigUtil.getElements(getStringList("replace"), Material.class);
|
||||
Bukkit.getLogger().info("[Terra] Added " + replaceable.size() + " items to replaceable list.");
|
||||
} catch(IllegalArgumentException e) {
|
||||
throw new InvalidConfigurationException("Invalid material ID in replace list: " + e.getMessage());
|
||||
}
|
||||
@@ -106,11 +105,10 @@ public class OreConfig extends YamlConfiguration {
|
||||
paths
|
||||
.filter(path -> FilenameUtils.wildcardMatch(path.toFile().getName(), "*.yml"))
|
||||
.forEach(path -> {
|
||||
logger.info("Loading ore from " + path.toString());
|
||||
try {
|
||||
OreConfig ore = new OreConfig(path.toFile());
|
||||
ores.put(ore.getID(), ore);
|
||||
logger.info("ID: " + ore.getID());
|
||||
logger.info("Loaded ore with ID " + ore.getID() + " from " + path.toString());
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch(InvalidConfigurationException | IllegalArgumentException e) {
|
||||
|
||||
@@ -65,9 +65,7 @@ public class PaletteConfig extends YamlConfiguration {
|
||||
ProbabilityCollection<BlockData> layer = new ProbabilityCollection<>();
|
||||
for(Map.Entry<String, Integer> type : ((Map<String, Integer>) m.get("materials")).entrySet()) {
|
||||
layer.add(Bukkit.createBlockData(type.getKey()), type.getValue());
|
||||
Bukkit.getLogger().info("[Terra] Added " + type.getKey() + " with probability " + type.getValue());
|
||||
}
|
||||
Bukkit.getLogger().info("[Terra] Added above materials for " + m.get("layers") + " layers.");
|
||||
p.addBlockData(layer, (Integer) m.get("layers"));
|
||||
} catch(ClassCastException e) {
|
||||
throw new InvalidConfigurationException("SEVERE configuration error for BlockPalette: \n\n" + e.getMessage());
|
||||
@@ -86,12 +84,10 @@ public class PaletteConfig extends YamlConfiguration {
|
||||
paths
|
||||
.filter(path -> FilenameUtils.wildcardMatch(path.toFile().getName(), "*.yml"))
|
||||
.forEach(path -> {
|
||||
logger.info("Loading BlockPalette from " + path.toString());
|
||||
try {
|
||||
PaletteConfig grid = new PaletteConfig(path.toFile());
|
||||
palettes.put(grid.getPaletteID(), grid);
|
||||
logger.info("Friendly name: " + grid.getFriendlyName());
|
||||
logger.info("ID: " + grid.getPaletteID());
|
||||
PaletteConfig palette = new PaletteConfig(path.toFile());
|
||||
palettes.put(palette.getPaletteID(), palette);
|
||||
logger.info("Loaded BlockPalette with name: " + palette.getFriendlyName() + ", ID " + palette.getPaletteID() + "with " + palette.getPalette().getSize() + " layers from " + path.toString());
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch(InvalidConfigurationException | IllegalArgumentException e) {
|
||||
|
||||
@@ -3,24 +3,18 @@ package com.dfsek.terra.config;
|
||||
import com.dfsek.terra.Terra;
|
||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||
import com.dfsek.terra.biome.UserDefinedGrid;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.polydev.gaea.commons.io.FileUtils;
|
||||
import org.polydev.gaea.commons.io.FilenameUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class WorldConfig {
|
||||
private static JavaPlugin main;
|
||||
|
||||
@@ -2,22 +2,37 @@ package com.dfsek.terra.population;
|
||||
|
||||
import com.dfsek.terra.TerraProfiler;
|
||||
import com.dfsek.terra.config.CarverConfig;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.polydev.gaea.generation.GenerationPopulator;
|
||||
import org.polydev.gaea.profiler.ProfileFuture;
|
||||
import org.polydev.gaea.world.carving.CarvingData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class CavePopulator extends GenerationPopulator {
|
||||
|
||||
@Override
|
||||
public ChunkGenerator.ChunkData populate(World world, ChunkGenerator.ChunkData chunk, Random random, int chunkX, int chunkZ) {
|
||||
ProfileFuture cave = TerraProfiler.fromWorld(world).measure("CaveTime");
|
||||
for(CarverConfig c : CarverConfig.getCarvers()) {
|
||||
chunk = c.getCarver().carve(chunkX, chunkZ, world).merge(chunk, true);
|
||||
ProfileFuture cave = TerraProfiler.fromWorld(world).measure("CaveTime");
|
||||
Map<Vector, CarvingData.CarvingType> blocks = c.getCarver().carve(chunkX, chunkZ, world).getCarvedBlocks();
|
||||
for(Map.Entry<Vector, CarvingData.CarvingType> e : blocks.entrySet()) {
|
||||
Vector v = e.getKey();
|
||||
Material m = chunk.getType(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
||||
if(e.getValue().equals(CarvingData.CarvingType.CENTER) && c.isReplaceableInner(m)) {
|
||||
chunk.setBlock(v.getBlockX(), v.getBlockY(), v.getBlockZ(), Material.AIR);
|
||||
} else if(c.isReplaceableOuter(m)){
|
||||
chunk.setBlock(v.getBlockX(), v.getBlockY(), v.getBlockZ(), Material.ANDESITE);
|
||||
}
|
||||
|
||||
}
|
||||
if(cave != null) cave.complete();
|
||||
}
|
||||
if(cave != null) cave.complete();
|
||||
return chunk;
|
||||
}
|
||||
}
|
||||
|
||||
49
test.sh
Executable file
49
test.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
DIRECTORY=./target
|
||||
PROJECT=Terra
|
||||
NAME=Terra
|
||||
WORLD=world
|
||||
REPO=https://github.com/PolyhedralDev/WorldGenTestServer
|
||||
|
||||
|
||||
color() {
|
||||
if [ $2 ]; then
|
||||
echo -e "\e[$1;$2m"
|
||||
else
|
||||
echo -e "\e[$1m"
|
||||
fi
|
||||
}
|
||||
colorend() {
|
||||
echo -e "\e[m"
|
||||
}
|
||||
|
||||
if [ ! -d "$DIRECTORY/server" ]; then
|
||||
echo "$DIRECTORY/server not found. Cloning now."
|
||||
git clone $REPO $DIRECTORY/server
|
||||
sed -i "s/\${gen}/$NAME/g" $DIRECTORY/server/bukkit.yml
|
||||
sed -i "s/\${world}/$WORLD/g" $DIRECTORY/server/bukkit.yml
|
||||
fi
|
||||
cp $DIRECTORY/prod/$PROJECT.jar $DIRECTORY/server/plugins/$PROJECT.jar
|
||||
cd $DIRECTORY/server || exit
|
||||
if ! test -f "paperclip.jar"; then
|
||||
echo "Paper not found. Downloading now."
|
||||
wget https://papermc.io/api/v1/paper/1.16.2/latest/download -O paperclip.jar
|
||||
fi
|
||||
if [ -z "$(grep true eula.txt 2>/dev/null)" ]; then
|
||||
echo
|
||||
echo "$(color 32) It appears you have not agreed to Mojangs EULA yet! Press $(color 1 33)y$(colorend) $(color 32)to confirm agreement to"
|
||||
read -p " Mojangs EULA found at:$(color 1 32) https://account.mojang.com/documents/minecraft_eula $(colorend) " -n 1 -r
|
||||
echo ""
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "$(color 1 31)Aborted$(colorend)"
|
||||
exit;
|
||||
fi
|
||||
echo "eula=true" > eula.txt
|
||||
fi
|
||||
|
||||
|
||||
|
||||
java -Xms5G -Xmx5G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC \
|
||||
-XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 \
|
||||
-XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 \
|
||||
-XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true \
|
||||
-jar paperclip.jar nogui
|
||||
Reference in New Issue
Block a user