diff --git a/api/src/main/java/com/volmit/iris/api/IrisAPI.java b/api/src/main/java/com/volmit/iris/api/IrisAPI.java index d133a5052..332d9f315 100644 --- a/api/src/main/java/com/volmit/iris/api/IrisAPI.java +++ b/api/src/main/java/com/volmit/iris/api/IrisAPI.java @@ -22,8 +22,11 @@ import com.volmit.iris.Iris; import com.volmit.iris.core.service.RegistrySVC; import com.volmit.iris.core.tools.IrisToolbelt; import com.volmit.iris.engine.data.cache.AtomicCache; +import com.volmit.iris.util.api.APIAwareBlock; +import com.volmit.iris.util.api.APIWorldBlock; import com.volmit.iris.util.plugin.PluginRegistryGroup; import org.bukkit.World; +import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; import java.util.List; @@ -32,6 +35,8 @@ import java.util.function.Supplier; public class IrisAPI { private static final AtomicCache>> customBlock = new AtomicCache<>(); + private static final AtomicCache> customAwareBlock = new AtomicCache<>(); + private static final AtomicCache> customWorldBlock = new AtomicCache<>(); /** * Checks if the given world is an Iris World @@ -113,4 +118,26 @@ public class IrisAPI return registry.get().getRegistry(namespace).getRegistries(); } } + + @FunctionalInterface + public interface AwareBlockMirror + { + void onPlaced(BlockData block, String namespace, String key, int x, int y, int z); + + default APIAwareBlock map() + { + return this::onPlaced; + } + } + + @FunctionalInterface + public interface WorldBlockMirror + { + void onWorldPlaced(Block block, String namespace, String key); + + default APIWorldBlock map() + { + return this::onWorldPlaced; + } + } } diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineMetrics.java b/src/main/java/com/volmit/iris/engine/framework/EngineMetrics.java index fe9855497..58fccbb67 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineMetrics.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineMetrics.java @@ -32,6 +32,7 @@ public class EngineMetrics { private final AtomicRollingSequence parallaxInsert; private final AtomicRollingSequence post; private final AtomicRollingSequence perfection; + private final AtomicRollingSequence api; private final AtomicRollingSequence decoration; private final AtomicRollingSequence cave; private final AtomicRollingSequence ravine; @@ -40,6 +41,7 @@ public class EngineMetrics { public EngineMetrics(int mem) { this.total = new AtomicRollingSequence(mem); this.terrain = new AtomicRollingSequence(mem); + this.api = new AtomicRollingSequence(mem); this.biome = new AtomicRollingSequence(mem); this.perfection = new AtomicRollingSequence(mem); this.parallax = new AtomicRollingSequence(mem); @@ -62,6 +64,7 @@ public class EngineMetrics { v.put("post", post.getAverage()); v.put("perfection", perfection.getAverage()); v.put("decoration", decoration.getAverage()); + v.put("api", api.getAverage()); v.put("updates", updates.getAverage()); v.put("cave", cave.getAverage()); v.put("ravine", ravine.getAverage()); diff --git a/src/main/java/com/volmit/iris/util/api/APIAwareBlock.java b/src/main/java/com/volmit/iris/util/api/APIAwareBlock.java new file mode 100644 index 000000000..3e01ee93f --- /dev/null +++ b/src/main/java/com/volmit/iris/util/api/APIAwareBlock.java @@ -0,0 +1,27 @@ +/* + * 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 . + */ + +package com.volmit.iris.util.api; + +import org.bukkit.block.data.BlockData; + +@FunctionalInterface +public interface APIAwareBlock +{ + void onPlaced(BlockData block, String namespace, String key, int x, int y, int z); +} diff --git a/src/main/java/com/volmit/iris/util/api/APIWorldBlock.java b/src/main/java/com/volmit/iris/util/api/APIWorldBlock.java new file mode 100644 index 000000000..2c7711c76 --- /dev/null +++ b/src/main/java/com/volmit/iris/util/api/APIWorldBlock.java @@ -0,0 +1,27 @@ +/* + * 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 . + */ + +package com.volmit.iris.util.api; + +import org.bukkit.block.Block; + +@FunctionalInterface +public interface APIWorldBlock +{ + void onWorldPlaced(Block block, String namespace, String key); +} \ No newline at end of file