From 4d2fbd43ac91f3afe4b5e0c6614eb3b0a44071b7 Mon Sep 17 00:00:00 2001 From: Athebyne <30442287+f-raZ0R@users.noreply.github.com> Date: Thu, 3 Oct 2024 10:51:49 -0400 Subject: [PATCH] Make ClientRevelationHolder more extensible for better use by other mods --- .../revelationary/ClientRevelationHolder.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dafuqs/revelationary/ClientRevelationHolder.java b/src/main/java/de/dafuqs/revelationary/ClientRevelationHolder.java index 31f58e4..09cba7d 100644 --- a/src/main/java/de/dafuqs/revelationary/ClientRevelationHolder.java +++ b/src/main/java/de/dafuqs/revelationary/ClientRevelationHolder.java @@ -135,12 +135,19 @@ static void rebuildAllChunks() { } // BLOCKS - private static void cloak(BlockState blockState) { + public static void cloak(BlockState blockState) { activeBlockStateSwaps.add(blockState); if (blockState instanceof RevelationAware revelationAware) { revelationAware.onCloak(); } } + + public static void uncloak(BlockState blockState) { + activeBlockStateSwaps.remove(blockState); + if (blockState instanceof RevelationAware revelationAware) { + revelationAware.onUncloak(); + } + } public static boolean isCloaked(Block block) { return activeBlockStateSwaps.contains(block.getDefaultState()); @@ -157,14 +164,26 @@ public static BlockState getCloakTarget(BlockState blockState) { return blockState; } } + + public static Set getBlockCloaks() { + return activeBlockStateSwaps; + } + // ITEMS - private static void cloak(Item item) { + public static void cloak(Item item) { activeItemSwaps.add(item); if (item instanceof RevelationAware revelationAware) { revelationAware.onCloak(); } } + + public static void uncloak(Item item) { + activeItemSwaps.remove(item); + if (item instanceof RevelationAware revelationAware) { + revelationAware.onUncloak(); + } + } public static boolean isCloaked(Item item) { return activeItemSwaps.contains(item); @@ -177,6 +196,10 @@ public static Item getCloakTarget(Item item) { return item; } } + + public static Set getItemCloaks() { + return activeItemSwaps; + } public static void cloakAll() { activeItemSwaps.clear();