Skip to content

Commit f7c6d1f

Browse files
committed
dummy out compat stuffs
1 parent 9a9ba97 commit f7c6d1f

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package de.dafuqs.revelationary.compat.jade;
2+
3+
import de.dafuqs.revelationary.api.revelations.*;
4+
import net.minecraft.world.entity.player.*;
5+
import net.minecraft.world.level.block.state.*;
6+
import snownee.jade.api.*;
7+
8+
public class RevelationaryJadePlugin implements IWailaPlugin {
9+
@Override
10+
public void registerClient(IWailaClientRegistration registration) {
11+
registration.addRayTraceCallback((hitResult, accessor, originalAccessor) -> {
12+
if (accessor instanceof BlockAccessor blockAccessor) {
13+
Player player = accessor.getPlayer();
14+
if (player.isCreative() || player.isSpectator()) {
15+
return accessor;
16+
}
17+
18+
if (blockAccessor.getBlock() instanceof RevelationAware aware) {
19+
if (!aware.isVisibleTo(player)) {
20+
BlockState cloakedState = aware.getBlockStateCloaks().get(blockAccessor.getBlockState());
21+
return registration.blockAccessor().from(blockAccessor).blockState(cloakedState).build();
22+
}
23+
}
24+
}
25+
26+
return accessor;
27+
});
28+
}
29+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package de.dafuqs.revelationary.compat.rei;
2+
3+
import de.dafuqs.revelationary.api.revelations.*;
4+
import de.dafuqs.revelationary.config.*;
5+
import me.shedaniel.rei.api.client.entry.filtering.base.*;
6+
import me.shedaniel.rei.api.client.plugins.*;
7+
import me.shedaniel.rei.api.common.util.*;
8+
import net.minecraft.world.item.*;
9+
10+
import java.util.*;
11+
import java.util.stream.*;
12+
13+
14+
public class RevelationaryREIPlugin implements REIClientPlugin {
15+
@SuppressWarnings("UnstableApiUsage")
16+
private BasicFilteringRule.MarkDirty filteringRule;
17+
private static Set<Item> hiddenStacks = Set.of();
18+
19+
public RevelationaryREIPlugin() {
20+
if (!RevelationaryConfig.get().HideCloakedEntriesFromRecipeViewers) return;
21+
CloakSetChanged.EVENT.register((added, removed, newStacks) -> {
22+
hiddenStacks = newStacks;
23+
//noinspection UnstableApiUsage
24+
filteringRule.markDirty();
25+
});
26+
}
27+
28+
@Override
29+
public void registerBasicEntryFiltering(@SuppressWarnings("UnstableApiUsage") BasicFilteringRule<?> rule) {
30+
// not using .show to not interfere with other filtering rules
31+
if (!RevelationaryConfig.get().HideCloakedEntriesFromRecipeViewers) return;
32+
//noinspection UnstableApiUsage
33+
filteringRule = rule.hide(() ->
34+
hiddenStacks.stream()
35+
.map(EntryStacks::of)
36+
.collect(Collectors.toList())
37+
);
38+
}
39+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package de.dafuqs.revelationary.compat.wthit;
2+
3+
import de.dafuqs.revelationary.api.revelations.*;
4+
import mcp.mobius.waila.api.*;
5+
import net.minecraft.world.entity.player.*;
6+
import net.minecraft.world.level.block.state.*;
7+
import org.jetbrains.annotations.*;
8+
9+
public class CloakedBlockComponentProvider implements IBlockComponentProvider {
10+
@Override
11+
public @Nullable BlockState getOverride(IBlockAccessor accessor, IPluginConfig config) {
12+
Player player = accessor.getPlayer();
13+
14+
RevelationAware aware = (RevelationAware) accessor.getBlock();
15+
if (!aware.isVisibleTo(player)) {
16+
return aware.getBlockStateCloaks().get(accessor.getBlockState());
17+
}
18+
19+
return accessor.getBlockState();
20+
}
21+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package de.dafuqs.revelationary.compat.wthit;
2+
3+
import de.dafuqs.revelationary.api.revelations.*;
4+
import mcp.mobius.waila.api.*;
5+
6+
public class RevelationaryWthitPlugin implements IWailaPlugin {
7+
@Override
8+
public void register(IRegistrar registrar) {
9+
registrar.addOverride(new CloakedBlockComponentProvider(), RevelationAware.class);
10+
}
11+
}

0 commit comments

Comments
 (0)