mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-29 12:09:07 +00:00
Merge branch 'master' into Fixes
This commit is contained in:
@@ -23,7 +23,6 @@ import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import net.minecraft.world.level.levelgen.OreVeinifier;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@@ -269,18 +268,12 @@ public class B {
|
||||
public static BlockData toDeepSlateOre(BlockData block, BlockData ore) {
|
||||
int key = ore.getMaterial().ordinal();
|
||||
|
||||
if(isDeepSlate(block))
|
||||
{
|
||||
if(normal2DeepslateCache.containsKey(key))
|
||||
{
|
||||
if (isDeepSlate(block)) {
|
||||
if (normal2DeepslateCache.containsKey(key)) {
|
||||
return Material.values()[normal2DeepslateCache.get(key)].createBlockData();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(deepslate2NormalCache.containsKey(key))
|
||||
{
|
||||
} else {
|
||||
if (deepslate2NormalCache.containsKey(key)) {
|
||||
return Material.values()[deepslate2NormalCache.get(key)].createBlockData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 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.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.IrisJigsawPiece;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.decree.DecreeParameterHandler;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class JigsawPieceHandler implements DecreeParameterHandler<IrisJigsawPiece> {
|
||||
@Override
|
||||
public KList<IrisJigsawPiece> getPossibilities() {
|
||||
KMap<String, IrisJigsawPiece> p = new KMap<>();
|
||||
|
||||
//noinspection ConstantConditions
|
||||
for (File i : Iris.instance.getDataFolder("packs").listFiles()) {
|
||||
if (i.isDirectory()) {
|
||||
IrisData data = IrisData.get(i);
|
||||
for (IrisJigsawPiece j : data.getJigsawPieceLoader().loadAll(data.getJigsawPieceLoader().getPossibleKeys())) {
|
||||
p.putIfAbsent(j.getLoadKey(), j);
|
||||
}
|
||||
|
||||
data.close();
|
||||
}
|
||||
}
|
||||
|
||||
return p.v();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(IrisJigsawPiece dim) {
|
||||
return dim.getLoadKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IrisJigsawPiece parse(String in, boolean force) throws DecreeParsingException, DecreeWhichException {
|
||||
if (in.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
KList<IrisJigsawPiece> options = getPossibilities(in);
|
||||
|
||||
if (options.isEmpty()) {
|
||||
throw new DecreeParsingException("Unable to find Jigsaw Piece \"" + in + "\"");
|
||||
} else if (options.size() > 1) {
|
||||
if (force) {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Jigsaw Piece \"" + in + "\"");
|
||||
}
|
||||
} else {
|
||||
throw new DecreeWhichException();
|
||||
}
|
||||
}
|
||||
|
||||
return options.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> type) {
|
||||
return type.equals(IrisJigsawPiece.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRandomDefault() {
|
||||
return "jigsaw-piece";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 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.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.IrisJigsawStructure;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.decree.DecreeParameterHandler;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class JigsawStructureHandler implements DecreeParameterHandler<IrisJigsawStructure> {
|
||||
@Override
|
||||
public KList<IrisJigsawStructure> getPossibilities() {
|
||||
KMap<String, IrisJigsawStructure> p = new KMap<>();
|
||||
|
||||
//noinspection ConstantConditions
|
||||
for (File i : Iris.instance.getDataFolder("packs").listFiles()) {
|
||||
if (i.isDirectory()) {
|
||||
IrisData data = IrisData.get(i);
|
||||
for (IrisJigsawStructure j : data.getJigsawStructureLoader().loadAll(data.getJigsawStructureLoader().getPossibleKeys())) {
|
||||
p.putIfAbsent(j.getLoadKey(), j);
|
||||
}
|
||||
|
||||
data.close();
|
||||
}
|
||||
}
|
||||
|
||||
return p.v();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(IrisJigsawStructure dim) {
|
||||
return dim.getLoadKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IrisJigsawStructure parse(String in, boolean force) throws DecreeParsingException, DecreeWhichException {
|
||||
if (in.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
KList<IrisJigsawStructure> options = getPossibilities(in);
|
||||
|
||||
if (options.isEmpty()) {
|
||||
throw new DecreeParsingException("Unable to find Jigsaw Structure \"" + in + "\"");
|
||||
} else if (options.size() > 1) {
|
||||
if (force) {
|
||||
try {
|
||||
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
|
||||
} catch (Throwable e) {
|
||||
throw new DecreeParsingException("Unable to filter which Jigsaw Structure \"" + in + "\"");
|
||||
}
|
||||
} else {
|
||||
throw new DecreeWhichException();
|
||||
}
|
||||
}
|
||||
|
||||
return options.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> type) {
|
||||
return type.equals(IrisJigsawStructure.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRandomDefault() {
|
||||
return "jigsaw-structure";
|
||||
}
|
||||
}
|
||||
@@ -483,6 +483,7 @@ public class VirtualDecreeCommand {
|
||||
vm++;
|
||||
}
|
||||
|
||||
DecreeContext.touch(sender);
|
||||
Runnable rx = () -> {
|
||||
try {
|
||||
DecreeContext.touch(sender);
|
||||
|
||||
@@ -27,7 +27,8 @@ public enum MantleFlag {
|
||||
FEATURE,
|
||||
INITIAL_SPAWNED,
|
||||
REAL,
|
||||
CARVED;
|
||||
CARVED,
|
||||
FLUID_BODIES;
|
||||
|
||||
static StateList getStateList() {
|
||||
return new StateList(MantleFlag.values());
|
||||
|
||||
@@ -28,18 +28,15 @@ public class MatterCavern {
|
||||
private final String customBiome;
|
||||
private final byte liquid; // 0 none 1 water 2 lava
|
||||
|
||||
public boolean isAir()
|
||||
{
|
||||
public boolean isAir() {
|
||||
return liquid == 0;
|
||||
}
|
||||
|
||||
public boolean isWater()
|
||||
{
|
||||
public boolean isWater() {
|
||||
return liquid == 1;
|
||||
}
|
||||
|
||||
public boolean isLava()
|
||||
{
|
||||
public boolean isLava() {
|
||||
return liquid == 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 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.matter;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class MatterFluidBody {
|
||||
private final boolean body;
|
||||
private final String customBiome;
|
||||
private final boolean lava;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 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.matter.slices;
|
||||
|
||||
import com.volmit.iris.util.matter.MatterFluidBody;
|
||||
import com.volmit.iris.util.matter.Sliced;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
@Sliced
|
||||
public class FluidBodyMatter extends RawMatter<MatterFluidBody> {
|
||||
public static MatterFluidBody get(String customBiome, boolean lava) {
|
||||
return new MatterFluidBody(true, customBiome, lava);
|
||||
}
|
||||
|
||||
public FluidBodyMatter() {
|
||||
this(1, 1, 1);
|
||||
}
|
||||
|
||||
public FluidBodyMatter(int width, int height, int depth) {
|
||||
super(width, height, depth, MatterFluidBody.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNode(MatterFluidBody b, DataOutputStream dos) throws IOException {
|
||||
dos.writeBoolean(b.isBody());
|
||||
dos.writeBoolean(b.isLava());
|
||||
dos.writeUTF(b.getCustomBiome());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MatterFluidBody readNode(DataInputStream din) throws IOException {
|
||||
boolean b = din.readBoolean();
|
||||
boolean l = din.readBoolean();
|
||||
String v = din.readUTF();
|
||||
|
||||
return new MatterFluidBody(b, v, l);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.util.scheduling.jobs;
|
||||
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
@@ -66,7 +67,7 @@ public interface Job {
|
||||
}, sender.isPlayer() ? 0 : 20);
|
||||
f.whenComplete((fs, ff) -> {
|
||||
J.car(c);
|
||||
sender.sendMessage("Completed " + getName() + " in " + Form.duration(p.getMilliseconds(), 1));
|
||||
sender.sendMessage(C.AQUA + "Completed " + getName() + " in " + Form.duration(p.getMilliseconds(), 1));
|
||||
whenComplete.run();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user