WuestMan Posted December 26, 2019 Posted December 26, 2019 (edited) So I started the update from 1.14.4 to 1.15.1 and got stuck pretty early with the rendering changes. I have a block which changes it's visual state when it receives a redstone signal. This doesn't seem to work well with the new code layout. I found that I have to use RenderTypeLookup#setRenderLayer now instead of overriding a method on my block, good. However while reviewing that class (RenderTypeLookup) I noticed the "canRenderInLayer" method does nothing with the block state passed in except get the block associated with the state. client setup method @Override public void clientSetup(FMLClientSetupEvent clientSetupEvent) { RenderTypeLookup.setRenderLayer(ModRegistry.BoundaryBlock(), BlockBoundary::canRenderInLayer); } RenderTypeLookup#canRenderInLayer - This is called in chunk rendering. public static boolean canRenderInLayer(BlockState state, RenderType type) { Block block = state.getBlock(); if (block instanceof LeavesBlock) { return field_228388_c_ ? type == RenderType.func_228641_d_() : type == RenderType.func_228639_c_(); } else { java.util.function.Predicate<RenderType> rendertype; synchronized (RenderTypeLookup.class) { rendertype = blockRenderChecks.get(block); } return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); } } BlockBoundary#canRenderInLayer /** * Queries if this block should render in a given layer. */ public static boolean canRenderInLayer(Object layer) { // NOTE: This code is in a partial state. Need to find out how to get block state to determine if the block should be rendered this pass. boolean powered = false;// state.get(Powered); RenderState renderState = (RenderState)layer; // first part is translucent, second is for solid. return (layer == RenderType.func_228645_f_() && !powered) || (layer == RenderType.func_228639_c_() && powered); } I was using the canRenderInLayer method as a shortcut so the model wouldn't have to be loaded (trying to be efficient). So I guess my question would be. Should I even worry about this or is there a hook or something that I can use instead? Note: I have another block which becomes invisible if it receives a redstone signal (changes block state) or if it's interacted with (it phases out and then back in). Any help or ideas would be appreciated! Thank you! Edited January 4, 2020 by WuestMan Solved issue myself Quote
WuestMan Posted January 4, 2020 Author Posted January 4, 2020 After futzing around for a while on this and testing things out. Setting the render layer based on block state wasn't necessary. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.