11package re .domi .fastchest .mixin ;
22
3- import net .minecraft .block .BlockRenderType ;
4- import net .minecraft .block .BlockState ;
5- import net .minecraft .block .ChestBlock ;
3+ import net .minecraft .block .*;
64import net .minecraft .block .entity .BlockEntity ;
75import net .minecraft .block .entity .BlockEntityTicker ;
86import net .minecraft .block .entity .BlockEntityType ;
7+ import net .minecraft .block .entity .ChestBlockEntity ;
98import net .minecraft .world .World ;
109import org .spongepowered .asm .mixin .Mixin ;
10+ import org .spongepowered .asm .mixin .Unique ;
1111import org .spongepowered .asm .mixin .injection .At ;
1212import org .spongepowered .asm .mixin .injection .Inject ;
1313import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
1414import re .domi .fastchest .config .Config ;
1515
16- @ Mixin (ChestBlock .class )
17- public class ChestBlockMixin
16+ import java .util .function .Supplier ;
17+
18+ @ Mixin (value = ChestBlock .class , priority = 1500 )
19+ public abstract class ChestBlockMixin extends AbstractChestBlock <ChestBlockEntity >
1820{
19- @ Inject (method = "getRenderType" , at = @ At ("HEAD" ), cancellable = true )
21+ @ Override
22+ @ Unique (silent = true )
23+ protected BlockRenderType getRenderType (BlockState state )
24+ {
25+ return super .getRenderType (state );
26+ }
27+
28+ @ SuppressWarnings ({ "MixinAnnotationTarget" , "UnresolvedMixinReference" })
29+ @ Inject (method = {"getRenderType" , "method_9604" }, at = @ At ("HEAD" ), cancellable = true , remap = false )
2030 private void replaceRenderType (BlockState state , CallbackInfoReturnable <BlockRenderType > cir )
2131 {
22- if (Config .simplifiedChest )
32+ if (! Config .simplifiedChest )
2333 {
24- cir .setReturnValue (BlockRenderType .MODEL );
34+ cir .setReturnValue (BlockRenderType .INVISIBLE );
2535 }
2636 }
2737
@@ -33,4 +43,10 @@ private <T extends BlockEntity> void removeTicker(World world, BlockState state,
3343 cir .setReturnValue (null );
3444 }
3545 }
46+
47+ @ SuppressWarnings ({"DataFlowIssue" , "unused" })
48+ protected ChestBlockMixin (Settings settings , Supplier <BlockEntityType <? extends ChestBlockEntity >> entityTypeRetriever )
49+ {
50+ super (null , null );
51+ }
3652}
0 commit comments