Skip to content

Commit

Permalink
Skip unnecessary block loaded check for lighting update
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster committed Aug 26, 2024
1 parent a097f3d commit 425e1af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/main/java/mekanism/common/tile/TileEntityFluidTank.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import mekanism.common.util.FluidUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.NBTUtils;
import mekanism.common.util.WorldUtils;
import net.minecraft.SharedConstants;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -147,7 +146,7 @@ private void checkLight() {
int lightLevel = getBlockType().getLightEmission(getBlockState(), level, worldPosition);
if (lightLevel != lastLightLevel) {
lastLightLevel = lightLevel;
WorldUtils.recheckLighting(level, worldPosition);
level.getLightEngine().checkBlock(worldPosition);
}
}
}
Expand Down Expand Up @@ -369,7 +368,7 @@ public CompoundTag getReducedUpdateTag(@NotNull HolderLookup.Provider provider)
if (!fluid.isEmpty()) {
//Note: This should never be null as it returns a reference holder
// We throw if it is, so that we can find the bug if it gets introduced during porting
ResourceKey<Fluid> key = Objects.requireNonNull(fluid.getFluidHolder().getKey());
ResourceKey<Fluid> key = Objects.requireNonNull(fluid.getFluidHolder().getKey(), "Resource key should always be present");
fluidData.putString(SerializationConstants.ID, key.location().toString());
if (!fluid.isComponentsPatchEmpty()) {
//Note: This isn't necessarily optimal, but it does mean in general we can avoid codecs unless it happens to be a fluid that
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/mekanism/common/util/WorldUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -793,18 +793,6 @@ public static void updateBlock(@Nullable Level world, @NotNull BlockPos pos, Blo
}
}

/**
* Rechecks the lighting at a specific block's position if the block is loaded.
*
* @param world world the block is in
* @param pos coordinates
*/
public static void recheckLighting(@Nullable BlockAndTintGetter world, @NotNull BlockPos pos) {
if (isBlockLoaded(world, pos)) {
world.getLightEngine().checkBlock(pos);
}
}

/**
* Vanilla copy of {@link net.minecraft.client.multiplayer.ClientLevel#getSkyDarken(float)} used to be World#getSunBrightness
*/
Expand Down

0 comments on commit 425e1af

Please sign in to comment.