mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-06 07:46:08 +00:00
Basic API
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user