mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Basic API
This commit is contained in:
parent
c3b1d6735e
commit
3d5bee3a2c
@ -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<RegistryHolder<Supplier<BlockData>>> customBlock = new AtomicCache<>();
|
||||
private static final AtomicCache<RegistryHolder<AwareBlockMirror>> customAwareBlock = new AtomicCache<>();
|
||||
private static final AtomicCache<RegistryHolder<APIWorldBlock>> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
27
src/main/java/com/volmit/iris/util/api/APIAwareBlock.java
Normal file
27
src/main/java/com/volmit/iris/util/api/APIAwareBlock.java
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
27
src/main/java/com/volmit/iris/util/api/APIWorldBlock.java
Normal file
27
src/main/java/com/volmit/iris/util/api/APIWorldBlock.java
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.api;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface APIWorldBlock
|
||||
{
|
||||
void onWorldPlaced(Block block, String namespace, String key);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user