9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-19 15:09:18 +00:00

Compare commits

...

12 Commits

Author SHA1 Message Date
RePixelatedMC
bf41364da7 Prettier now 2025-04-22 13:48:11 +02:00
RePixelatedMC
f6033d9c1b - Forgot to commit this before creating a branch..
- Dev test of Jigsaw structures biome exclusions
2025-04-22 10:38:30 +02:00
RePixelatedMC
f42bf07d4e - Bit clumsy 2025-04-11 14:39:50 +02:00
RePixelatedMC
289813b044 - Fixed noStudio null pointer when not in studio lol
- Added a debugger for when creating images
2025-04-11 14:36:54 +02:00
RePixelatedMC
b209f69bba Merge remote-tracking branch 'origin/feat/map' into feat/map 2025-04-11 12:45:53 +02:00
RePixelatedMC
790fde02a8 Some todos 2025-04-11 11:12:59 +02:00
RePixelatedMC
eddc0c81f2 ah now it should work 2025-04-11 11:12:34 +02:00
RePixelatedMC
d8c3fd8e6c ah now it should work 2025-04-10 13:17:57 +02:00
RePixelatedMC
984d294bab wait 2025-04-10 13:15:19 +02:00
RePixelatedMC
96b0db309a huh 2025-04-10 13:07:22 +02:00
RePixelatedMC
b5da0dd33f Iris std map v4 sync 2025-04-04 16:55:02 +02:00
RePixelatedMC
1ac482ff49 sync 2025-04-04 16:39:39 +02:00
11 changed files with 256 additions and 18 deletions

View File

@@ -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')

View File

@@ -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?");

View 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;
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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<>();

View File

@@ -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<>();
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}