Skip to content

Commit

Permalink
Fix Crash with BOP and Labs FTB Utils Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Jan 4, 2025
1 parent 49dde87 commit 2ee6334
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ dependencies {
// FindMyItemsAndFluids (from CurseForge)
compileOnly rfg.deobf("curse.maven:findmyitemsandfluids-610085:3748963") // Version 1.0.0

// Biomes o Plenty (from CurseForge)
compileOnly rfg.deobf("curse.maven:biomes-o-plenty-220318:2842510") // Version 7.0.1.2444

/* -------------------------------- Soft Deps, Multiple Runtime Declaration -------------------------------- */
if (project.enable_draconic.toBoolean() || project.enable_thermal.toBoolean()) {
runtimeOnly "curse.maven:redstone-flux-270789:2920436" // Version 2.1.1.1
Expand Down Expand Up @@ -325,4 +328,8 @@ dependencies {
if (project.enable_mouse_tweaks.toBoolean()) {
runtimeOnly "curse.maven:mouse-tweaks-461660:4661407" // Mouse Tweaks Unofficial, Version 3.1.4
}

if (project.enable_biomes_o_plenty.toBoolean()) {
runtimeOnly "curse.maven:biomes-o-plenty-220318:2842510" // Version 7.0.1.2444
}
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,6 @@ enable_thermal = false

# Whether to enable Mouse Tweaks in runtime. Useful for testing interactions with various GUIs.
enable_mouse_tweaks = false

# Whether to enable Biomes o Plenty in runtime. Fixes an issue with a crash with FTB Utils, due to a Labs Mixin.
enable_biomes_o_plenty = false
1 change: 1 addition & 0 deletions src/main/java/com/nomiceu/nomilabs/LabsValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ public class LabsValues {
public static final String BETTER_P2P_MODID = "betterp2p";
public static final String FIND_ME_MODID = "findme";
public static final String REDSTONE_FLUX_MODID = "redstoneflux";
public static final String BIOMES_O_PLENTY_MODID = "biomesoplenty";
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class LabsLateMixinLoader implements ILateMixinLoader {
.put(LabsValues.BQU_MODID, true)
.put(LabsValues.BETTER_P2P_MODID, true)
.put(LabsValues.STORAGE_DRAWERS_MODID, true)
.put(LabsValues.BIOMES_O_PLENTY_MODID, true)
.build();

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.nomiceu.nomilabs.mixin.biomesoplenty;

import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import biomesoplenty.common.block.BlockBOPPlant;

/**
* Fixes a crash with BOP and FTB Utils.
*/
@Mixin(value = BlockBOPPlant.class, remap = false)
public class BlockBOPPlantMixin {

@Shadow
public IProperty<?> variantProperty;

@Inject(method = "isReplaceable", at = @At("HEAD"), cancellable = true, remap = true)
private void checkForInstance(IBlockAccess world, BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
IBlockState state = world.getBlockState(pos);

if (!state.getPropertyKeys().contains(variantProperty))
cir.setReturnValue(state.getMaterial().isReplaceable());
}
}
12 changes: 12 additions & 0 deletions src/main/resources/mixins.nomilabs.biomesoplenty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"package": "com.nomiceu.nomilabs.mixin.biomesoplenty",
"refmap": "mixins.nomilabs.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"BlockBOPPlantMixin"
],
"client": [],
"server": []
}

0 comments on commit 2ee6334

Please sign in to comment.