mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-19 15:09:18 +00:00
Compare commits
12 Commits
dev
...
feat/exclu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf41364da7 | ||
|
|
f6033d9c1b | ||
|
|
f42bf07d4e | ||
|
|
289813b044 | ||
|
|
b209f69bba | ||
|
|
790fde02a8 | ||
|
|
eddc0c81f2 | ||
|
|
d8c3fd8e6c | ||
|
|
984d294bab | ||
|
|
96b0db309a | ||
|
|
b5da0dd33f | ||
|
|
1ac482ff49 |
@@ -45,7 +45,7 @@ registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins')
|
||||
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.4/plugins')
|
||||
registerCustomOutputTask('CrazyDev22', 'C://Users/Julian/Desktop/server/plugins')
|
||||
registerCustomOutputTask('PixelFury', 'C://Users/repix/workplace/Iris/1.21.3 - Development-Public-v3/plugins')
|
||||
registerCustomOutputTask('PixelFuryDev', 'C://Users/repix/workplace/Iris/1.21 - Development-v3/plugins')
|
||||
registerCustomOutputTask('PixelFuryDev', 'C://Users/repix/workplace/Iris/1.21.4 - Development-v3/plugins')
|
||||
// ========================== UNIX ==============================
|
||||
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/development/server/plugins')
|
||||
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Developer/RemoteGit/Server/plugins')
|
||||
|
||||
@@ -19,13 +19,17 @@
|
||||
package com.volmit.iris.core.commands;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||
import com.volmit.iris.util.decree.annotations.Decree;
|
||||
import com.volmit.iris.util.decree.annotations.Param;
|
||||
import com.volmit.iris.util.decree.specialhandlers.NullableBiomeHandler;
|
||||
import com.volmit.iris.util.decree.specialhandlers.NullableRegionHandler;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -51,12 +55,31 @@ public class CommandEdit implements DecreeExecutor {
|
||||
|
||||
|
||||
@Decree(description = "Edit the biome you specified", aliases = {"b"}, origin = DecreeOrigin.PLAYER)
|
||||
public void biome(@Param(contextual = false, description = "The biome to edit") IrisBiome biome) {
|
||||
public void biome(@Param(contextual = false, description = "The biome to edit", defaultValue = "---", customHandler = NullableBiomeHandler.class) IrisBiome biome) {
|
||||
if (noStudio()) {
|
||||
return;
|
||||
}
|
||||
if (biome == null) {
|
||||
try {
|
||||
IrisBiome b = engine().getBiome(player().getLocation().getBlockX(), player().getLocation().getBlockY() - player().getWorld().getMinHeight(), player().getLocation().getBlockZ());
|
||||
Desktop.getDesktop().open(b.getLoadFile());
|
||||
sender().sendMessage(C.GREEN + "Opening " + b.getTypeName() + " " + b.getLoadFile().getName().split("\\Q.\\E")[0] + " in VSCode! ");
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
sender().sendMessage("Non-Iris Biome: " + player().getLocation().getBlock().getBiome().name());
|
||||
if (player().getLocation().getBlock().getBiome().equals(Biome.CUSTOM)) {
|
||||
try {
|
||||
sender().sendMessage("Data Pack Biome: " + INMS.get().getTrueBiomeBaseKey(player().getLocation()) + " (ID: " + INMS.get().getTrueBiomeBaseId(INMS.get().getTrueBiomeBase(player().getLocation())) + ")");
|
||||
} catch (Throwable ee) {
|
||||
Iris.reportError(ee);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (biome == null || biome.getLoadFile() == null) {
|
||||
if (biome.getLoadFile() == null) {
|
||||
sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");
|
||||
return;
|
||||
}
|
||||
@@ -69,10 +92,20 @@ public class CommandEdit implements DecreeExecutor {
|
||||
}
|
||||
|
||||
@Decree(description = "Edit the region you specified", aliases = {"r"}, origin = DecreeOrigin.PLAYER)
|
||||
public void region(@Param(contextual = false, description = "The region to edit") IrisRegion region) {
|
||||
public void region(@Param(contextual = false, description = "The region to edit", defaultValue = "---", customHandler = NullableRegionHandler.class) IrisRegion region) {
|
||||
if (noStudio()) {
|
||||
return;
|
||||
}
|
||||
if (region == null) {
|
||||
try {
|
||||
IrisRegion r = engine().getRegion(player().getLocation().getBlockX(), player().getLocation().getBlockZ());
|
||||
Desktop.getDesktop().open(r.getLoadFile());
|
||||
sender().sendMessage(C.GREEN + "Opening " + r.getTypeName() + " " + r.getLoadFile().getName().split("\\Q.\\E")[0] + " in VSCode! ");
|
||||
} catch (Throwable e) {
|
||||
sender().sendMessage(C.RED + "Failed to get region.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (region == null || region.getLoadFile() == null) {
|
||||
sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.gui.NoiseExplorerGUI;
|
||||
import com.volmit.iris.core.gui.VisionGUI;
|
||||
import com.volmit.iris.core.gui.components.IrisRenderer;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.project.IrisProject;
|
||||
import com.volmit.iris.core.service.ConversionSVC;
|
||||
@@ -65,6 +66,9 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.util.BlockVector;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@@ -156,6 +160,37 @@ public class CommandStudio implements DecreeExecutor {
|
||||
sender().sendMessage(C.GREEN + "The \"" + dimension.getName() + "\" pack has version: " + dimension.getVersion());
|
||||
}
|
||||
|
||||
@Decree(description = "Debug image")
|
||||
public void printImageChannel(
|
||||
@Param(name = "image", description = "Image found in the image folder inside the project")
|
||||
String image,
|
||||
@Param(name = "channel", description = "Image channel")
|
||||
IrisImageChannel channel
|
||||
) {
|
||||
if (noStudio()) return;
|
||||
try {
|
||||
File file = new File(access().getEngine().getComplex().getData().getDataFolder(), "images/" + image);
|
||||
if (!file.exists()) {
|
||||
sender().sendMessage(C.RED + "The image \"" + image + "\" does not exist.");
|
||||
return;
|
||||
}
|
||||
BufferedImage buffer = ImageIO.read(file);
|
||||
IrisImage irisImage = new IrisImage(buffer);
|
||||
File at = new File(file.getParentFile(), "debug-see-" + file.getName());
|
||||
BufferedImage b = new BufferedImage(buffer.getWidth(), buffer.getHeight(), BufferedImage.TYPE_INT_RGB);
|
||||
for (int i = 0; i < buffer.getWidth(); i++) {
|
||||
for (int j = 0; j < buffer.getHeight(); j++) {
|
||||
b.setRGB(i, j, Color.getHSBColor(0, 0, (float) irisImage.getValue(channel, i, j)).getRGB());
|
||||
}
|
||||
}
|
||||
ImageIO.write(b, "png", at);
|
||||
sender().sendMessage(C.IRIS + "Debug image written to ./images for channel " + channel.name());
|
||||
} catch (Exception e) {
|
||||
sender().sendMessage(C.RED + "Something went wrong.. ");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Decree(name = "regen", description = "Regenerate nearby chunks.", aliases = "rg", sync = true, origin = DecreeOrigin.PLAYER)
|
||||
public void regen(
|
||||
@Param(name = "radius", description = "The radius of nearby cunks", defaultValue = "5")
|
||||
@@ -404,9 +439,16 @@ public class CommandStudio implements DecreeExecutor {
|
||||
@Param(name = "world", description = "The world to open the generator for", contextual = true)
|
||||
World world
|
||||
) {
|
||||
if (noGUI()) return;
|
||||
if (noGUI()) {
|
||||
sender().sendMessage(C.GOLD + "GUI Support isn't enabled or supported on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IrisToolbelt.isIrisWorld(world)) {
|
||||
if (world == null) {
|
||||
if (noStudio()) return;
|
||||
world = player().getWorld();
|
||||
}
|
||||
else if (!IrisToolbelt.isIrisWorld(world)) {
|
||||
sender().sendMessage(C.RED + "You need to be in or specify an Iris-generated world!");
|
||||
return;
|
||||
}
|
||||
@@ -842,7 +884,7 @@ public class CommandStudio implements DecreeExecutor {
|
||||
sender().sendMessage(C.RED + "No studio world is open!");
|
||||
return true;
|
||||
}
|
||||
if (!engine().isStudio()) {
|
||||
if (engine() == null || !engine().isStudio()) {
|
||||
sender().sendMessage(C.RED + "You must be in a studio world!");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2024 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,7 +30,6 @@ import com.volmit.iris.engine.object.IrisWorld;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
import com.volmit.iris.util.data.registry.Attributes;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.BlockPosition;
|
||||
import com.volmit.iris.util.math.M;
|
||||
@@ -57,8 +56,9 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import static com.volmit.iris.util.data.registry.Attributes.MAX_HEALTH;
|
||||
|
||||
//todo
|
||||
// - Misalignment
|
||||
// - Weird snapping?
|
||||
public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener, MouseMotionListener, MouseInputListener {
|
||||
private static final long serialVersionUID = 2094606939770332040L;
|
||||
private final KList<LivingEntity> lastEntities = new KList<>();
|
||||
@@ -415,8 +415,8 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
||||
}
|
||||
|
||||
private double getWorldX(double screenX) {
|
||||
//return (mscale * screenX) + ((oxp / scale) * mscale);
|
||||
return (mscale * screenX) + ((oxp / scale));
|
||||
return (mscale * screenX) + ((oxp / scale) * mscale);
|
||||
// return (mscale * screenX) + ((oxp / scale));
|
||||
}
|
||||
|
||||
private double getWorldZ(double screenZ) {
|
||||
@@ -639,7 +639,7 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
||||
|
||||
k.add("Pos: " + h.getLocation().getBlockX() + ", " + h.getLocation().getBlockY() + ", " + h.getLocation().getBlockZ());
|
||||
k.add("UUID: " + h.getUniqueId());
|
||||
k.add("HP: " + h.getHealth() + " / " + h.getAttribute(MAX_HEALTH).getValue());
|
||||
k.add("HP: " + h.getHealth() + " / " + h.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||
|
||||
drawCardTR(g, k);
|
||||
}
|
||||
|
||||
@@ -93,13 +93,27 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
try {
|
||||
if (i == null || checkMinDistances(i.collectMinDistances(), x, z, cachedRegions, cache, distanceCache))
|
||||
return false;
|
||||
} catch (Throwable ignored) {}
|
||||
if (!checkBiomes(i, x, z))
|
||||
return false;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
RNG rng = new RNG(seed);
|
||||
IrisPosition position = new IrisPosition((x << 4) + rng.nextInt(15), 0, (z << 4) + rng.nextInt(15));
|
||||
IrisJigsawStructure structure = getData().getJigsawStructureLoader().load(i.getStructure());
|
||||
return place(writer, position, structure, rng, false);
|
||||
}
|
||||
|
||||
private boolean checkBiomes(IrisJigsawStructurePlacement placement, int x, int z) {
|
||||
var biome = getEngineMantle().getEngine().getSurfaceBiome((x << 4) + 8, (z << 4) + 8);
|
||||
if (biome == null) {
|
||||
return true;
|
||||
}
|
||||
var exclude = placement.getExclude();
|
||||
return !(biome.isSea() && exclude.isExcludeOceanBiomes() ||
|
||||
biome.isLand() && exclude.isExcludeLandBiomes() ||
|
||||
biome.isShore() && exclude.isExcludeShoreBiomes());
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
private boolean checkMinDistances(KMap<String, Integer> minDistances, int x, int z, KSet<Position2> cachedRegions, KMap<String, KSet<Position2>> cache, KMap<Position2, Double> distanceCache) {
|
||||
int range = 0;
|
||||
|
||||
@@ -123,8 +123,6 @@ public class IrisImage extends IrisRegistrant {
|
||||
}
|
||||
|
||||
public void writeDebug(IrisImageChannel channel) {
|
||||
|
||||
|
||||
try {
|
||||
File at = new File(getLoadFile().getParentFile(), "debug-see-" + getLoadFile().getName());
|
||||
BufferedImage b = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
|
||||
|
||||
@@ -78,6 +78,9 @@ public class IrisJigsawStructurePlacement implements IRare {
|
||||
@Desc("Threshold for noise style")
|
||||
private double threshold = 0.5;
|
||||
|
||||
@Desc("Exclude the structure from certain places")
|
||||
private IrisPlacementExclusion exclude = new IrisPlacementExclusion();
|
||||
|
||||
@ArrayType(type = IrisJigsawMinDistance.class)
|
||||
@Desc("List of minimum distances to check for")
|
||||
private KList<IrisJigsawMinDistance> minDistances = new KList<>();
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents an image map")
|
||||
@Data
|
||||
public class IrisPlacementExclusion {
|
||||
|
||||
@Desc("Excludes the structure from all ocean biomes defined in region")
|
||||
private boolean excludeOceanBiomes;
|
||||
|
||||
@Desc("Excludes the structure from all shore biomes defined in region")
|
||||
private boolean excludeShoreBiomes;
|
||||
|
||||
@Desc("Excludes the structure from all land biomes defined in region")
|
||||
private boolean excludeLandBiomes;
|
||||
|
||||
@RegistryListResource(IrisBiome.class)
|
||||
@Desc("tbd")
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
private KList<String> excludeBiomes = new KList<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.decree.handlers;
|
||||
|
||||
import com.volmit.iris.engine.object.IrisImageChannel;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.decree.DecreeParameterHandler;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ImageChannelHandler implements DecreeParameterHandler<IrisImageChannel> {
|
||||
@Override
|
||||
public KList<IrisImageChannel> getPossibilities() {
|
||||
return new KList<>(Arrays.stream(IrisImageChannel.values()).toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(IrisImageChannel channel) {
|
||||
return channel.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IrisImageChannel parse(String in, boolean force) throws DecreeParsingException {
|
||||
return IrisImageChannel.valueOf(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> type) {
|
||||
return type.equals(IrisImageChannel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRandomDefault() {
|
||||
return IrisImageChannel.BRIGHTNESS.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2024 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.decree.specialhandlers;
|
||||
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.decree.handlers.BiomeHandler;
|
||||
|
||||
public class NullableBiomeHandler extends BiomeHandler {
|
||||
|
||||
@Override
|
||||
public IrisBiome parse(String in, boolean force) throws DecreeParsingException {
|
||||
return getPossibilities(in).stream().filter((i) -> toString(i).equalsIgnoreCase(in)).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2024 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.decree.specialhandlers;
|
||||
|
||||
import com.volmit.iris.engine.object.IrisRegion;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.decree.handlers.RegionHandler;
|
||||
|
||||
public class NullableRegionHandler extends RegionHandler {
|
||||
|
||||
@Override
|
||||
public IrisRegion parse(String in, boolean force) throws DecreeParsingException {
|
||||
return getPossibilities(in).stream().filter((i) -> toString(i).equalsIgnoreCase(in)).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user