parent
8342ef83ec
commit
ed494fd52a
@ -1,24 +1,22 @@
|
||||
package com.thebrokenrail.slightlyvanilla.mixin;
|
||||
|
||||
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.NetherPortalBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.dimension.AreaHelper;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Mixin(NetherPortalBlock.AreaHelper.class)
|
||||
@Mixin(AreaHelper.class)
|
||||
public class MixinNetherPortalBlockAreaHelper {
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z"), method = "*")
|
||||
public boolean redirectBlock(BlockState state, Block obsidian) {
|
||||
if (SlightlyVanilla.getConfig().cryingObsidianNetherPortal && state.isIn(SlightlyVanilla.EXTRA_PORTAL_BLOCKS_TAG) && obsidian == Blocks.OBSIDIAN) {
|
||||
return true;
|
||||
} else {
|
||||
return state.isOf(obsidian);
|
||||
@Inject(at = @At("HEAD"), method = "method_30487", cancellable = true)
|
||||
private static void isValidFrameBlock(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
if (SlightlyVanilla.getConfig().cryingObsidianNetherPortal) {
|
||||
info.setReturnValue(state.isIn(SlightlyVanilla.NETHER_PORTAL_FRAME_BLOCKS_TAG));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:obsidian",
|
||||
"minecraft:crying_obsidian"
|
||||
]
|
||||
}
|
Loading…
Reference in new issue