Skip to content

Commit

Permalink
Remove deprecated legacy sound events
Browse files Browse the repository at this point in the history
  • Loading branch information
wode490390 committed Jul 31, 2023
1 parent 91ba3a7 commit e0a1fac
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 154 deletions.
4 changes: 4 additions & 0 deletions src/main/java/cn/nukkit/block/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,10 @@ public boolean isCaveVines() {
return false;
}

public boolean isGlass() {
return false;
}

public boolean isWaxed() {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockFire.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private boolean canNeighborBurn() {

protected boolean isValidBase(Block below) {
int id = below.getId();
return id != ICE && id != FROSTED_ICE && id != SNOW_LAYER && (id == MOB_SPAWNER
return id != ICE && id != FROSTED_ICE && id != SNOW_LAYER && !below.isGlass() && (id == MOB_SPAWNER
|| below.getBurnChance() > 0 || SupportType.hasFullSupport(below, BlockFace.UP));
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/cn/nukkit/block/BlockGlass.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public boolean canSilkTouch() {
public BlockColor getColor() {
return BlockColor.AIR_BLOCK_COLOR;
}

@Override
public boolean isGlass() {
return true;
}
}
5 changes: 5 additions & 0 deletions src/main/java/cn/nukkit/block/BlockGlassTinted.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ public double getResistance() {
public BlockColor getColor() {
return BlockColor.GRAY_BLOCK_COLOR;
}

@Override
public boolean isGlass() {
return true;
}
}
294 changes: 141 additions & 153 deletions src/main/java/cn/nukkit/network/protocol/LevelSoundEventPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,136 +45,145 @@ public class LevelSoundEventPacket extends DataPacket {
public static final int SOUND_LAND = 35;
public static final int SOUND_SADDLE = 36;
public static final int SOUND_ARMOR = 37;
public static final int SOUND_ADD_CHEST = 38;
public static final int SOUND_THROW = 39;
public static final int SOUND_ATTACK = 40;
public static final int SOUND_ATTACK_NODAMAGE = 41;
public static final int SOUND_ATTACK_STRONG = 42;
public static final int SOUND_WARN = 43;
public static final int SOUND_SHEAR = 44;
public static final int SOUND_MILK = 45;
public static final int SOUND_THUNDER = 46;
public static final int SOUND_EXPLODE = 47;
public static final int SOUND_FIRE = 48;
public static final int SOUND_IGNITE = 49;
public static final int SOUND_FUSE = 50;
public static final int SOUND_STARE = 51;
public static final int SOUND_SPAWN = 52;
public static final int SOUND_SHOOT = 53;
public static final int SOUND_BREAK_BLOCK = 54;
public static final int SOUND_LAUNCH = 55;
public static final int SOUND_BLAST = 56;
public static final int SOUND_LARGE_BLAST = 57;
public static final int SOUND_TWINKLE = 58;
public static final int SOUND_REMEDY = 59;
public static final int SOUND_UNFECT = 60;
public static final int SOUND_LEVELUP = 61;
public static final int SOUND_BOW_HIT = 62;
public static final int SOUND_BULLET_HIT = 63;
public static final int SOUND_EXTINGUISH_FIRE = 64;
public static final int SOUND_ITEM_FIZZ = 65;
public static final int SOUND_CHEST_OPEN = 66;
public static final int SOUND_CHEST_CLOSED = 67;
public static final int SOUND_SHULKERBOX_OPEN = 68;
public static final int SOUND_SHULKERBOX_CLOSED = 69;
public static final int SOUND_POWER_ON = 70;
public static final int SOUND_POWER_OFF = 71;
public static final int SOUND_ATTACH = 72;
public static final int SOUND_DETACH = 73;
public static final int SOUND_DENY = 74;
public static final int SOUND_TRIPOD = 75;
public static final int SOUND_POP = 76;
public static final int SOUND_DROP_SLOT = 77;
public static final int SOUND_NOTE = 78;
public static final int SOUND_THORNS = 79;
public static final int SOUND_PISTON_IN = 80;
public static final int SOUND_PISTON_OUT = 81;
public static final int SOUND_PORTAL = 82;
public static final int SOUND_WATER = 83;
public static final int SOUND_LAVA_POP = 84;
public static final int SOUND_LAVA = 85;
public static final int SOUND_BURP = 86;
public static final int SOUND_BUCKET_FILL_WATER = 87;
public static final int SOUND_BUCKET_FILL_LAVA = 88;
public static final int SOUND_BUCKET_EMPTY_WATER = 89;
public static final int SOUND_BUCKET_EMPTY_LAVA = 90;
public static final int SOUND_RECORD_13 = 91;
public static final int SOUND_RECORD_CAT = 92;
public static final int SOUND_RECORD_BLOCKS = 93;
public static final int SOUND_RECORD_CHIRP = 94;
public static final int SOUND_RECORD_FAR = 95;
public static final int SOUND_RECORD_MALL = 96;
public static final int SOUND_RECORD_MELLOHI = 97;
public static final int SOUND_RECORD_STAL = 98;
public static final int SOUND_RECORD_STRAD = 99;
public static final int SOUND_RECORD_WARD = 100;
public static final int SOUND_RECORD_11 = 101;
public static final int SOUND_RECORD_WAIT = 102;
public static final int SOUND_STOP_RECORD = 103;
public static final int SOUND_GUARDIAN_FLOP = 104;
public static final int SOUND_ELDERGUARDIAN_CURSE = 105;
public static final int SOUND_MOB_WARNING = 106;
public static final int SOUND_MOB_WARNING_BABY = 107;
public static final int SOUND_TELEPORT = 108;
public static final int SOUND_SHULKER_OPEN = 109;
public static final int SOUND_SHULKER_CLOSE = 110;
public static final int SOUND_HAGGLE = 111;
public static final int SOUND_HAGGLE_YES = 112;
public static final int SOUND_HAGGLE_NO = 113;
public static final int SOUND_HAGGLE_IDLE = 114;
public static final int SOUND_CHORUSGROW = 115;
public static final int SOUND_CHORUSDEATH = 116;
public static final int SOUND_GLASS = 117;
public static final int SOUND_CAST_SPELL = 118;
public static final int SOUND_PREPARE_ATTACK = 119;
public static final int SOUND_PREPARE_SUMMON = 120;
public static final int SOUND_PREPARE_WOLOLO = 121;
public static final int SOUND_FANG = 122;
public static final int SOUND_CHARGE = 123;
public static final int SOUND_CAMERA_TAKE_PICTURE = 124;
public static final int SOUND_LEASHKNOT_PLACE = 125;
public static final int SOUND_LEASHKNOT_BREAK = 126;
public static final int SOUND_GROWL = 127;
public static final int SOUND_WHINE = 128;
public static final int SOUND_PANT = 129;
public static final int SOUND_PURR = 130;
public static final int SOUND_PURREOW = 131;
public static final int SOUND_DEATH_MIN_VOLUME = 132;
public static final int SOUND_DEATH_MID_VOLUME = 133;
public static final int SOUND_IMITATE_BLAZE = 134;
public static final int SOUND_IMITATE_CAVE_SPIDER = 135;
public static final int SOUND_IMITATE_CREEPER = 136;
public static final int SOUND_IMITATE_ELDER_GUARDIAN = 137;
public static final int SOUND_IMITATE_ENDER_DRAGON = 138;
public static final int SOUND_IMITATE_ENDERMAN = 139;
public static final int SOUND_IMITATE_EVOCATION_ILLAGER = 141;
public static final int SOUND_IMITATE_GHAST = 142;
public static final int SOUND_IMITATE_HUSK = 143;
public static final int SOUND_IMITATE_ILLUSION_ILLAGER = 144;
public static final int SOUND_IMITATE_MAGMA_CUBE = 145;
public static final int SOUND_IMITATE_POLAR_BEAR = 146;
public static final int SOUND_IMITATE_SHULKER = 147;
public static final int SOUND_IMITATE_SILVERFISH = 148;
public static final int SOUND_IMITATE_SKELETON = 149;
public static final int SOUND_IMITATE_SLIME = 150;
public static final int SOUND_IMITATE_SPIDER = 151;
public static final int SOUND_IMITATE_STRAY = 152;
public static final int SOUND_IMITATE_VEX = 153;
public static final int SOUND_IMITATE_VINDICATION_ILLAGER = 154;
public static final int SOUND_IMITATE_WITCH = 155;
public static final int SOUND_IMITATE_WITHER = 156;
public static final int SOUND_IMITATE_WITHER_SKELETON = 157;
public static final int SOUND_IMITATE_WOLF = 158;
public static final int SOUND_IMITATE_ZOMBIE = 159;
public static final int SOUND_IMITATE_ZOMBIE_PIGMAN = 160;
public static final int SOUND_IMITATE_ZOMBIE_VILLAGER = 161;
public static final int SOUND_BLOCK_END_PORTAL_FRAME_FILL = 162;
public static final int SOUND_BLOCK_END_PORTAL_SPAWN = 163;
public static final int SOUND_RANDOM_ANVIL_USE = 164;
public static final int SOUND_BOTTLE_DRAGONBREATH = 165;
public static final int SOUND_DEFAULT = 166;

//已经不是旧版的了,后面直接拿新版的id
public static final int SOUND_MOB_ARMOR_STAND_PLACE = 38;
public static final int SOUND_ADD_CHEST = 39;
public static final int SOUND_THROW = 40;
public static final int SOUND_ATTACK = 41;
public static final int SOUND_ATTACK_NODAMAGE = 42;
public static final int SOUND_ATTACK_STRONG = 43;
public static final int SOUND_WARN = 44;
public static final int SOUND_SHEAR = 45;
public static final int SOUND_MILK = 46;
public static final int SOUND_THUNDER = 47;
public static final int SOUND_EXPLODE = 48;
public static final int SOUND_FIRE = 49;
public static final int SOUND_IGNITE = 50;
public static final int SOUND_FUSE = 51;
public static final int SOUND_STARE = 52;
public static final int SOUND_SPAWN = 53;
public static final int SOUND_SHOOT = 54;
public static final int SOUND_BREAK_BLOCK = 55;
public static final int SOUND_LAUNCH = 56;
public static final int SOUND_BLAST = 57;
public static final int SOUND_LARGE_BLAST = 58;
public static final int SOUND_TWINKLE = 59;
public static final int SOUND_REMEDY = 60;
public static final int SOUND_UNFECT = 61;
public static final int SOUND_LEVELUP = 62;
public static final int SOUND_BOW_HIT = 63;
public static final int SOUND_BULLET_HIT = 64;
public static final int SOUND_EXTINGUISH_FIRE = 65;
public static final int SOUND_ITEM_FIZZ = 66;
public static final int SOUND_CHEST_OPEN = 67;
public static final int SOUND_CHEST_CLOSED = 68;
public static final int SOUND_SHULKERBOX_OPEN = 69;
public static final int SOUND_SHULKERBOX_CLOSED = 70;
public static final int SOUND_ENDERCHEST_OPEN = 71;
public static final int SOUND_ENDERCHEST_CLOSED = 72;
public static final int SOUND_POWER_ON = 73;
public static final int SOUND_POWER_OFF = 74;
public static final int SOUND_ATTACH = 75;
public static final int SOUND_DETACH = 76;
public static final int SOUND_DENY = 77;
public static final int SOUND_TRIPOD = 78;
public static final int SOUND_POP = 79;
public static final int SOUND_DROP_SLOT = 80;
public static final int SOUND_NOTE = 81;
public static final int SOUND_THORNS = 82;
public static final int SOUND_PISTON_IN = 83;
public static final int SOUND_PISTON_OUT = 84;
public static final int SOUND_PORTAL = 85;
public static final int SOUND_WATER = 86;
public static final int SOUND_LAVA_POP = 87;
public static final int SOUND_LAVA = 88;
public static final int SOUND_BURP = 89;
public static final int SOUND_BUCKET_FILL_WATER = 90;
public static final int SOUND_BUCKET_FILL_LAVA = 91;
public static final int SOUND_BUCKET_EMPTY_WATER = 92;
public static final int SOUND_BUCKET_EMPTY_LAVA = 93;
public static final int SOUND_ARMOR_EQUIP_CHAIN = 94;
public static final int SOUND_ARMOR_EQUIP_DIAMOND = 95;
public static final int SOUND_ARMOR_EQUIP_GENERIC = 96;
public static final int SOUND_ARMOR_EQUIP_GOLD = 97;
public static final int SOUND_ARMOR_EQUIP_IRON = 98;
public static final int SOUND_ARMOR_EQUIP_LEATHER = 99;
public static final int SOUND_ARMOR_EQUIP_ELYTRA = 100;
public static final int SOUND_RECORD_13 = 101;
public static final int SOUND_RECORD_CAT = 102;
public static final int SOUND_RECORD_BLOCKS = 103;
public static final int SOUND_RECORD_CHIRP = 104;
public static final int SOUND_RECORD_FAR = 105;
public static final int SOUND_RECORD_MALL = 106;
public static final int SOUND_RECORD_MELLOHI = 107;
public static final int SOUND_RECORD_STAL = 108;
public static final int SOUND_RECORD_STRAD = 109;
public static final int SOUND_RECORD_WARD = 110;
public static final int SOUND_RECORD_11 = 111;
public static final int SOUND_RECORD_WAIT = 112;
public static final int SOUND_STOP_RECORD = 113; //Not really a sound
public static final int SOUND_GUARDIAN_FLOP = 114;
public static final int SOUND_ELDERGUARDIAN_CURSE = 115;
public static final int SOUND_MOB_WARNING = 116;
public static final int SOUND_MOB_WARNING_BABY = 117;
public static final int SOUND_TELEPORT = 118;
public static final int SOUND_SHULKER_OPEN = 119;
public static final int SOUND_SHULKER_CLOSE = 120;
public static final int SOUND_HAGGLE = 121;
public static final int SOUND_HAGGLE_YES = 122;
public static final int SOUND_HAGGLE_NO = 123;
public static final int SOUND_HAGGLE_IDLE = 124;
public static final int SOUND_CHORUSGROW = 125;
public static final int SOUND_CHORUSDEATH = 126;
public static final int SOUND_GLASS = 127;
public static final int SOUND_POTION_BREWED = 128;
public static final int SOUND_CAST_SPELL = 129;
public static final int SOUND_PREPARE_ATTACK = 130;
public static final int SOUND_PREPARE_SUMMON = 131;
public static final int SOUND_PREPARE_WOLOLO = 132;
public static final int SOUND_FANG = 133;
public static final int SOUND_CHARGE = 134;
public static final int SOUND_CAMERA_TAKE_PICTURE = 135;
public static final int SOUND_LEASHKNOT_PLACE = 136;
public static final int SOUND_LEASHKNOT_BREAK = 137;
public static final int SOUND_GROWL = 138;
public static final int SOUND_WHINE = 139;
public static final int SOUND_PANT = 140;
public static final int SOUND_PURR = 141;
public static final int SOUND_PURREOW = 142;
public static final int SOUND_DEATH_MIN_VOLUME = 143;
public static final int SOUND_DEATH_MID_VOLUME = 144;
public static final int SOUND_IMITATE_BLAZE = 145;
public static final int SOUND_IMITATE_CAVE_SPIDER = 146;
public static final int SOUND_IMITATE_CREEPER = 147;
public static final int SOUND_IMITATE_ELDER_GUARDIAN = 148;
public static final int SOUND_IMITATE_ENDER_DRAGON = 149;
public static final int SOUND_IMITATE_ENDERMAN = 150;
public static final int SOUND_IMITATE_ENDERMITE = 151;
public static final int SOUND_IMITATE_EVOCATION_ILLAGER = 152;
public static final int SOUND_IMITATE_GHAST = 153;
public static final int SOUND_IMITATE_HUSK = 154;
public static final int SOUND_IMITATE_ILLUSION_ILLAGER = 155;
public static final int SOUND_IMITATE_MAGMA_CUBE = 156;
public static final int SOUND_IMITATE_POLAR_BEAR = 157;
public static final int SOUND_IMITATE_SHULKER = 158;
public static final int SOUND_IMITATE_SILVERFISH = 159;
public static final int SOUND_IMITATE_SKELETON = 160;
public static final int SOUND_IMITATE_SLIME = 161;
public static final int SOUND_IMITATE_SPIDER = 162;
public static final int SOUND_IMITATE_STRAY = 163;
public static final int SOUND_IMITATE_VEX = 164;
public static final int SOUND_IMITATE_VINDICATION_ILLAGER = 165;
public static final int SOUND_IMITATE_WITCH = 166;
public static final int SOUND_IMITATE_WITHER = 167;
public static final int SOUND_IMITATE_WITHER_SKELETON = 168;
public static final int SOUND_IMITATE_WOLF = 169;
public static final int SOUND_IMITATE_ZOMBIE = 170;
public static final int SOUND_IMITATE_ZOMBIE_PIGMAN = 171;
public static final int SOUND_IMITATE_ZOMBIE_VILLAGER = 172;
public static final int SOUND_BLOCK_END_PORTAL_FRAME_FILL = 173;
public static final int SOUND_BLOCK_END_PORTAL_SPAWN = 174;
public static final int SOUND_RANDOM_ANVIL_USE = 175;
public static final int SOUND_BOTTLE_DRAGONBREATH = 176;
public static final int SOUND_PORTAL_TRAVEL = 177;
public static final int SOUND_ITEM_TRIDENT_HIT = 178;
public static final int SOUND_ITEM_TRIDENT_RETURN = 179;
Expand All @@ -184,7 +193,7 @@ public class LevelSoundEventPacket extends DataPacket {
public static final int SOUND_ITEM_TRIDENT_THROW = 183;
public static final int SOUND_ITEM_TRIDENT_THUNDER = 184;
public static final int SOUND_ITEM_TRIDENT_HIT_GROUND = 185;
// public static final int SOUND_DEFAULT = 186;
public static final int SOUND_DEFAULT = 186;
public static final int SOUND_BLOCK_FLETCHING_TABLE_USE = 187;
public static final int SOUND_ELEMCONSTRUCT_OPEN = 188;
public static final int SOUND_ICEBOMB_HIT = 189;
Expand Down Expand Up @@ -467,38 +476,17 @@ public class LevelSoundEventPacket extends DataPacket {
public static final int SOUND_WAXED_SIGN_INTERACT_FAIL = 468;
public static final int SOUND_RECORD_RELIC = 469;

// 插入的 ID 由跨版本转换处理: 1000 + ID
public static final int SOUND_MOB_ARMOR_STAND_PLACE = 1000 + 38;

public static final int SOUND_ENDERCHEST_OPEN = 1000 + 71;
public static final int SOUND_ENDERCHEST_CLOSED = 1000 + 72;

public static final int SOUND_ARMOR_EQUIP_CHAIN = 1000 + 94;
public static final int SOUND_ARMOR_EQUIP_DIAMOND = 1000 + 95;
public static final int SOUND_ARMOR_EQUIP_GENERIC = 1000 + 96;
public static final int SOUND_ARMOR_EQUIP_GOLD = 1000 + 97;
public static final int SOUND_ARMOR_EQUIP_IRON = 1000 + 98;
public static final int SOUND_ARMOR_EQUIP_LEATHER = 1000 + 99;
public static final int SOUND_ARMOR_EQUIP_ELYTRA = 1000 + 100;

public static final int SOUND_POTION_BREWED = 1000 + 128;

public static final int SOUND_IMITATE_ENDERMITE = 1000 + 151;

public int sound;
public float x;
public float y;
public float z;
public int extraData = -1;
@Deprecated
public int pitch = 1;
public String entityIdentifier = ":";
public boolean isBabyMob;
public boolean isGlobal;

public LevelSoundEventPacket() {

}

@Override
public void decode() {
this.sound = this.getByte();
Expand Down

0 comments on commit e0a1fac

Please sign in to comment.