diff options
Diffstat (limited to 'GuiTest/src/main')
-rw-r--r-- | GuiTest/src/main/java/io/github/cottonmc/test/GuiBlock.java | 6 | ||||
-rw-r--r-- | GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlock.java b/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlock.java index ec37c55..ded6fcb 100644 --- a/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlock.java +++ b/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlock.java @@ -8,6 +8,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.Identifier; import net.minecraft.util.hit.BlockHitResult; @@ -21,13 +22,12 @@ public class GuiBlock extends Block implements BlockEntityProvider { super(FabricBlockSettings.copy(Blocks.IRON_BLOCK).build()); } - @Override - public boolean activate(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hitResult) { + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hitResult) { if (!world.isClient) { ContainerProviderRegistry.INSTANCE.openContainer(new Identifier(LibGuiTest.MODID, "gui"), player, (buf)->buf.writeBlockPos(pos)); } - return true; + return ActionResult.SUCCESS; } diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java b/GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java index 37b98f6..b777361 100644 --- a/GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java +++ b/GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java @@ -25,6 +25,6 @@ public class GuiItem extends Item { MinecraftClient.getInstance().openScreen(new CottonClientScreen(new TestClientGui())); } - return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, (hand==Hand.MAIN_HAND) ? player.getMainHandStack() : player.getOffHandStack(), false); + return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, (hand==Hand.MAIN_HAND) ? player.getMainHandStack() : player.getOffHandStack()); } } |