Skip to content

Commit

Permalink
feat: add Jade/Waila plugin that hides IOtherworldBlocks if covered, f…
Browse files Browse the repository at this point in the history
…ixes #1310 (#1311)
  • Loading branch information
GaeaKat authored Mar 1, 2025
1 parent 43fcfca commit 45e0596
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ dependencies {
//alltheores - for recipe testing
//enable once available for 1.20
//runtimeOnly "curse.maven:alltheores-405593:xyz" //

implementation "curse.maven:jade-324717:${jade_id}"
//PerViamInvenire - for AI integration testing
//runtimeOnly "curse.maven:perviaminvenire-449945:xyz" //
//enable once available for 1.20
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ per_viam_invenire_version_range=[0.1.57,)
emi_version=1.1.14+1.21.1
emi_version_range=[1.1.7+1.21,)
apothic_enchanting_version=1.2.5
apothic_enchanting_version_range=[1.2.5,)
apothic_enchanting_version_range=[1.2.5,)
jade_id=6155158
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.klikli_dev.occultism.integration.waila;

import com.klikli_dev.occultism.Occultism;
import com.klikli_dev.occultism.api.common.data.OtherworldBlockTier;
import com.klikli_dev.occultism.common.block.otherworld.IOtherworldBlock;
import com.klikli_dev.occultism.registry.OccultismBlocks;
import com.klikli_dev.occultism.util.CuriosUtil;
import net.minecraft.world.level.block.Blocks;
import snownee.jade.api.*;

@WailaPlugin
public class OccultismPlugin implements IWailaPlugin {
@Override
public void register(IWailaCommonRegistration registration) {
//TODO register data providers
}

@Override
public void registerClient(IWailaClientRegistration registration) {
registration.addRayTraceCallback((hitResult, accessor, originalAccessor) -> {
if(accessor!=null) {
boolean hasGoggles = CuriosUtil.hasGoggles(accessor.getPlayer());
if (accessor instanceof BlockAccessor blockAccessor) {
if (blockAccessor.getBlock() instanceof IOtherworldBlock otherworldBlock) {
if (otherworldBlock.getTier() == OtherworldBlockTier.ONE || hasGoggles) {
if (blockAccessor.getBlockState().getValue(IOtherworldBlock.UNCOVERED)) {
return registration.blockAccessor().from(blockAccessor).blockState(otherworldBlock.getUncoveredBlock().defaultBlockState()).build();
} else {
return registration.blockAccessor().from(blockAccessor).blockState(otherworldBlock.getCoveredBlock().defaultBlockState()).build();
}
} else {
return registration.blockAccessor().from(blockAccessor).blockState(otherworldBlock.getCoveredBlock().defaultBlockState()).build();
}
}
}
}
return accessor;
});
}

}

0 comments on commit 45e0596

Please sign in to comment.