mrh0 / buildersaddition

Builders Addition Minecraft Forge Mod by MRH0
MIT License
6 stars 12 forks source link

Optimize the collision hitbox of chairs. #66

Open abovearth opened 1 year ago

abovearth commented 1 year ago

The chairs are getting the shape calculated exactly, which in my opinion isn't exactly necessary. Is it possible to optimize the collision hitbox, such that mobs colliding with the chair take up less cpu time?

From a spark profile I ran: afbeelding

or as text: Server thread7.30%22918.61ms

com.mrh0.buildersaddition.blocks.Chair.getShape()7.20%
    com.mrh0.buildersaddition.blocks.Chair.getLegsShape()3.78%
        net.minecraft.world.phys.shapes.Shapes.or()3.75%
            java.util.stream.ReferencePipeline.reduce()3.75%
                java.util.stream.AbstractPipeline.evaluate()3.75%
                    java.util.stream.ReduceOps$ReduceOp.evaluateSequential()3.75%
                        java.util.stream.AbstractPipeline.wrapAndCopyInto()3.75%
                            java.util.stream.AbstractPipeline.copyInto()3.75%
                                java.util.Spliterators$ArraySpliterator.forEachRemaining()3.75%
                                    java.util.stream.ReduceOps$1ReducingSink.accept()3.75%
                                        net.minecraft.world.phys.shapes.Shapes$$Lambda$1355.0x00000008011c97a0.apply()3.74%
                                        itable stub (native)0.00%
                                    itable stub (native)0.00%
                                itable stub (native)0.00%
        com.mrh0.buildersaddition.blocks.Chair.getLegShape()0.02%
    net.minecraft.world.phys.shapes.Shapes.or()3.42%
    com.mrh0.buildersaddition.blocks.Chair.getBackShape()0.00%