From 425e1af55fd1bc9fd689d1d02b73776ca22079e1 Mon Sep 17 00:00:00 2001 From: Sara Freimer Date: Mon, 26 Aug 2024 08:58:47 -0500 Subject: [PATCH] Skip unnecessary block loaded check for lighting update --- .../mekanism/common/tile/TileEntityFluidTank.java | 5 ++--- src/main/java/mekanism/common/util/WorldUtils.java | 12 ------------ 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/java/mekanism/common/tile/TileEntityFluidTank.java b/src/main/java/mekanism/common/tile/TileEntityFluidTank.java index 26ce4d1b5c5..462745e3a50 100644 --- a/src/main/java/mekanism/common/tile/TileEntityFluidTank.java +++ b/src/main/java/mekanism/common/tile/TileEntityFluidTank.java @@ -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; @@ -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); } } } @@ -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 key = Objects.requireNonNull(fluid.getFluidHolder().getKey()); + ResourceKey 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 diff --git a/src/main/java/mekanism/common/util/WorldUtils.java b/src/main/java/mekanism/common/util/WorldUtils.java index 5213b5c5e18..1d264096e3c 100644 --- a/src/main/java/mekanism/common/util/WorldUtils.java +++ b/src/main/java/mekanism/common/util/WorldUtils.java @@ -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 */