mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-24 01:29:16 +00:00
Compare commits
42 Commits
2.2.5-1.19
...
2.2.11-1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eae7fc0e53 | ||
|
|
fddacd4410 | ||
|
|
de6c4b9a30 | ||
|
|
6990e34138 | ||
|
|
d9883697ef | ||
|
|
05a26ff8b2 | ||
|
|
84bb082d44 | ||
|
|
a0db94d84f | ||
|
|
0367b4ecd7 | ||
|
|
dbc425dce6 | ||
|
|
116c017c6d | ||
|
|
9c387475f0 | ||
|
|
0765c21cef | ||
|
|
2871038584 | ||
|
|
340885f939 | ||
|
|
1e32e47f54 | ||
|
|
3c759f3b01 | ||
|
|
6615f34d20 | ||
|
|
3a4aac1ee4 | ||
|
|
4d6c092615 | ||
|
|
93421a1dc9 | ||
|
|
209458a856 | ||
|
|
82bd94620e | ||
|
|
af9f017871 | ||
|
|
2f8922ea87 | ||
|
|
0ea936f3fe | ||
|
|
d1870ee0a8 | ||
|
|
d2151690ad | ||
|
|
dff373e7d5 | ||
|
|
0aec2a664f | ||
|
|
723b696393 | ||
|
|
f5f89eb4e4 | ||
|
|
df15332c7f | ||
|
|
61d9e5a869 | ||
|
|
9628b66a97 | ||
|
|
5e041366d4 | ||
|
|
3ecae8d72c | ||
|
|
5709ce9d82 | ||
|
|
ce3c334ac5 | ||
|
|
2ed5aa8730 | ||
|
|
8480a63dda | ||
|
|
132a1695f3 |
12
build.gradle
12
build.gradle
@@ -24,10 +24,10 @@ plugins {
|
||||
id "de.undercouch.download" version "5.0.1"
|
||||
}
|
||||
|
||||
version '2.2.5-1.19' // Needs to be version specific
|
||||
def nmsVersion = "1.19"
|
||||
version '2.2.11-1.19.2' // Needs to be version specific
|
||||
def nmsVersion = "1.19.2"
|
||||
def apiVersion = '1.19'
|
||||
def spigotJarVersion = '1.19-R0.1-SNAPSHOT'
|
||||
def spigotJarVersion = '1.19.1-R0.1-SNAPSHOT'
|
||||
def name = getRootProject().getName() // Defined in settings.gradle
|
||||
def main = 'com.volmit.iris.Iris'
|
||||
|
||||
@@ -38,7 +38,7 @@ registerCustomOutputTask('Psycho', 'D://Dan/MinecraftDevelopment/server/plugins'
|
||||
registerCustomOutputTask('ArcaneArts', 'C://Users/arcane/Documents/development/server/plugins')
|
||||
registerCustomOutputTask('Coco', 'D://Documents/MC/plugins')
|
||||
registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins')
|
||||
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19/plugins')
|
||||
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.2/plugins')
|
||||
// ========================== UNIX ==============================
|
||||
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/development/server/plugins')
|
||||
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Desktop/REMOTES/RemoteMinecraft/plugins')
|
||||
@@ -124,10 +124,10 @@ dependencies {
|
||||
// Provided or Classpath
|
||||
compileOnly 'org.projectlombok:lombok:1.18.24'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.24'
|
||||
implementation 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT'
|
||||
implementation 'org.spigotmc:spigot-api:1.19.1-R0.1-SNAPSHOT'
|
||||
implementation 'me.clip:placeholderapi:2.11.1'
|
||||
implementation 'io.th0rgal:oraxen:1.94.0'
|
||||
implementation 'org.bukkit:craftbukkit:1.19-R0.1-SNAPSHOT:remapped-mojang'
|
||||
implementation 'org.bukkit:craftbukkit:1.19.2-R0.1-SNAPSHOT:remapped-mojang'
|
||||
implementation 'com.github.LoneDev6:api-itemsadder:3.1.0b'
|
||||
|
||||
// Shaded
|
||||
|
||||
@@ -78,8 +78,6 @@ public class CommandIris implements DecreeExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
sender().sendMessage(C.RED + "You should not be using this command to create new worlds. Instead, use the tutorial: https://docs.volmit.com/iris/getting-started");
|
||||
|
||||
try {
|
||||
IrisToolbelt.createWorld()
|
||||
.dimension(type.getLoadKey())
|
||||
@@ -140,7 +138,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
sender().sendMessage(C.GREEN + "Total Height: " + (sender().player().getWorld().getMaxHeight() - sender().player().getWorld().getMinHeight()));
|
||||
}
|
||||
|
||||
@Decree(description = "QOL command to open a overworld studio world.")
|
||||
@Decree(description = "QOL command to open a overworld studio world.", sync = true)
|
||||
public void so() {
|
||||
sender().sendMessage(C.GREEN + "Opening studio for the \"Overworld\" pack (seed: 1337)");
|
||||
Iris.service(StudioSVC.class).open(sender(), 1337, "overworld");
|
||||
|
||||
@@ -148,7 +148,7 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, List
|
||||
JFrame frame = new JFrame("Noise Explorer");
|
||||
NoiseExplorerGUI nv = new NoiseExplorerGUI();
|
||||
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||
KList<String> li = new KList<>(NoiseStyle.values()).toStringList();
|
||||
KList<String> li = new KList<>(NoiseStyle.values()).toStringList().sort();
|
||||
combo = new JComboBox<>(li.toArray(new String[0]));
|
||||
combo.setSelectedItem("STATIC");
|
||||
combo.setFocusable(false);
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.volmit.iris.core.nms;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.nms.v19_1.NMSBinding19_1;
|
||||
import com.volmit.iris.core.nms.v19_2.NMSBinding19_2;
|
||||
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -28,7 +28,7 @@ import org.bukkit.Bukkit;
|
||||
public class INMS {
|
||||
//@builder
|
||||
private static final KMap<String, Class<? extends INMSBinding>> bindings = new KMap<String, Class<? extends INMSBinding>>()
|
||||
.qput("v1_19_R1", NMSBinding19_1.class);
|
||||
.qput("v1_19_R1", NMSBinding19_2.class);
|
||||
//@done
|
||||
private static final INMSBinding binding = bind();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.core.nms.v19_1;
|
||||
package com.volmit.iris.core.nms.v19_2;
|
||||
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
@@ -39,15 +39,10 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import net.minecraft.core.*;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.BitStorage;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.chunk.Palette;
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -74,7 +69,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class NMSBinding19_1 implements INMSBinding {
|
||||
public class NMSBinding19_2 implements INMSBinding {
|
||||
|
||||
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||
private final BlockData AIR = Material.AIR.createBlockData();
|
||||
@@ -29,6 +29,7 @@ import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.Looper;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@@ -55,10 +56,12 @@ public class IrisPregenerator {
|
||||
private final KSet<Position2> retry;
|
||||
private final KSet<Position2> net;
|
||||
private final ChronoLatch cl;
|
||||
private final Semaphore limiter;
|
||||
|
||||
public IrisPregenerator(PregenTask task, PregeneratorMethod generator, PregenListener listener) {
|
||||
this.listener = listenify(listener);
|
||||
cl = new ChronoLatch(5000);
|
||||
limiter = new Semaphore(Runtime.getRuntime().availableProcessors());
|
||||
generatedRegions = new KSet<>();
|
||||
this.shutdown = new AtomicBoolean(false);
|
||||
this.paused = new AtomicBoolean(false);
|
||||
@@ -140,6 +143,7 @@ public class IrisPregenerator {
|
||||
generator.close();
|
||||
ticker.interrupt();
|
||||
listener.onClose();
|
||||
getMantle().trim(0);
|
||||
}
|
||||
|
||||
private void visitRegion(int x, int z, boolean regions) {
|
||||
@@ -162,12 +166,26 @@ public class IrisPregenerator {
|
||||
boolean hit = false;
|
||||
if(generator.supportsRegions(x, z, listener) && regions) {
|
||||
hit = true;
|
||||
listener.onRegionGenerating(x, z);
|
||||
generator.generateRegion(x, z, listener);
|
||||
try {
|
||||
limiter.acquire();
|
||||
listener.onRegionGenerating(x, z);
|
||||
generator.generateRegion(x, z, listener);
|
||||
limiter.release();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else if(!regions) {
|
||||
hit = true;
|
||||
listener.onRegionGenerating(x, z);
|
||||
PregenTask.iterateRegion(x, z, (xx, zz) -> generator.generateChunk(xx, zz, listener));
|
||||
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
||||
try {
|
||||
limiter.acquire();
|
||||
generator.generateChunk(xx, zz, listener);
|
||||
limiter.release();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(hit) {
|
||||
|
||||
@@ -22,17 +22,7 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||
import com.volmit.iris.core.loader.ResourceLoader;
|
||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListBlockType;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListFont;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListItemType;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListSpecialEntity;
|
||||
import com.volmit.iris.engine.object.annotations.Required;
|
||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.data.B;
|
||||
@@ -52,7 +42,7 @@ public class SchemaBuilder {
|
||||
private static final String SYMBOL_LIMIT__N = "*";
|
||||
private static final String SYMBOL_TYPE__N = "";
|
||||
private static final JSONArray POTION_TYPES = getPotionTypes();
|
||||
private static final JSONArray ENCHANT_TYPES = getEnchantmentTypes();
|
||||
private static final JSONArray ENCHANT_TYPES = getEnchantTypes();
|
||||
private static final JSONArray ITEM_TYPES = new JSONArray(B.getItemTypes());
|
||||
private static final JSONArray FONT_TYPES = new JSONArray(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
|
||||
private final KMap<String, JSONObject> definitions;
|
||||
@@ -67,16 +57,6 @@ public class SchemaBuilder {
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
private static JSONArray getEnchantmentTypes() {
|
||||
JSONArray a = new JSONArray();
|
||||
|
||||
for(Field gg : Enchantment.class.getDeclaredFields()) {
|
||||
a.put(gg.getName());
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
private static JSONArray getPotionTypes() {
|
||||
JSONArray a = new JSONArray();
|
||||
|
||||
@@ -87,6 +67,14 @@ public class SchemaBuilder {
|
||||
return a;
|
||||
}
|
||||
|
||||
private static JSONArray getEnchantTypes() {
|
||||
JSONArray array = new JSONArray();
|
||||
for(Enchantment e : Enchantment.values()) {
|
||||
array.put(e.getKey().getKey());
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public JSONObject construct() {
|
||||
JSONObject schema = new JSONObject();
|
||||
schema.put("$schema", "http://json-schema.org/draft-07/schema#");
|
||||
@@ -309,7 +297,7 @@ public class SchemaBuilder {
|
||||
prop.put("$ref", "#/definitions/" + key);
|
||||
description.add(SYMBOL_TYPE__N + " Must be a valid Font Family (use ctrl+space for auto complete!)");
|
||||
|
||||
} else if(k.getType().equals(Enchantment.class)) {
|
||||
} else if(k.isAnnotationPresent(RegistryListEnchantment.class)) {
|
||||
String key = "enum-enchantment";
|
||||
|
||||
if(!definitions.containsKey(key)) {
|
||||
@@ -483,7 +471,7 @@ public class SchemaBuilder {
|
||||
items.put("$ref", "#/definitions/" + key);
|
||||
prop.put("items", items);
|
||||
description.add(SYMBOL_TYPE__N + " Must be a valid Font Family (use ctrl+space for auto complete!)");
|
||||
} else if(t.type().equals(Enchantment.class)) {
|
||||
} else if(k.isAnnotationPresent(RegistryListEnchantment.class)) {
|
||||
fancyType = "List of Enchantment Types";
|
||||
String key = "enum-enchantment";
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||
import com.volmit.iris.engine.object.IrisDecorator;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import org.bukkit.Material;
|
||||
@@ -100,14 +101,13 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
}
|
||||
|
||||
private BlockData fixFaces(BlockData b, int x, int y, int z) {
|
||||
Material mat = b.getMaterial();
|
||||
if(mat == Material.VINE || mat == Material.GLOW_LICHEN) {
|
||||
if(B.isVineBlock(b)) {
|
||||
MultipleFacing data = (MultipleFacing)b.clone();
|
||||
boolean found = false;
|
||||
for(BlockFace f : BlockFace.values()) {
|
||||
if(!f.isCartesian())
|
||||
continue;
|
||||
Material m = getEngine().getMantle().get(x, y, z).getMaterial();
|
||||
Material m = getEngine().getMantle().get(x + f.getModX(), y + f.getModY(), z + f.getModZ()).getMaterial();
|
||||
if(m.isSolid()) {
|
||||
found = true;
|
||||
data.setFace(f, m.isSolid());
|
||||
|
||||
@@ -25,12 +25,14 @@ import com.volmit.iris.engine.object.InferredType;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||
import com.volmit.iris.engine.object.IrisDecorator;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.block.data.type.PointedDripstone;
|
||||
|
||||
public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
@@ -73,8 +75,8 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
}
|
||||
|
||||
if(decorator.getForceBlock() != null)
|
||||
data.set(x, height, z, decorator.getForceBlock().getBlockData(getData()));
|
||||
data.set(x, height + 1, z, bd);
|
||||
data.set(x, height, z, fixFaces(decorator.getForceBlock().getBlockData(getData()), x, height, z));
|
||||
data.set(x, height + 1, z, fixFaces(bd, x, height, z));
|
||||
} else {
|
||||
if(height < getDimension().getFluidHeight()) {
|
||||
max = getDimension().getFluidHeight();
|
||||
@@ -140,4 +142,24 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BlockData fixFaces(BlockData b, int x, int y, int z) {
|
||||
if(B.isVineBlock(b)) {
|
||||
MultipleFacing data = (MultipleFacing)b.clone();
|
||||
boolean found = false;
|
||||
for(BlockFace f : BlockFace.values()) {
|
||||
if(!f.isCartesian())
|
||||
continue;
|
||||
Material m = getEngine().getMantle().get(x + f.getModX(), y + f.getModY(), z + f.getModZ()).getMaterial();
|
||||
if(m.isSolid()) {
|
||||
found = true;
|
||||
data.setFace(f, m.isSolid());
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
data.setFace(BlockFace.UP, true);
|
||||
return data;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ public class ModeOverworld extends IrisEngineMode implements EngineMode {
|
||||
var deposit = new IrisDepositModifier(getEngine());
|
||||
var perfection = new IrisPerfectionModifier(getEngine());
|
||||
|
||||
registerStage((x, z, k, p, m) -> biome.actuate(x, z, p, m));
|
||||
registerStage(burst(
|
||||
(x, z, k, p, m) -> generateMatter(x >> 4, z >> 4, m),
|
||||
(x, z, k, p, m) -> terrain.actuate(x, z, k, m),
|
||||
(x, z, k, p, m) -> biome.actuate(x, z, p, m)
|
||||
(x, z, k, p, m) -> terrain.actuate(x, z, k, m)
|
||||
));
|
||||
registerStage((x, z, k, p, m) -> cave.modify(x >> 4, z >> 4, k, m));
|
||||
registerStage((x, z, k, p, m) -> deposit.modify(x, z, k, m));
|
||||
|
||||
@@ -19,21 +19,17 @@
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||
import com.volmit.iris.engine.object.annotations.Required;
|
||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@Snippet("enchantment")
|
||||
@Accessors(chain = true)
|
||||
@@ -43,8 +39,9 @@ import java.lang.reflect.Field;
|
||||
@Data
|
||||
public class IrisEnchantment {
|
||||
@Required
|
||||
@RegistryListEnchantment
|
||||
@Desc("The enchantment")
|
||||
private String enchantment = "";
|
||||
private String enchantment;
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("Minimum amount of this loot")
|
||||
@@ -61,12 +58,17 @@ public class IrisEnchantment {
|
||||
|
||||
public void apply(RNG rng, ItemMeta meta) {
|
||||
try {
|
||||
Enchantment enchant = Enchantment.getByKey(NamespacedKey.minecraft(getEnchantment()));
|
||||
if(enchant == null) {
|
||||
Iris.warn("Unknown Enchantment: " + getEnchantment());
|
||||
return;
|
||||
}
|
||||
if(rng.nextDouble() < chance) {
|
||||
if(meta instanceof EnchantmentStorageMeta) {
|
||||
((EnchantmentStorageMeta) meta).addStoredEnchant(getEnchant(), getLevel(rng), true);
|
||||
((EnchantmentStorageMeta) meta).addStoredEnchant(enchant, getLevel(rng), true);
|
||||
return;
|
||||
}
|
||||
meta.addEnchant(getEnchant(), getLevel(rng), true);
|
||||
meta.addEnchant(enchant, getLevel(rng), true);
|
||||
}
|
||||
} catch(Throwable e) {
|
||||
Iris.reportError(e);
|
||||
@@ -74,21 +76,6 @@ public class IrisEnchantment {
|
||||
}
|
||||
}
|
||||
|
||||
public Enchantment getEnchant() {
|
||||
for(Field i : Enchantment.class.getDeclaredFields()) {
|
||||
if(i.getType().equals(Enchantment.class) && i.getName().equals(getEnchantment())) {
|
||||
try {
|
||||
return (Enchantment) i.get(null);
|
||||
} catch(IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
Iris.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getLevel(RNG rng) {
|
||||
return rng.i(getMinLevel(), getMaxLevel());
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class IrisLoot {
|
||||
private KList<String> lore = new KList<>();
|
||||
@RegistryListItemType
|
||||
@Required
|
||||
@Desc("This is the item or block type. Does not accept minecraft:*. Only materials such as DIAMOND_SWORD or DIRT.")
|
||||
@Desc("This is the item or block type. Does not accept minecraft:*, only materials such as DIAMOND_SWORD or DIRT. The exception are modded materials, as they require a namespace.")
|
||||
private String type = "";
|
||||
@Desc("The dye color")
|
||||
private DyeColor dyeColor = null;
|
||||
@@ -120,89 +120,15 @@ public class IrisLoot {
|
||||
|
||||
public ItemStack get(boolean debug, RNG rng) {
|
||||
try {
|
||||
ItemStack is;
|
||||
if(!type.startsWith("minecraft:") && type.contains(":")) {
|
||||
Optional<ItemStack> opt = Iris.service(ExternalDataSVC.class).getItemStack(NamespacedKey.fromString(type));
|
||||
if(opt.isEmpty()) {
|
||||
//TODO Better third party provider
|
||||
Iris.warn("Unknown Material: " + type);
|
||||
return null;
|
||||
}
|
||||
is = opt.get();
|
||||
is.setAmount(Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
||||
} else {
|
||||
is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
||||
}
|
||||
|
||||
ItemMeta m = is.getItemMeta();
|
||||
|
||||
if(is.getType().getMaxDurability() > 0 && m instanceof Damageable d) {
|
||||
int max = is.getType().getMaxDurability();
|
||||
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
|
||||
}
|
||||
|
||||
for(IrisEnchantment i : getEnchantments()) {
|
||||
i.apply(rng, m);
|
||||
}
|
||||
|
||||
for(IrisAttributeModifier i : getAttributes()) {
|
||||
i.apply(rng, m);
|
||||
}
|
||||
|
||||
try {
|
||||
m.setCustomModelData(getCustomModel());
|
||||
} catch(Throwable e) {
|
||||
Iris.reportError(e);
|
||||
}
|
||||
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
|
||||
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
|
||||
m.setUnbreakable(isUnbreakable());
|
||||
|
||||
for(ItemFlag i : getItemFlags()) {
|
||||
m.addItemFlags(i);
|
||||
}
|
||||
|
||||
KList<String> lore = new KList<>();
|
||||
|
||||
getLore().forEach((i) ->
|
||||
{
|
||||
String mf = C.translateAlternateColorCodes('&', i);
|
||||
|
||||
if(mf.length() > 24) {
|
||||
for(String g : Form.wrapWords(mf, 24).split("\\Q\n\\E")) {
|
||||
lore.add(g.trim());
|
||||
}
|
||||
} else {
|
||||
lore.add(mf);
|
||||
}
|
||||
});
|
||||
|
||||
if(debug) {
|
||||
if(lore.isNotEmpty()) {
|
||||
lore.add(C.GRAY + "--------------------");
|
||||
}
|
||||
|
||||
lore.add(C.GRAY + "1 in " + (getRarity()) + " Chance (" + Form.pc(1D / (getRarity()), 5) + ")");
|
||||
}
|
||||
|
||||
m.setLore(lore);
|
||||
|
||||
if(getLeatherColor() != null && m instanceof LeatherArmorMeta) {
|
||||
Color c = Color.decode(getLeatherColor());
|
||||
((LeatherArmorMeta) m).setColor(org.bukkit.Color.fromRGB(c.getRed(), c.getGreen(), c.getBlue()));
|
||||
}
|
||||
|
||||
if(getDyeColor() != null && m instanceof Colorable) {
|
||||
((Colorable) m).setColor(getDyeColor());
|
||||
}
|
||||
|
||||
is.setItemMeta(m);
|
||||
ItemStack is = getItemStack(rng);
|
||||
if(is == null)
|
||||
return new ItemStack(Material.AIR);
|
||||
is.setItemMeta(applyProperties(is, rng, debug, null));
|
||||
return applyCustomNbt(is);
|
||||
} catch(Throwable e) {
|
||||
Iris.reportError(e);
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
public ItemStack get(boolean debug, boolean giveSomething, IrisLootTable table, RNG rng, int x, int y, int z) {
|
||||
@@ -212,75 +138,10 @@ public class IrisLoot {
|
||||
|
||||
if(giveSomething || chance.aquire(() -> NoiseStyle.STATIC.create(rng)).fit(1, rarity * table.getRarity(), x, y, z) == 1) {
|
||||
try {
|
||||
ItemStack is;
|
||||
if(!type.startsWith("minecraft:") && type.contains(":")) {
|
||||
Optional<ItemStack> opt = Iris.service(ExternalDataSVC.class).getItemStack(NamespacedKey.fromString(type));
|
||||
if(opt.isEmpty()) {
|
||||
Iris.warn("Unknown Material: " + type);
|
||||
return null;
|
||||
}
|
||||
is = opt.get();
|
||||
is.setAmount(Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
||||
return is;
|
||||
} else {
|
||||
is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
||||
}
|
||||
|
||||
ItemMeta m = is.getItemMeta();
|
||||
|
||||
if(is.getType().getMaxDurability() > 0 && m instanceof Damageable d) {
|
||||
int max = is.getType().getMaxDurability();
|
||||
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
|
||||
}
|
||||
|
||||
for(IrisEnchantment i : getEnchantments()) {
|
||||
i.apply(rng, m);
|
||||
}
|
||||
|
||||
for(IrisAttributeModifier i : getAttributes()) {
|
||||
i.apply(rng, m);
|
||||
}
|
||||
|
||||
try {
|
||||
m.setCustomModelData(getCustomModel());
|
||||
} catch(Throwable e) {
|
||||
Iris.reportError(e);
|
||||
}
|
||||
|
||||
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
|
||||
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
|
||||
m.setUnbreakable(isUnbreakable());
|
||||
|
||||
for(ItemFlag i : getItemFlags()) {
|
||||
m.addItemFlags(i);
|
||||
}
|
||||
|
||||
KList<String> lore = new KList<>();
|
||||
|
||||
getLore().forEach((i) ->
|
||||
{
|
||||
String mf = C.translateAlternateColorCodes('&', i);
|
||||
|
||||
if(mf.length() > 24) {
|
||||
for(String g : Form.wrapWords(mf, 24).split("\\Q\n\\E")) {
|
||||
lore.add(g.trim());
|
||||
}
|
||||
} else {
|
||||
lore.add(mf);
|
||||
}
|
||||
});
|
||||
|
||||
if(debug) {
|
||||
if(lore.isNotEmpty()) {
|
||||
lore.add(C.GRAY + "--------------------");
|
||||
}
|
||||
|
||||
lore.add(C.GRAY + "From: " + table.getName() + " (" + Form.pc(1D / table.getRarity(), 5) + ")");
|
||||
lore.add(C.GRAY + "1 in " + (table.getRarity() * getRarity()) + " Chance (" + Form.pc(1D / (table.getRarity() * getRarity()), 5) + ")");
|
||||
}
|
||||
|
||||
m.setLore(lore);
|
||||
is.setItemMeta(m);
|
||||
ItemStack is = getItemStack(rng);
|
||||
if(is == null)
|
||||
return null;
|
||||
is.setItemMeta(applyProperties(is, rng, debug, table));
|
||||
return applyCustomNbt(is);
|
||||
} catch(Throwable e) {
|
||||
//Iris.reportError(e);
|
||||
@@ -291,6 +152,98 @@ public class IrisLoot {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO Better Third Party Item Acquisition
|
||||
private ItemStack getItemStack(RNG rng) {
|
||||
if(!type.startsWith("minecraft:") && type.contains(":")) {
|
||||
Optional<ItemStack> opt = Iris.service(ExternalDataSVC.class).getItemStack(NamespacedKey.fromString(type));
|
||||
if(opt.isEmpty()) {
|
||||
Iris.warn("Unknown Material: " + type);
|
||||
return null;
|
||||
}
|
||||
ItemStack is = opt.get();
|
||||
is.setAmount(Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
||||
return is;
|
||||
}
|
||||
return new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
|
||||
}
|
||||
|
||||
private ItemMeta applyProperties(ItemStack is, RNG rng, boolean debug, IrisLootTable table) {
|
||||
ItemMeta m = is.getItemMeta();
|
||||
if(m == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for(IrisEnchantment i : getEnchantments()) {
|
||||
i.apply(rng, m);
|
||||
}
|
||||
|
||||
for(IrisAttributeModifier i : getAttributes()) {
|
||||
i.apply(rng, m);
|
||||
}
|
||||
|
||||
m.setUnbreakable(isUnbreakable());
|
||||
for(ItemFlag i : getItemFlags()) {
|
||||
m.addItemFlags(i);
|
||||
}
|
||||
|
||||
if(getCustomModel() != null) {
|
||||
m.setCustomModelData(getCustomModel());
|
||||
}
|
||||
|
||||
if(is.getType().getMaxDurability() > 0 && m instanceof Damageable d) {
|
||||
int max = is.getType().getMaxDurability();
|
||||
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
|
||||
}
|
||||
|
||||
if(getLeatherColor() != null && m instanceof LeatherArmorMeta leather) {
|
||||
Color c = Color.decode(getLeatherColor());
|
||||
leather.setColor(org.bukkit.Color.fromRGB(c.getRed(), c.getGreen(), c.getBlue()));
|
||||
}
|
||||
|
||||
if(getDyeColor() != null && m instanceof Colorable colorable) {
|
||||
colorable.setColor(getDyeColor());
|
||||
}
|
||||
|
||||
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
|
||||
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
|
||||
|
||||
KList<String> lore = new KList<>();
|
||||
|
||||
getLore().forEach((i) ->
|
||||
{
|
||||
String mf = C.translateAlternateColorCodes('&', i);
|
||||
|
||||
if(mf.length() > 24) {
|
||||
for(String g : Form.wrapWords(mf, 24).split("\\Q\n\\E")) {
|
||||
lore.add(g.trim());
|
||||
}
|
||||
} else {
|
||||
lore.add(mf);
|
||||
}
|
||||
});
|
||||
|
||||
if(debug) {
|
||||
if(table == null) {
|
||||
if(lore.isNotEmpty()) {
|
||||
lore.add(C.GRAY + "--------------------");
|
||||
}
|
||||
lore.add(C.GRAY + "1 in " + (getRarity()) + " Chance (" + Form.pc(1D / (getRarity()), 5) + ")");
|
||||
} else {
|
||||
if(lore.isNotEmpty()) {
|
||||
lore.add(C.GRAY + "--------------------");
|
||||
}
|
||||
|
||||
lore.add(C.GRAY + "From: " + table.getName() + " (" + Form.pc(1D / table.getRarity(), 5) + ")");
|
||||
lore.add(C.GRAY + "1 in " + (table.getRarity() * getRarity()) + " Chance (" + Form.pc(1D / (table.getRarity() * getRarity()), 5) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
m.setLore(lore);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
private ItemStack applyCustomNbt(ItemStack stack) throws CommandSyntaxException {
|
||||
if(customNbt == null || customNbt.isEmpty())
|
||||
return stack;
|
||||
|
||||
@@ -47,9 +47,11 @@ import lombok.experimental.Accessors;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Leaves;
|
||||
import org.bukkit.util.BlockVector;
|
||||
@@ -779,7 +781,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x, getLoader());
|
||||
}
|
||||
|
||||
if(yv < 0 && (config.getMode().equals(ObjectPlaceMode.PAINT))) {
|
||||
if(yv < 0 && (config.getMode().equals(ObjectPlaceMode.PAINT)) && !B.isVineBlock(data)) {
|
||||
yy = (int) Math.round(i.getY()) + Math.floorDiv(h, 2) + placer.getHighest(xx, zz, getLoader(), config.isUnderwater());
|
||||
}
|
||||
|
||||
@@ -803,6 +805,16 @@ public class IrisObject extends IrisRegistrant {
|
||||
((Waterlogged) data).setWaterlogged(true);
|
||||
}
|
||||
|
||||
if(B.isVineBlock(data)) {
|
||||
MultipleFacing f = (MultipleFacing)data;
|
||||
for(BlockFace face : f.getAllowedFaces()) {
|
||||
BlockData facingBlock = placer.get(xx + face.getModX(), yy + face.getModY(), zz + face.getModZ());
|
||||
if(B.isSolid(facingBlock) && !B.isVineBlock(facingBlock)) {
|
||||
f.setFace(face, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(listener != null) {
|
||||
listener.accept(new BlockPosition(xx, yy, zz));
|
||||
}
|
||||
@@ -811,7 +823,9 @@ public class IrisObject extends IrisRegistrant {
|
||||
placer.getEngine().getMantle().getMantle().set(xx, yy, zz, new MatterMarker(markers.get(g)));
|
||||
}
|
||||
|
||||
if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR)) {
|
||||
boolean wouldReplace = B.isSolid(placer.get(xx, yy, zz)) && B.isVineBlock(data);
|
||||
|
||||
if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR) && !wouldReplace) {
|
||||
placer.set(xx, yy, zz, data);
|
||||
if(tile != null) {
|
||||
placer.setTile(xx, yy, zz, tile);
|
||||
@@ -895,8 +909,19 @@ public class IrisObject extends IrisRegistrant {
|
||||
if(settings.getYMax() != 0)
|
||||
lowerBound -= Math.min(config.getStiltSettings().getYMax() - (lowest + y - highest), 0);
|
||||
}
|
||||
for(int j = lowest + y; j > lowerBound; j--)
|
||||
for(int j = lowest + y; j > lowerBound; j--) {
|
||||
if(B.isVineBlock(d)) {
|
||||
MultipleFacing f = (MultipleFacing)d;
|
||||
for(BlockFace face : f.getAllowedFaces()) {
|
||||
BlockData facingBlock = placer.get(xx + face.getModX(), j + face.getModY(), zz + face.getModZ());
|
||||
if(B.isSolid(facingBlock) && !B.isVineBlock(facingBlock)) {
|
||||
f.setFace(face, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
placer.set(xx, j, zz, d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
readLock.unlock();
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.volmit.iris.engine.object.annotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({PARAMETER, TYPE, FIELD})
|
||||
public @interface RegistryListEnchantment {
|
||||
}
|
||||
@@ -81,12 +81,14 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
private Engine engine;
|
||||
private Looper hotloader;
|
||||
private StudioMode lastMode;
|
||||
private DummyBiomeProvider dummyBiomeProvider;
|
||||
@Setter
|
||||
private StudioGenerator studioGenerator;
|
||||
|
||||
public BukkitChunkGenerator(IrisWorld world, boolean studio, File dataLocation, String dimensionKey) {
|
||||
setup = new AtomicBoolean(false);
|
||||
studioGenerator = null;
|
||||
dummyBiomeProvider = new DummyBiomeProvider();
|
||||
populators = new KList<>();
|
||||
loadLock = new Semaphore(LOAD_LOCKS);
|
||||
this.world = world;
|
||||
@@ -368,6 +370,6 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
@Nullable
|
||||
@Override
|
||||
public BiomeProvider getDefaultBiomeProvider(@NotNull WorldInfo worldInfo) {
|
||||
return null;
|
||||
return dummyBiomeProvider;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.volmit.iris.engine.platform;
|
||||
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DummyBiomeProvider extends BiomeProvider {
|
||||
private final List<Biome> ALL = new KList<>(Biome.values()).qdel(Biome.CUSTOM);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
|
||||
return Biome.PLAINS;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Biome> getBiomes(@NotNull WorldInfo worldInfo) {
|
||||
return ALL;
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,8 @@ public class B {
|
||||
TORCH,
|
||||
SOUL_TORCH,
|
||||
GLOW_LICHEN,
|
||||
VINE
|
||||
VINE,
|
||||
SCULK_VEIN
|
||||
}).forEach((i) -> b.add(i.ordinal()));
|
||||
b.addAll(foliageCache);
|
||||
|
||||
@@ -404,6 +405,8 @@ public class B {
|
||||
}
|
||||
|
||||
public static boolean isSolid(BlockData mat) {
|
||||
if(mat == null)
|
||||
return false;
|
||||
return mat.getMaterial().isSolid();
|
||||
}
|
||||
|
||||
@@ -674,4 +677,11 @@ public class B {
|
||||
public static void registerCustomBlockData(String namespace, String key, BlockData blockData) {
|
||||
custom.put(namespace + ":" + key, blockData);
|
||||
}
|
||||
|
||||
public static boolean isVineBlock(BlockData data) {
|
||||
return switch(data.getMaterial()) {
|
||||
case VINE, SCULK_VEIN, GLOW_LICHEN -> true;
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ public class BiomeGridHunkView implements Hunk<Biome> {
|
||||
if(y > highest)
|
||||
{
|
||||
highest = y;
|
||||
Iris.info("Highest = " + highest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ package com.volmit.iris.util.stream;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.data.cache.Cache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IRare;
|
||||
import com.volmit.iris.engine.object.IrisStyledRange;
|
||||
@@ -531,6 +532,21 @@ public interface ProceduralStream<T> extends ProceduralLayer, Interpolated<T> {
|
||||
|
||||
ProceduralStream<?> getSource();
|
||||
|
||||
default void fillChunk(int x, int z, T[] c) {
|
||||
if(c.length != 256) {
|
||||
throw new RuntimeException("Not 256 Length for chunk get");
|
||||
}
|
||||
|
||||
int xs = x << 4;
|
||||
int zs = z << 4;
|
||||
|
||||
for(int i = 0; i < 16; i++) {
|
||||
for(int j = 0; j < 16; j++) {
|
||||
c[Cache.to1D(i+xs, j+zs, 0, 16, 16)] = get(i+xs, j+zs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
T get(double x, double z);
|
||||
|
||||
T get(double x, double y, double z);
|
||||
|
||||
@@ -2,7 +2,7 @@ name: ${name}
|
||||
version: ${version}
|
||||
main: ${main}
|
||||
load: STARTUP
|
||||
authors: [ cyberpwn, NextdoorPsycho. Vatuu ]
|
||||
authors: [ cyberpwn, NextdoorPsycho, Vatuu ]
|
||||
website: volmit.com
|
||||
description: More than a Dimension!
|
||||
libraries:
|
||||
@@ -21,5 +21,4 @@ commands:
|
||||
iris:
|
||||
aliases: [ ir, irs]
|
||||
api-version: ${apiversion}
|
||||
hotload-dependencies: false
|
||||
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit", "PlaceholderAPI"]
|
||||
hotload-dependencies: false
|
||||
Reference in New Issue
Block a user