Improve inlining for some hot BlockBehavior and FluidState methods
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
--- a/net/minecraft/world/level/material/FluidState.java
|
||||
+++ b/net/minecraft/world/level/material/FluidState.java
|
||||
@@ -26,9 +26,11 @@
|
||||
public static final Codec<FluidState> CODEC = codec(BuiltInRegistries.FLUID.byNameCodec(), Fluid::defaultFluidState).stable();
|
||||
public static final int AMOUNT_MAX = 9;
|
||||
public static final int AMOUNT_FULL = 8;
|
||||
+ protected final boolean isEmpty; // Paper - Perf: moved from isEmpty()
|
||||
|
||||
public FluidState(Fluid fluid, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<FluidState> codec) {
|
||||
super(fluid, propertyMap, codec);
|
||||
+ this.isEmpty = fluid.isEmpty(); // Paper - Perf: moved from isEmpty()
|
||||
}
|
||||
|
||||
public Fluid getType() {
|
||||
@@ -44,7 +46,7 @@
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
- return this.getType().isEmpty();
|
||||
+ return this.isEmpty; // Paper - Perf: moved into constructor
|
||||
}
|
||||
|
||||
public float getHeight(BlockGetter world, BlockPos pos) {
|
||||
Reference in New Issue
Block a user