Improve inlining for some hot BlockBehavior and FluidState methods

This commit is contained in:
Spottedleaf
2020-07-06 20:46:50 -07:00
parent 2b90721a45
commit adf175d7ca
2 changed files with 62 additions and 2 deletions

View File

@@ -81,7 +81,7 @@
this.legacySolid = this.calculateSolid();
this.occlusionShape = this.canOcclude ? ((Block) this.owner).getOcclusionShape(this.asState()) : Shapes.empty();
@@ -945,8 +969,8 @@
@@ -945,19 +969,19 @@
return this.occlusionShape;
}
@@ -91,7 +91,30 @@
+ return this.shapeExceedsCube; // Paper - moved into shape cache init
}
public boolean useShapeForLightOcclusion() {
- public boolean useShapeForLightOcclusion() {
+ public final boolean useShapeForLightOcclusion() { // Paper - Perf: Final for inlining
return this.useShapeForLightOcclusion;
}
- public int getLightEmission() {
+ public final int getLightEmission() { // Paper - Perf: Final for inlining
return this.lightEmission;
}
- public boolean isAir() {
+ public final boolean isAir() { // Paper - Perf: Final for inlining
return this.isAir;
}
@@ -1035,7 +1059,7 @@
return this.solidRender;
}
- public boolean canOcclude() {
+ public final boolean canOcclude() { // Paper - Perf: Final for inlining
return this.canOcclude;
}
@@ -1125,9 +1149,15 @@
}
@@ -109,3 +132,17 @@
public void onRemove(Level world, BlockPos pos, BlockState state, boolean moved) {
this.getBlock().onRemove(this.asState(), world, pos, state, moved);
}
@@ -1250,11 +1280,11 @@
return this.getBlock().builtInRegistryHolder().is(key);
}
- public FluidState getFluidState() {
+ public final FluidState getFluidState() { // Paper - Perf: Final for inlining
return this.fluidState;
}
- public boolean isRandomlyTicking() {
+ public final boolean isRandomlyTicking() { // Paper - Perf: Final for inlining
return this.isRandomlyTicking;
}