Skip to content

Commit

Permalink
Make ClientRevelationHolder more extensible
Browse files Browse the repository at this point in the history
for better use by other mods
  • Loading branch information
f-raZ0R authored and DaFuqs committed Oct 19, 2024
1 parent ad7ddf6 commit 6254e34
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/main/java/de/dafuqs/revelationary/ClientRevelationHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,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());
Expand All @@ -142,14 +149,26 @@ public static BlockState getCloakTarget(BlockState blockState) {
return blockState;
}
}

public static Set<BlockState> 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);
Expand All @@ -162,6 +181,10 @@ public static Item getCloakTarget(Item item) {
return item;
}
}

public static Set<Item> getItemCloaks() {
return activeItemSwaps;
}

public static void cloakAll() {
activeItemSwaps.clear();
Expand Down

0 comments on commit 6254e34

Please sign in to comment.