From 27944bd21fbccd966b547bbda89d8cf9741f3687 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Wed, 20 May 2020 22:32:27 +0300 Subject: Remove the ability to use PropertyDelegateHolders on blocks Blocks can't have global state, and creating property delegates based on block states isn't a good idea in my opinion. Property changes would involve state changes, and menus sync the properties automatically so it could cause a lot of pointless client-side updates. Closes #56. --- .../io/github/cottonmc/cotton/gui/CottonInventoryController.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java b/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java index cbefb7a..f5153e7 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java @@ -405,18 +405,13 @@ public class CottonInventoryController extends ScreenHandler implements GuiDescr * *

If no property delegate is found, returns an empty property delegate with no properties. * - *

Searches for blocks and block entities implementing {@link PropertyDelegateHolder}. + *

Searches for block entities implementing {@link PropertyDelegateHolder}. * * @param ctx the context * @return the found property delegate */ public static PropertyDelegate getBlockPropertyDelegate(ScreenHandlerContext ctx) { return ctx.run((world, pos) -> { - BlockState state = world.getBlockState(pos); - Block block = state.getBlock(); - if (block instanceof PropertyDelegateHolder) { - return ((PropertyDelegateHolder)block).getPropertyDelegate(); - } BlockEntity be = world.getBlockEntity(pos); if (be!=null && be instanceof PropertyDelegateHolder) { return ((PropertyDelegateHolder)be).getPropertyDelegate(); -- cgit