Skip to content

Commit

Permalink
Fix Corruption of remapping of CT Blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Jul 9, 2024
1 parent 24e2309 commit 4ae8167
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.nomiceu.nomilabs.NomiLabs;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -65,7 +66,14 @@ public int getOldId() {
}

public int getId() {
return rl == null ? -1 : DataFixerHandler.getBlockToIdMap().getOrDefault(rl, 0);
// Return oldId as a fallback, so that if the rl is not registered, we can still let remappers remap it
if (rl == null || !DataFixerHandler.getBlockToIdMap().containsKey(rl)) {
NomiLabs.LOGGER.debug("[Data Fixer] Block at Pos {} has Resource Location {}, which is not registered.", rl, pos);
NomiLabs.LOGGER.debug("[Data Fixer] Most likely, this indicates removed blocks. If the Resource Location is null, report this to Nomi-CEu/Nomi-Labs Devs.");
return oldId;
}
// Still use getOrDefault, just in case
return DataFixerHandler.getBlockToIdMap().getOrDefault(rl, oldId);
}

public BlockStateLike copy() {
Expand Down

0 comments on commit 4ae8167

Please sign in to comment.