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;
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());
}
}

View File

@ -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) {

View File

@ -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())