3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 08:10:11 +01:00

Remove unnecessary null checks for missing mappings

"Missing mappings" are given placeholder values upon startup, so these null checks are pointless.
Dieser Commit ist enthalten in:
RednedEpic 2019-10-15 22:21:44 -05:00 committet von RednedEpic
Ursprung 0ac89f4880
Commit eabbacaaad
3 geänderte Dateien mit 3 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -1,18 +1,11 @@
package org.geysermc.connector.network.translators.block;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
import org.geysermc.connector.console.GeyserLogger;
import org.geysermc.connector.utils.Toolbox;
public class BlockTranslator {
public BlockEntry getBedrockBlock(BlockState state) {
BlockEntry bedrockItem = Toolbox.BLOCK_ENTRIES.get(state.getId());
if (bedrockItem == null) {
GeyserLogger.DEFAULT.debug("Missing mapping for java block " + state.getId() + "/nPlease report this to Geyser.");
return Toolbox.BLOCK_ENTRIES.get(10); // so we can walk and not getting stuck x)
}
return bedrockItem;
return Toolbox.BLOCK_ENTRIES.get(state.getId());
}
}

Datei anzeigen

@ -75,13 +75,7 @@ public class ItemTranslator {
}
public ItemEntry getItem(ItemStack stack) {
ItemEntry item = Toolbox.ITEM_ENTRIES.get(stack.getId());
if (item == null) {
GeyserLogger.DEFAULT.debug("Missing mapping for java item " + stack.getId());
return ItemEntry.AIR;
}
return item;
return Toolbox.ITEM_ENTRIES.get(stack.getId());
}
public ItemEntry getItem(ItemData data) {

Datei anzeigen

@ -15,11 +15,9 @@ public class ChunkUtils {
Chunk[] chunks = column.getChunks();
int chunkSectionCount = chunks.length;
chunkData.sections = new ChunkSection[chunkSectionCount];
for (int i = 0; i < chunkSectionCount; i++) {
chunkData.sections[i] = new ChunkSection();
}
for (int chunkY = 0; chunkY < chunkSectionCount; chunkY++) {
chunkData.sections[chunkY] = new ChunkSection();
Chunk chunk = chunks[chunkY];
if (chunk == null || chunk.isEmpty())