Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Mojang mapped level event names #825

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,94 +4,91 @@

@AllArgsConstructor
public enum LevelEventType implements LevelEvent {
BLOCK_DISPENSER_DISPENSE(1000),
BLOCK_DISPENSER_FAIL(1001),
BLOCK_DISPENSER_LAUNCH(1002),
ENTITY_ENDEREYE_LAUNCH(1003),
ENTITY_FIREWORK_SHOOT(1004),
BLOCK_FIRE_EXTINGUISH(1009),
RECORD(1010),
STOP_RECORD(1011), // As of 1.19.4
ENTITY_GHAST_WARN(1015),
ENTITY_GHAST_SHOOT(1016),
ENTITY_ENDERDRAGON_SHOOT(1017),
ENTITY_BLAZE_SHOOT(1018),
ENTITY_ZOMBIE_ATTACK_DOOR_WOOD(1019),
ENTITY_ZOMBIE_ATTACK_DOOR_IRON(1020),
ENTITY_ZOMBIE_BREAK_DOOR_WOOD(1021),
ENTITY_WITHER_BREAK_BLOCK(1022),
ENTITY_WITHER_SPAWN(1023), // Global level event
ENTITY_WITHER_SHOOT(1024),
ENTITY_BAT_TAKEOFF(1025),
ENTITY_ZOMBIE_INFECT(1026),
ENTITY_ZOMBIE_VILLAGER_CONVERTED(1027),
ENTITY_ENDERDRAGON_DEATH(1028), // Global level event
BLOCK_ANVIL_DESTROY(1029),
BLOCK_ANVIL_USE(1030),
BLOCK_ANVIL_LAND(1031),
BLOCK_PORTAL_TRAVEL(1032),
BLOCK_CHORUS_FLOWER_GROW(1033),
BLOCK_CHORUS_FLOWER_DEATH(1034),
BLOCK_BREWING_STAND_BREW(1035),
BLOCK_END_PORTAL_SPAWN(1038), // Global level event
ENTITY_PHANTOM_BITE(1039),
ENTITY_ZOMBIE_CONVERTED_TO_DROWNED(1040),
ENTITY_HUSK_CONVERTED_TO_ZOMBIE(1041),
BLOCK_GRINDSTONE_USE(1042),
ITEM_BOOK_PAGE_TURN(1043),
BLOCK_SMITHING_TABLE_USE(1044),
POINTED_DRIPSTONE_LAND(1045),
DRIP_LAVA_INTO_CAULDRON(1046),
DRIP_WATER_INTO_CAULDRON(1047),
ENTITY_SKELETON_CONVERTED_TO_STRAY(1048),
BLOCK_CRAFTER_CRAFT(1049),
BLOCK_CRAFTER_FAIL(1050),
SOUND_DISPENSER_DISPENSE(1000),
SOUND_DISPENSER_FAIL(1001),
SOUND_DISPENSER_PROJECTILE_LAUNCH(1002),
SOUND_FIREWORK_SHOOT(1004),
SOUND_EXTINGUISH_FIRE(1009),
SOUND_PLAY_JUKEBOX_SONG(1010),
SOUND_STOP_JUKEBOX_SONG(1011),
SOUND_GHAST_WARNING(1015),
SOUND_GHAST_FIREBALL(1016),
SOUND_DRAGON_FIREBALL(1017),
SOUND_BLAZE_FIREBALL(1018),
SOUND_ZOMBIE_WOODEN_DOOR(1019),
SOUND_ZOMBIE_IRON_DOOR(1020),
SOUND_ZOMBIE_DOOR_CRASH(1021),
SOUND_WITHER_BLOCK_BREAK(1022),
SOUND_WITHER_BOSS_SPAWN(1023), // Global level event
SOUND_WITHER_BOSS_SHOOT(1024),
SOUND_BAT_LIFTOFF(1025),
SOUND_ZOMBIE_INFECTED(1026),
SOUND_ZOMBIE_CONVERTED(1027),
SOUND_DRAGON_DEATH(1028), // Global level event
SOUND_ANVIL_BROKEN(1029),
SOUND_ANVIL_USED(1030),
SOUND_ANVIL_LAND(1031),
SOUND_PORTAL_TRAVEL(1032),
SOUND_CHORUS_GROW(1033),
SOUND_CHORUS_DEATH(1034),
SOUND_BREWING_STAND_BREW(1035),
SOUND_END_PORTAL_SPAWN(1038), // Global level event
SOUND_PHANTOM_BITE(1039),
SOUND_ZOMBIE_TO_DROWNED(1040),
SOUND_HUSK_TO_ZOMBIE(1041),
SOUND_GRINDSTONE_USED(1042),
SOUND_PAGE_TURN(1043),
SOUND_SMITHING_TABLE_USED(1044),
SOUND_POINTED_DRIPSTONE_LAND(1045),
SOUND_DRIP_LAVA_INTO_CAULDRON(1046),
SOUND_DRIP_WATER_INTO_CAULDRON(1047),
SOUND_SKELETON_TO_STRAY(1048),
SOUND_CRAFTER_CRAFT(1049),
SOUND_CRAFTER_FAIL(1050),
SOUND_WIND_CHARGE_SHOOT(1051),

COMPOSTER(1500),
BLOCK_LAVA_EXTINGUISH(1501),
BLOCK_REDSTONE_TORCH_BURNOUT(1502),
BLOCK_END_PORTAL_FRAME_FILL(1503),
COMPOSTER_FILL(1500),
LAVA_FIZZ(1501),
REDSTONE_TORCH_BURNOUT(1502),
END_PORTAL_FRAME_FILL(1503),
DRIPSTONE_DRIP(1504),
BONEMEAL_GROW_WITH_SOUND(1505),
PARTICLES_AND_SOUND_PLANT_GROWTH(1505),

SMOKE(2000),
BREAK_BLOCK(2001),
BREAK_SPLASH_POTION(2002),
BREAK_EYE_OF_ENDER(2003),
MOB_SPAWN(2004),
BONEMEAL_GROW(2005),
ENDERDRAGON_FIREBALL_EXPLODE(2006),
BREAK_SPLASH_POTION2(2007), // Mojank
EXPLOSION(2008),
EVAPORATE(2009),
WHITE_SMOKE(2010),
BEE_GROWTH(2011),
TURTLE_EGG_PLACEMENT(2012),
SMASH_ATTACK(2013),
PARTICLES_SHOOT_SMOKE(2000),
PARTICLES_DESTROY_BLOCK(2001),
PARTICLES_SPELL_POTION_SPLASH(2002),
PARTICLES_EYE_OF_ENDER_DEATH(2003),
PARTICLES_MOBBLOCK_SPAWN(2004),
PARTICLES_DRAGON_FIREBALL_SPLASH(2006),
PARTICLES_INSTANT_POTION_SPLASH(2007),
PARTICLES_DRAGON_BLOCK_BREAK(2008),
PARTICLES_WATER_EVAPORATING(2009),
PARTICLES_SHOOT_WHITE_SMOKE(2010),
PARTICLES_BEE_GROWTH(2011),
PARTICLES_TURTLE_EGG_PLACEMENT(2012),
PARTICLES_SMASH_ATTACK(2013),

END_GATEWAY_SPAWN(3000),
ENTITY_ENDERDRAGON_GROWL(3001),
ELECTRIC_SPARK(3002),
WAX_ON(3003),
WAX_OFF(3004),
SCRAPE(3005),
SCULK_BLOCK_CHARGE(3006),
SCULK_SHRIEKER_SHRIEK(3007),
BRUSH_BLOCK_COMPLETE(3008),
EGG_CRACK(3009),
GUST_DUST(3010),
TRIAL_SPAWNER_SPAWN(3011),
TRIAL_SPAWNER_MOB_AT(3012),
TRIAL_SPAWNER_DETECT_PLAYER(3013),
TRIAL_SPAWNER_EJECT_ITEM(3014),
VAULT_ACTIVATE(3015),
VAULT_DEACTIVATE(3016),
VAULT_EJECT_ITEM(3017),
SPAWN_COBWEB(3018),
TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS(3019),
TRIAL_SPAWNER_BECOME_OMINOUS(3020),
TRIAL_SPAWNER_SPAWN_ITEM(3021);
ANIMATION_END_GATEWAY_SPAWN(3000),
ANIMATION_DRAGON_SUMMON_ROAR(3001),
PARTICLES_ELECTRIC_SPARK(3002),
PARTICLES_AND_SOUND_WAX_ON(3003),
PARTICLES_WAX_OFF(3004),
PARTICLES_SCRAPE(3005),
PARTICLES_SCULK_CHARGE(3006),
PARTICLES_SCULK_SHRIEK(3007),
PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE(3008),
PARTICLES_EGG_CRACK(3009),
PARTICLES_TRIAL_SPAWNER_SPAWN(3011),
PARTICLES_TRIAL_SPAWNER_SPAWN_MOB_AT(3012),
PARTICLES_TRIAL_SPAWNER_DETECT_PLAYER(3013),
ANIMATION_TRIAL_SPAWNER_EJECT_ITEM(3014),
ANIMATION_VAULT_ACTIVATE(3015),
ANIMATION_VAULT_DEACTIVATE(3016),
ANIMATION_VAULT_EJECT_ITEM(3017),
ANIMATION_SPAWN_COBWEB(3018),
PARTICLES_TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS(3019),
PARTICLES_TRIAL_SPAWNER_BECOME_OMINOUS(3020),
PARTICLES_TRIAL_SPAWNER_SPAWN_ITEM(3021);

private final int id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ public ClientboundLevelEventPacket(ByteBuf in, MinecraftCodecHelper helper) {
int value = in.readInt();
if (this.event instanceof LevelEventType levelEventType) {
switch (levelEventType) {
case BLOCK_FIRE_EXTINGUISH -> this.data = FireExtinguishData.from(value);
case RECORD -> this.data = new RecordEventData(value);
case SMOKE, WHITE_SMOKE -> this.data = new SmokeEventData(Direction.from(Math.abs(value % 6)));
case BREAK_BLOCK, BRUSH_BLOCK_COMPLETE -> this.data = new BreakBlockEventData(value);
case BREAK_SPLASH_POTION, BREAK_SPLASH_POTION2 -> this.data = new BreakPotionEventData(value);
case BONEMEAL_GROW, BONEMEAL_GROW_WITH_SOUND -> this.data = new BonemealGrowEventData(value);
case COMPOSTER -> this.data = value > 0 ? ComposterEventData.FILL_SUCCESS : ComposterEventData.FILL;
case ENDERDRAGON_FIREBALL_EXPLODE -> this.data = value == 1 ? DragonFireballEventData.HAS_SOUND : DragonFireballEventData.NO_SOUND;
case ELECTRIC_SPARK -> this.data = value >= 0 && value < 6 ? new ElectricSparkData(Direction.from(value)) : new UnknownLevelEventData(value);
case SCULK_BLOCK_CHARGE -> this.data = new SculkBlockChargeEventData(value);
case TRIAL_SPAWNER_DETECT_PLAYER -> this.data = new TrialSpawnerDetectEventData(value);
case SOUND_EXTINGUISH_FIRE -> this.data = FireExtinguishData.from(value);
case SOUND_PLAY_JUKEBOX_SONG -> this.data = new RecordEventData(value);
case PARTICLES_SHOOT_SMOKE, PARTICLES_SHOOT_WHITE_SMOKE -> this.data = new SmokeEventData(Direction.from(Math.abs(value % 6)));
case PARTICLES_DESTROY_BLOCK, PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE -> this.data = new BreakBlockEventData(value);
case PARTICLES_SPELL_POTION_SPLASH, PARTICLES_INSTANT_POTION_SPLASH -> this.data = new BreakPotionEventData(value);
case PARTICLES_AND_SOUND_PLANT_GROWTH -> this.data = new BonemealGrowEventData(value);
case COMPOSTER_FILL -> this.data = value > 0 ? ComposterEventData.FILL_SUCCESS : ComposterEventData.FILL;
case PARTICLES_DRAGON_FIREBALL_SPLASH -> this.data = value == 1 ? DragonFireballEventData.HAS_SOUND : DragonFireballEventData.NO_SOUND;
case PARTICLES_ELECTRIC_SPARK -> this.data = value >= 0 && value < 6 ? new ElectricSparkData(Direction.from(value)) : new UnknownLevelEventData(value);
case PARTICLES_SCULK_CHARGE -> this.data = new SculkBlockChargeEventData(value);
case PARTICLES_TRIAL_SPAWNER_DETECT_PLAYER -> this.data = new TrialSpawnerDetectEventData(value);
default -> this.data = new UnknownLevelEventData(value);
}
} else {
Expand Down
Loading