diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-05-20 22:32:27 +0300 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-05-20 22:32:27 +0300 |
commit | 27944bd21fbccd966b547bbda89d8cf9741f3687 (patch) | |
tree | d8d56ed27d92f7cc3df41dcfaf9ccd03876e4516 | |
parent | d25e1c4dac698d7bc19a0435ba1704b213e6897f (diff) | |
download | LibGui-27944bd21fbccd966b547bbda89d8cf9741f3687.tar.gz LibGui-27944bd21fbccd966b547bbda89d8cf9741f3687.tar.bz2 LibGui-27944bd21fbccd966b547bbda89d8cf9741f3687.zip |
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.
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java | 7 |
1 files changed, 1 insertions, 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 * * <p>If no property delegate is found, returns an empty property delegate with no properties. * - * <p>Searches for blocks and block entities implementing {@link PropertyDelegateHolder}. + * <p>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(); |