mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Fixed Crafter on a stick
This commit is contained in:
parent
2a2f5c6cdc
commit
c4d81aea1b
1 changed files with 7 additions and 1 deletions
|
@ -17,6 +17,7 @@ import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.InteractionResultHolder;
|
import net.minecraft.world.InteractionResultHolder;
|
||||||
import net.minecraft.world.SimpleMenuProvider;
|
import net.minecraft.world.SimpleMenuProvider;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.inventory.ContainerLevelAccess;
|
||||||
import net.minecraft.world.inventory.CraftingMenu;
|
import net.minecraft.world.inventory.CraftingMenu;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
@ -34,7 +35,12 @@ public class ItemCrafterOnAStick extends ItemBase {
|
||||||
@Override
|
@Override
|
||||||
public InteractionResultHolder<ItemStack> use(Level world, @Nonnull Player player, @Nonnull InteractionHand hand) {
|
public InteractionResultHolder<ItemStack> use(Level world, @Nonnull Player player, @Nonnull InteractionHand hand) {
|
||||||
if (!world.isClientSide) {
|
if (!world.isClientSide) {
|
||||||
player.openMenu(new SimpleMenuProvider((windowId, playerInventory, playerEntity) -> new CraftingMenu(windowId, playerInventory), CONTAINER_TITLE));
|
player.openMenu(new SimpleMenuProvider((windowId, playerInventory, playerEntity) -> new CraftingMenu(windowId, playerInventory, ContainerLevelAccess.create(world, player.blockPosition())){
|
||||||
|
@Override
|
||||||
|
public boolean stillValid(Player playerIn) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}, CONTAINER_TITLE));
|
||||||
}
|
}
|
||||||
return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand));
|
return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue