-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Crash with BOP and Labs FTB Utils Fix
- Loading branch information
1 parent
49dde87
commit 2ee6334
Showing
6 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/com/nomiceu/nomilabs/mixin/biomesoplenty/BlockBOPPlantMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": [] | ||
} |