Added Block#isSolid and fixed player collision

This commit is contained in:
Felix Cravic 2020-04-22 13:49:52 +02:00
parent ab3aabf6b0
commit 01c348349b
2 changed files with 534 additions and 1 deletions

View File

@ -93,7 +93,7 @@ public class Player extends LivingEntity {
this.username = username; this.username = username;
this.playerConnection = playerConnection; this.playerConnection = playerConnection;
setBoundingBox(0.6f, 1.8f, 0.6f); setBoundingBox(0.69f, 1.8f, 0.69f);
// Some client update // Some client update
getPlayerConnection().sendPacket(getPropertiesPacket()); // Send default properties getPlayerConnection().sendPacket(getPropertiesPacket()); // Send default properties

View File

@ -722,6 +722,539 @@ public enum Block {
return blockId; return blockId;
} }
public boolean isSolid() {
if (blockId == 0) {
return false;
}
switch (this) {
case ACACIA_DOOR:
case ACACIA_FENCE:
case ACACIA_FENCE_GATE:
case ACACIA_LEAVES:
case ACACIA_LOG:
case ACACIA_PLANKS:
case ACACIA_PRESSURE_PLATE:
case ACACIA_SIGN:
case ACACIA_SLAB:
case ACACIA_STAIRS:
case ACACIA_TRAPDOOR:
case ACACIA_WALL_SIGN:
case ACACIA_WOOD:
case ANDESITE:
case ANDESITE_SLAB:
case ANDESITE_STAIRS:
case ANDESITE_WALL:
case ANVIL:
case BAMBOO:
case BARREL:
case BARRIER:
case BEACON:
case BEDROCK:
case BEEHIVE:
case BEE_NEST:
case BELL:
case BIRCH_DOOR:
case BIRCH_FENCE:
case BIRCH_FENCE_GATE:
case BIRCH_LEAVES:
case BIRCH_LOG:
case BIRCH_PLANKS:
case BIRCH_PRESSURE_PLATE:
case BIRCH_SIGN:
case BIRCH_SLAB:
case BIRCH_STAIRS:
case BIRCH_TRAPDOOR:
case BIRCH_WALL_SIGN:
case BIRCH_WOOD:
case BLACK_BANNER:
case BLACK_BED:
case BLACK_CONCRETE:
case BLACK_CONCRETE_POWDER:
case BLACK_GLAZED_TERRACOTTA:
case BLACK_SHULKER_BOX:
case BLACK_STAINED_GLASS:
case BLACK_STAINED_GLASS_PANE:
case BLACK_TERRACOTTA:
case BLACK_WALL_BANNER:
case BLACK_WOOL:
case BLAST_FURNACE:
case BLUE_BANNER:
case BLUE_BED:
case BLUE_CONCRETE:
case BLUE_CONCRETE_POWDER:
case BLUE_GLAZED_TERRACOTTA:
case BLUE_ICE:
case BLUE_SHULKER_BOX:
case BLUE_STAINED_GLASS:
case BLUE_STAINED_GLASS_PANE:
case BLUE_TERRACOTTA:
case BLUE_WALL_BANNER:
case BLUE_WOOL:
case BONE_BLOCK:
case BOOKSHELF:
case BRAIN_CORAL_BLOCK:
case BREWING_STAND:
case BRICKS:
case BRICK_SLAB:
case BRICK_STAIRS:
case BRICK_WALL:
case BROWN_BANNER:
case BROWN_BED:
case BROWN_CONCRETE:
case BROWN_CONCRETE_POWDER:
case BROWN_GLAZED_TERRACOTTA:
case BROWN_MUSHROOM_BLOCK:
case BROWN_SHULKER_BOX:
case BROWN_STAINED_GLASS:
case BROWN_STAINED_GLASS_PANE:
case BROWN_TERRACOTTA:
case BROWN_WALL_BANNER:
case BROWN_WOOL:
case BUBBLE_CORAL_BLOCK:
case CACTUS:
case CAKE:
case CAMPFIRE:
case CARTOGRAPHY_TABLE:
case CARVED_PUMPKIN:
case CAULDRON:
case CHAIN_COMMAND_BLOCK:
case CHEST:
case CHIPPED_ANVIL:
case CHISELED_QUARTZ_BLOCK:
case CHISELED_RED_SANDSTONE:
case CHISELED_SANDSTONE:
case CHISELED_STONE_BRICKS:
case CLAY:
case COAL_BLOCK:
case COAL_ORE:
case COARSE_DIRT:
case COBBLESTONE:
case COBBLESTONE_SLAB:
case COBBLESTONE_STAIRS:
case COBBLESTONE_WALL:
case COMMAND_BLOCK:
case COMPOSTER:
case CONDUIT:
case CRACKED_STONE_BRICKS:
case CRAFTING_TABLE:
case CUT_RED_SANDSTONE:
case CUT_RED_SANDSTONE_SLAB:
case CUT_SANDSTONE:
case CUT_SANDSTONE_SLAB:
case CYAN_BANNER:
case CYAN_BED:
case CYAN_CONCRETE:
case CYAN_CONCRETE_POWDER:
case CYAN_GLAZED_TERRACOTTA:
case CYAN_SHULKER_BOX:
case CYAN_STAINED_GLASS:
case CYAN_STAINED_GLASS_PANE:
case CYAN_TERRACOTTA:
case CYAN_WALL_BANNER:
case CYAN_WOOL:
case DAMAGED_ANVIL:
case DARK_OAK_DOOR:
case DARK_OAK_FENCE:
case DARK_OAK_FENCE_GATE:
case DARK_OAK_LEAVES:
case DARK_OAK_LOG:
case DARK_OAK_PLANKS:
case DARK_OAK_PRESSURE_PLATE:
case DARK_OAK_SIGN:
case DARK_OAK_SLAB:
case DARK_OAK_STAIRS:
case DARK_OAK_TRAPDOOR:
case DARK_OAK_WALL_SIGN:
case DARK_OAK_WOOD:
case DARK_PRISMARINE:
case DARK_PRISMARINE_SLAB:
case DARK_PRISMARINE_STAIRS:
case DAYLIGHT_DETECTOR:
case DEAD_BRAIN_CORAL:
case DEAD_BRAIN_CORAL_BLOCK:
case DEAD_BRAIN_CORAL_FAN:
case DEAD_BRAIN_CORAL_WALL_FAN:
case DEAD_BUBBLE_CORAL:
case DEAD_BUBBLE_CORAL_BLOCK:
case DEAD_BUBBLE_CORAL_FAN:
case DEAD_BUBBLE_CORAL_WALL_FAN:
case DEAD_FIRE_CORAL:
case DEAD_FIRE_CORAL_BLOCK:
case DEAD_FIRE_CORAL_FAN:
case DEAD_FIRE_CORAL_WALL_FAN:
case DEAD_HORN_CORAL:
case DEAD_HORN_CORAL_BLOCK:
case DEAD_HORN_CORAL_FAN:
case DEAD_HORN_CORAL_WALL_FAN:
case DEAD_TUBE_CORAL:
case DEAD_TUBE_CORAL_BLOCK:
case DEAD_TUBE_CORAL_FAN:
case DEAD_TUBE_CORAL_WALL_FAN:
case DIAMOND_BLOCK:
case DIAMOND_ORE:
case DIORITE:
case DIORITE_SLAB:
case DIORITE_STAIRS:
case DIORITE_WALL:
case DIRT:
case DISPENSER:
case DRAGON_EGG:
case DRIED_KELP_BLOCK:
case DROPPER:
case EMERALD_BLOCK:
case EMERALD_ORE:
case ENCHANTING_TABLE:
case ENDER_CHEST:
case END_PORTAL_FRAME:
case END_STONE:
case END_STONE_BRICKS:
case END_STONE_BRICK_SLAB:
case END_STONE_BRICK_STAIRS:
case END_STONE_BRICK_WALL:
case FARMLAND:
case FIRE_CORAL_BLOCK:
case FLETCHING_TABLE:
case FROSTED_ICE:
case FURNACE:
case GLASS:
case GLASS_PANE:
case GLOWSTONE:
case GOLD_BLOCK:
case GOLD_ORE:
case GRANITE:
case GRANITE_SLAB:
case GRANITE_STAIRS:
case GRANITE_WALL:
case GRASS_BLOCK:
case GRASS_PATH:
case GRAVEL:
case GRAY_BANNER:
case GRAY_BED:
case GRAY_CONCRETE:
case GRAY_CONCRETE_POWDER:
case GRAY_GLAZED_TERRACOTTA:
case GRAY_SHULKER_BOX:
case GRAY_STAINED_GLASS:
case GRAY_STAINED_GLASS_PANE:
case GRAY_TERRACOTTA:
case GRAY_WALL_BANNER:
case GRAY_WOOL:
case GREEN_BANNER:
case GREEN_BED:
case GREEN_CONCRETE:
case GREEN_CONCRETE_POWDER:
case GREEN_GLAZED_TERRACOTTA:
case GREEN_SHULKER_BOX:
case GREEN_STAINED_GLASS:
case GREEN_STAINED_GLASS_PANE:
case GREEN_TERRACOTTA:
case GREEN_WALL_BANNER:
case GREEN_WOOL:
case GRINDSTONE:
case HAY_BLOCK:
case HEAVY_WEIGHTED_PRESSURE_PLATE:
case HONEYCOMB_BLOCK:
case HONEY_BLOCK:
case HOPPER:
case HORN_CORAL_BLOCK:
case ICE:
case INFESTED_CHISELED_STONE_BRICKS:
case INFESTED_COBBLESTONE:
case INFESTED_CRACKED_STONE_BRICKS:
case INFESTED_MOSSY_STONE_BRICKS:
case INFESTED_STONE:
case INFESTED_STONE_BRICKS:
case IRON_BARS:
case IRON_BLOCK:
case IRON_DOOR:
case IRON_ORE:
case IRON_TRAPDOOR:
case JACK_O_LANTERN:
case JIGSAW:
case JUKEBOX:
case JUNGLE_DOOR:
case JUNGLE_FENCE:
case JUNGLE_FENCE_GATE:
case JUNGLE_LEAVES:
case JUNGLE_LOG:
case JUNGLE_PLANKS:
case JUNGLE_PRESSURE_PLATE:
case JUNGLE_SIGN:
case JUNGLE_SLAB:
case JUNGLE_STAIRS:
case JUNGLE_TRAPDOOR:
case JUNGLE_WALL_SIGN:
case JUNGLE_WOOD:
case LANTERN:
case LAPIS_BLOCK:
case LAPIS_ORE:
case LECTERN:
case LIGHT_BLUE_BANNER:
case LIGHT_BLUE_BED:
case LIGHT_BLUE_CONCRETE:
case LIGHT_BLUE_CONCRETE_POWDER:
case LIGHT_BLUE_GLAZED_TERRACOTTA:
case LIGHT_BLUE_SHULKER_BOX:
case LIGHT_BLUE_STAINED_GLASS:
case LIGHT_BLUE_STAINED_GLASS_PANE:
case LIGHT_BLUE_TERRACOTTA:
case LIGHT_BLUE_WALL_BANNER:
case LIGHT_BLUE_WOOL:
case LIGHT_GRAY_BANNER:
case LIGHT_GRAY_BED:
case LIGHT_GRAY_CONCRETE:
case LIGHT_GRAY_CONCRETE_POWDER:
case LIGHT_GRAY_GLAZED_TERRACOTTA:
case LIGHT_GRAY_SHULKER_BOX:
case LIGHT_GRAY_STAINED_GLASS:
case LIGHT_GRAY_STAINED_GLASS_PANE:
case LIGHT_GRAY_TERRACOTTA:
case LIGHT_GRAY_WALL_BANNER:
case LIGHT_GRAY_WOOL:
case LIGHT_WEIGHTED_PRESSURE_PLATE:
case LIME_BANNER:
case LIME_BED:
case LIME_CONCRETE:
case LIME_CONCRETE_POWDER:
case LIME_GLAZED_TERRACOTTA:
case LIME_SHULKER_BOX:
case LIME_STAINED_GLASS:
case LIME_STAINED_GLASS_PANE:
case LIME_TERRACOTTA:
case LIME_WALL_BANNER:
case LIME_WOOL:
case LOOM:
case MAGENTA_BANNER:
case MAGENTA_BED:
case MAGENTA_CONCRETE:
case MAGENTA_CONCRETE_POWDER:
case MAGENTA_GLAZED_TERRACOTTA:
case MAGENTA_SHULKER_BOX:
case MAGENTA_STAINED_GLASS:
case MAGENTA_STAINED_GLASS_PANE:
case MAGENTA_TERRACOTTA:
case MAGENTA_WALL_BANNER:
case MAGENTA_WOOL:
case MAGMA_BLOCK:
case MELON:
case MOSSY_COBBLESTONE:
case MOSSY_COBBLESTONE_SLAB:
case MOSSY_COBBLESTONE_STAIRS:
case MOSSY_COBBLESTONE_WALL:
case MOSSY_STONE_BRICKS:
case MOSSY_STONE_BRICK_SLAB:
case MOSSY_STONE_BRICK_STAIRS:
case MOSSY_STONE_BRICK_WALL:
case MOVING_PISTON:
case MUSHROOM_STEM:
case MYCELIUM:
case NETHERRACK:
case NETHER_BRICKS:
case NETHER_BRICK_FENCE:
case NETHER_BRICK_SLAB:
case NETHER_BRICK_STAIRS:
case NETHER_BRICK_WALL:
case NETHER_QUARTZ_ORE:
case NETHER_WART_BLOCK:
case NOTE_BLOCK:
case OAK_DOOR:
case OAK_FENCE:
case OAK_FENCE_GATE:
case OAK_LEAVES:
case OAK_LOG:
case OAK_PLANKS:
case OAK_PRESSURE_PLATE:
case OAK_SIGN:
case OAK_SLAB:
case OAK_STAIRS:
case OAK_TRAPDOOR:
case OAK_WALL_SIGN:
case OAK_WOOD:
case OBSERVER:
case OBSIDIAN:
case ORANGE_BANNER:
case ORANGE_BED:
case ORANGE_CONCRETE:
case ORANGE_CONCRETE_POWDER:
case ORANGE_GLAZED_TERRACOTTA:
case ORANGE_SHULKER_BOX:
case ORANGE_STAINED_GLASS:
case ORANGE_STAINED_GLASS_PANE:
case ORANGE_TERRACOTTA:
case ORANGE_WALL_BANNER:
case ORANGE_WOOL:
case PACKED_ICE:
case PETRIFIED_OAK_SLAB:
case PINK_BANNER:
case PINK_BED:
case PINK_CONCRETE:
case PINK_CONCRETE_POWDER:
case PINK_GLAZED_TERRACOTTA:
case PINK_SHULKER_BOX:
case PINK_STAINED_GLASS:
case PINK_STAINED_GLASS_PANE:
case PINK_TERRACOTTA:
case PINK_WALL_BANNER:
case PINK_WOOL:
case PISTON:
case PISTON_HEAD:
case PODZOL:
case POLISHED_ANDESITE:
case POLISHED_ANDESITE_SLAB:
case POLISHED_ANDESITE_STAIRS:
case POLISHED_DIORITE:
case POLISHED_DIORITE_SLAB:
case POLISHED_DIORITE_STAIRS:
case POLISHED_GRANITE:
case POLISHED_GRANITE_SLAB:
case POLISHED_GRANITE_STAIRS:
case PRISMARINE:
case PRISMARINE_BRICKS:
case PRISMARINE_BRICK_SLAB:
case PRISMARINE_BRICK_STAIRS:
case PRISMARINE_SLAB:
case PRISMARINE_STAIRS:
case PRISMARINE_WALL:
case PUMPKIN:
case PURPLE_BANNER:
case PURPLE_BED:
case PURPLE_CONCRETE:
case PURPLE_CONCRETE_POWDER:
case PURPLE_GLAZED_TERRACOTTA:
case PURPLE_SHULKER_BOX:
case PURPLE_STAINED_GLASS:
case PURPLE_STAINED_GLASS_PANE:
case PURPLE_TERRACOTTA:
case PURPLE_WALL_BANNER:
case PURPLE_WOOL:
case PURPUR_BLOCK:
case PURPUR_PILLAR:
case PURPUR_SLAB:
case PURPUR_STAIRS:
case QUARTZ_BLOCK:
case QUARTZ_PILLAR:
case QUARTZ_SLAB:
case QUARTZ_STAIRS:
case REDSTONE_BLOCK:
case REDSTONE_LAMP:
case REDSTONE_ORE:
case RED_BANNER:
case RED_BED:
case RED_CONCRETE:
case RED_CONCRETE_POWDER:
case RED_GLAZED_TERRACOTTA:
case RED_MUSHROOM_BLOCK:
case RED_NETHER_BRICKS:
case RED_NETHER_BRICK_SLAB:
case RED_NETHER_BRICK_STAIRS:
case RED_NETHER_BRICK_WALL:
case RED_SAND:
case RED_SANDSTONE:
case RED_SANDSTONE_SLAB:
case RED_SANDSTONE_STAIRS:
case RED_SANDSTONE_WALL:
case RED_SHULKER_BOX:
case RED_STAINED_GLASS:
case RED_STAINED_GLASS_PANE:
case RED_TERRACOTTA:
case RED_WALL_BANNER:
case RED_WOOL:
case REPEATING_COMMAND_BLOCK:
case SAND:
case SANDSTONE:
case SANDSTONE_SLAB:
case SANDSTONE_STAIRS:
case SANDSTONE_WALL:
case SEA_LANTERN:
case SHULKER_BOX:
case SLIME_BLOCK:
case SMITHING_TABLE:
case SMOKER:
case SMOOTH_QUARTZ:
case SMOOTH_QUARTZ_SLAB:
case SMOOTH_QUARTZ_STAIRS:
case SMOOTH_RED_SANDSTONE:
case SMOOTH_RED_SANDSTONE_SLAB:
case SMOOTH_RED_SANDSTONE_STAIRS:
case SMOOTH_SANDSTONE:
case SMOOTH_SANDSTONE_SLAB:
case SMOOTH_SANDSTONE_STAIRS:
case SMOOTH_STONE:
case SMOOTH_STONE_SLAB:
case SNOW_BLOCK:
case SOUL_SAND:
case SPAWNER:
case SPONGE:
case SPRUCE_DOOR:
case SPRUCE_FENCE:
case SPRUCE_FENCE_GATE:
case SPRUCE_LEAVES:
case SPRUCE_LOG:
case SPRUCE_PLANKS:
case SPRUCE_PRESSURE_PLATE:
case SPRUCE_SIGN:
case SPRUCE_SLAB:
case SPRUCE_STAIRS:
case SPRUCE_TRAPDOOR:
case SPRUCE_WALL_SIGN:
case SPRUCE_WOOD:
case STICKY_PISTON:
case STONE:
case STONECUTTER:
case STONE_BRICKS:
case STONE_BRICK_SLAB:
case STONE_BRICK_STAIRS:
case STONE_BRICK_WALL:
case STONE_PRESSURE_PLATE:
case STONE_SLAB:
case STONE_STAIRS:
case STRIPPED_ACACIA_LOG:
case STRIPPED_ACACIA_WOOD:
case STRIPPED_BIRCH_LOG:
case STRIPPED_BIRCH_WOOD:
case STRIPPED_DARK_OAK_LOG:
case STRIPPED_DARK_OAK_WOOD:
case STRIPPED_JUNGLE_LOG:
case STRIPPED_JUNGLE_WOOD:
case STRIPPED_OAK_LOG:
case STRIPPED_OAK_WOOD:
case STRIPPED_SPRUCE_LOG:
case STRIPPED_SPRUCE_WOOD:
case STRUCTURE_BLOCK:
case TERRACOTTA:
case TNT:
case TRAPPED_CHEST:
case TUBE_CORAL_BLOCK:
case TURTLE_EGG:
case WET_SPONGE:
case WHITE_BANNER:
case WHITE_BED:
case WHITE_CONCRETE:
case WHITE_CONCRETE_POWDER:
case WHITE_GLAZED_TERRACOTTA:
case WHITE_SHULKER_BOX:
case WHITE_STAINED_GLASS:
case WHITE_STAINED_GLASS_PANE:
case WHITE_TERRACOTTA:
case WHITE_WALL_BANNER:
case WHITE_WOOL:
case YELLOW_BANNER:
case YELLOW_BED:
case YELLOW_CONCRETE:
case YELLOW_CONCRETE_POWDER:
case YELLOW_GLAZED_TERRACOTTA:
case YELLOW_SHULKER_BOX:
case YELLOW_STAINED_GLASS:
case YELLOW_STAINED_GLASS_PANE:
case YELLOW_TERRACOTTA:
case YELLOW_WALL_BANNER:
case YELLOW_WOOL:
return true;
default:
return false;
}
}
public List<BlockAlternative> getBlockAlternatives() { public List<BlockAlternative> getBlockAlternatives() {
return Collections.unmodifiableList(blockAlternatives); return Collections.unmodifiableList(blockAlternatives);
} }