Crafting table fix
This commit is contained in:
parent
a90c98a446
commit
4358767de7
2 changed files with 31 additions and 1 deletions
|
@ -0,0 +1,29 @@
|
||||||
|
package ru.betterend.mixin.common;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
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 net.minecraft.block.CraftingTableBlock;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.screen.CraftingScreenHandler;
|
||||||
|
import net.minecraft.screen.ScreenHandlerContext;
|
||||||
|
|
||||||
|
@Mixin(CraftingScreenHandler.class)
|
||||||
|
public abstract class CraftingScreenHandlerMixin
|
||||||
|
{
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
private ScreenHandlerContext context;
|
||||||
|
|
||||||
|
@Inject(method = "canUse", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void canUse(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
|
||||||
|
info.setReturnValue(context.run((world, pos) -> {
|
||||||
|
return world.getBlockState(pos).getBlock() instanceof CraftingTableBlock;
|
||||||
|
}, true));
|
||||||
|
info.cancel();
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,8 @@
|
||||||
"DimensionTypeMixin",
|
"DimensionTypeMixin",
|
||||||
"RecipeManagerMixin",
|
"RecipeManagerMixin",
|
||||||
"ServerPlayNetworkHandlerMixin",
|
"ServerPlayNetworkHandlerMixin",
|
||||||
"TagGroupLoaderMixin"
|
"TagGroupLoaderMixin",
|
||||||
|
"CraftingScreenHandlerMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue