generated from RubixDev/CarpetAddonTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #55
- Loading branch information
Showing
1 changed file
with
4 additions
and
10 deletions.
There are no files selected for viewing
14 changes: 4 additions & 10 deletions
14
src/main/java/de/rubixdev/rug/mixins/EndCrystalItemMixin.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 |
---|---|---|
@@ -1,23 +1,17 @@ | ||
package de.rubixdev.rug.mixins; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import de.rubixdev.rug.RugSettings; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.item.EndCrystalItem; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(EndCrystalItem.class) | ||
public class EndCrystalItemMixin { | ||
@Redirect( | ||
@ModifyExpressionValue( | ||
method = "useOnBlock", | ||
at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z")) | ||
private boolean allowPlacement(BlockState blockState, Block block) { | ||
if (!RugSettings.endCrystalPlacementRestriction) { | ||
return true; | ||
} | ||
|
||
return blockState.isOf(block); | ||
private boolean allowPlacement(boolean original) { | ||
return original || !RugSettings.endCrystalPlacementRestriction; | ||
} | ||
} |