Remove unnecessary null checks for missing mappings

"Missing mappings" are given placeholder values upon startup, so these null checks are pointless.
This commit is contained in:
RednedEpic 2019-10-15 22:21:44 -05:00 committed by RednedEpic
parent 0ac89f4880
commit eabbacaaad
3 changed files with 3 additions and 18 deletions

View file

@ -1,18 +1,11 @@
package org.geysermc.connector.network.translators.block; package org.geysermc.connector.network.translators.block;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState; import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
import org.geysermc.connector.console.GeyserLogger;
import org.geysermc.connector.utils.Toolbox; import org.geysermc.connector.utils.Toolbox;
public class BlockTranslator { public class BlockTranslator {
public BlockEntry getBedrockBlock(BlockState state) { public BlockEntry getBedrockBlock(BlockState state) {
BlockEntry bedrockItem = Toolbox.BLOCK_ENTRIES.get(state.getId()); return 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;
} }
} }

View file

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

View file

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