From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Mon, 6 Jul 2020 20:46:50 -0700
Subject: [PATCH] Improve inlinig for some hot IBlockData methods


diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
@@ -0,0 +0,0 @@ public abstract class BlockBase {
         }
         // Paper end
 
+        // Paper start
+        protected boolean isTicking;
+        protected Fluid fluid;
+        // Paper end
+
         public void a() {
+            this.fluid = this.getBlock().d(this.p()); // Paper - moved from getFluid()
+            this.isTicking = this.getBlock().isTicking(this.p()); // Paper - moved from isTicking()
             if (!this.getBlock().o()) {
                 this.a = new BlockBase.BlockData.Cache(this.p());
             }
@@ -0,0 +0,0 @@ public abstract class BlockBase {
             return this.getBlock().d(this.p(), iblockaccess, blockposition);
         }
 
-        public boolean d() {
+        public final boolean d() { // Paper
             return this.a == null || this.a.c;
         }
 
-        public boolean e() {
+        public final boolean e() { // Paper
             return this.e;
         }
 
-        public int f() {
+        public final int f() { // Paper
             return this.b;
         }
 
-        public boolean isAir() {
+        public final boolean isAir() { // Paper
             return this.f;
         }
 
@@ -0,0 +0,0 @@ public abstract class BlockBase {
             }
         }
 
-        public boolean l() {
+        public final boolean l() { // Paper
             return this.k;
         }
 
@@ -0,0 +0,0 @@ public abstract class BlockBase {
             return this.getBlock().a(block);
         }
 
-        public Fluid getFluid() {
-            return this.getBlock().d(this.p());
+        public final Fluid getFluid() { // Paper
+            return this.fluid; // Paper - moved into init
         }
 
-        public boolean isTicking() {
-            return this.getBlock().isTicking(this.p());
+        public final boolean isTicking() { // Paper
+            return this.isTicking; // Paper - moved into init
         }
 
         public SoundEffectType getStepSound() {
diff --git a/src/main/java/net/minecraft/world/level/material/Fluid.java b/src/main/java/net/minecraft/world/level/material/Fluid.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/material/Fluid.java
+++ b/src/main/java/net/minecraft/world/level/material/Fluid.java
@@ -0,0 +0,0 @@ public final class Fluid extends IBlockDataHolder<FluidType, Fluid> {
 
     public static final Codec<Fluid> a = a((Codec) IRegistry.FLUID, FluidType::h).stable();
 
+    // Paper start
+    protected final boolean isEmpty;
+    // Paper end
     public Fluid(FluidType fluidtype, ImmutableMap<IBlockState<?>, Comparable<?>> immutablemap, MapCodec<Fluid> mapcodec) {
         super(fluidtype, immutablemap, mapcodec);
+        this.isEmpty = fluidtype.b(); // Paper - moved from isEmpty()
     }
 
     public FluidType getType() {
@@ -0,0 +0,0 @@ public final class Fluid extends IBlockDataHolder<FluidType, Fluid> {
     }
 
     public boolean isEmpty() {
-        return this.getType().b();
+        return this.isEmpty; // Paper - moved into constructor
     }
 
     public float getHeight(IBlockAccess iblockaccess, BlockPosition blockposition) {