Skip to content

Commit

Permalink
Hide filtering presets on Bedrock
Browse files Browse the repository at this point in the history
  • Loading branch information
Heath123 committed Dec 24, 2020
1 parent cfe3c7a commit 61ab180
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 34 deletions.
48 changes: 25 additions & 23 deletions html/mainPage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,31 @@ <h3>Packet</h3>
<h3>Filtering</h3>
Tick the box to show packets

<button onclick="sharedVars.hiddenPackets = {
serverbound: [], clientbound: []
}
updateFilteringTab()" style="margin-left: 16px;">Show all
</button>

<!-- TODO: More dynamic and clean method of doing this -->
<button onclick="sharedVars.hiddenPackets = {
serverbound: allServerboundPackets, clientbound: allClientboundPackets
}
updateFilteringTab()" style="margin-left: 8px;">Hide all
</button>

<button onclick="sharedVars.hiddenPackets = Object.assign({}, defaultHiddenPackets)
updateFilteringTab()" style="margin-left: 8px;">Defaults
</button>

<button onclick="sharedVars.hiddenPackets = {
serverbound: ['query_block_nbt','set_difficulty','client_command','settings','tab_complete','transaction','enchant_item','window_click','close_window','custom_payload','edit_book','query_entity_nbt','use_entity','generate_structure','keep_alive','lock_difficulty','pick_item','craft_recipe_request','block_dig','entity_action','steer_vehicle','displayed_recipe','recipe_book','name_item','resource_pack_receive','advancement_tab','select_trade','set_beacon_effect','held_item_slot','update_command_block','update_command_block_minecart','set_creative_slot','update_jigsaw_block','update_structure_block','update_sign','arm_animation','spectate','block_place','use_item'],
clientbound: ['spawn_entity','spawn_entity_experience_orb','spawn_entity_living','spawn_entity_painting','named_entity_spawn','animation','statistics','acknowledge_player_digging','block_break_animation','tile_entity_data','block_action','block_change','boss_bar','difficulty','tab_complete','declare_commands','transaction','close_window','window_items','craft_progress_bar','set_slot','set_cooldown','custom_payload','named_sound_effect','kick_disconnect','entity_status','explosion','unload_chunk','game_state_change','open_horse_window','keep_alive','map_chunk','world_event','world_particles','update_light','login','map','trade_list','rel_entity_move','entity_move_look','entity_look','entity','open_book','open_window','open_sign_entity','craft_recipe_response','abilities','combat_event','unlock_recipes','entity_destroy','remove_entity_effect','resource_pack_send','entity_head_rotation','multi_block_change','select_advancement_tab','world_border','camera','held_item_slot','update_view_position','update_view_distance','scoreboard_display_objective','entity_metadata','attach_entity','entity_velocity','entity_equipment','experience','update_health','scoreboard_objective','set_passengers','teams','scoreboard_score','update_time','title','entity_sound_effect','sound_effect','stop_sound','playerlist_header','nbt_query_response','collect','entity_teleport','advancements','entity_update_attributes','declare_recipes','tags','entity_effect']
}
updateFilteringTab()" style="margin-left: 8px;">Preset: Player movement
</button>
<div id="presets">
<button onclick="sharedVars.hiddenPackets = {
serverbound: [], clientbound: []
}
updateFilteringTab()" style="margin-left: 16px;">Show all
</button>

<!-- TODO: More dynamic and clean method of doing this -->
<button onclick="sharedVars.hiddenPackets = {
serverbound: allServerboundPackets, clientbound: allClientboundPackets
}
updateFilteringTab()" style="margin-left: 8px;">Hide all
</button>

<button onclick="sharedVars.hiddenPackets = Object.assign({}, defaultHiddenPackets)
updateFilteringTab()" style="margin-left: 8px;">Defaults
</button>

<button onclick="sharedVars.hiddenPackets = {
serverbound: ['query_block_nbt','set_difficulty','client_command','settings','tab_complete','transaction','enchant_item','window_click','close_window','custom_payload','edit_book','query_entity_nbt','use_entity','generate_structure','keep_alive','lock_difficulty','pick_item','craft_recipe_request','block_dig','entity_action','steer_vehicle','displayed_recipe','recipe_book','name_item','resource_pack_receive','advancement_tab','select_trade','set_beacon_effect','held_item_slot','update_command_block','update_command_block_minecart','set_creative_slot','update_jigsaw_block','update_structure_block','update_sign','arm_animation','spectate','block_place','use_item'],
clientbound: ['spawn_entity','spawn_entity_experience_orb','spawn_entity_living','spawn_entity_painting','named_entity_spawn','animation','statistics','acknowledge_player_digging','block_break_animation','tile_entity_data','block_action','block_change','boss_bar','difficulty','tab_complete','declare_commands','transaction','close_window','window_items','craft_progress_bar','set_slot','set_cooldown','custom_payload','named_sound_effect','kick_disconnect','entity_status','explosion','unload_chunk','game_state_change','open_horse_window','keep_alive','map_chunk','world_event','world_particles','update_light','login','map','trade_list','rel_entity_move','entity_move_look','entity_look','entity','open_book','open_window','open_sign_entity','craft_recipe_response','abilities','combat_event','unlock_recipes','entity_destroy','remove_entity_effect','resource_pack_send','entity_head_rotation','multi_block_change','select_advancement_tab','world_border','camera','held_item_slot','update_view_position','update_view_distance','scoreboard_display_objective','entity_metadata','attach_entity','entity_velocity','entity_equipment','experience','update_health','scoreboard_objective','set_passengers','teams','scoreboard_score','update_time','title','entity_sound_effect','sound_effect','stop_sound','playerlist_header','nbt_query_response','collect','entity_teleport','advancements','entity_update_attributes','declare_recipes','tags','entity_effect']
}
updateFilteringTab()" style="margin-left: 8px;">Preset: Player movement
</button>
</div>

<br><br>
<div class="box" style="height: calc(100% - 118px);">
Expand Down
6 changes: 4 additions & 2 deletions html/mainPage/js/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
"hiddenPackets": {
"serverbound": ["move_player", "player_action", "level_sound_event"],
"clientbound": ["level_chunk", "update_block", "network_chunk_publisher_update", "set_entity_motion", "move_entity_absolute", "set_entity_data", "level_sound_event"]
}
},
"usePresets": false
},
"^java-node-minecraft-protocol-.*$": {
"hiddenPackets": {
"serverbound": ["position", "position_look", "look", "keep_alive", "entity_action"],
"clientbound": ["keep_alive", "update_time", "rel_entity_move", "entity_teleport", "map_chunk", "update_light", "update_view_position", "entity_metadata", "entity_update_attributes", "unload_chunk", "entity_velocity", "entity_move_look", "entity_head_rotation"]
}
},
"usePresets": true
}
}
4 changes: 4 additions & 0 deletions html/mainPage/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ function findDefault(setting) {
}
}

if (!findDefault('usePresets')) {
document.getElementById('presets').style.display = 'none'
}

sharedVars.hiddenPackets = getVersionSpecificVar('hiddenPackets', findDefault('hiddenPackets'))

if (!sharedVars.proxyCapabilities.scriptingSupport) {
Expand Down
13 changes: 4 additions & 9 deletions html/mainPage/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,6 @@ div#Scripting .CodeMirror.CodeMirror {
background: rgb(36, 36, 36);
}










/* Style the tab */
.tab {
overflow: hidden;
Expand Down Expand Up @@ -257,4 +248,8 @@ div.error {

.packet.selected {
background: rgba(64, 127, 255, 0.15);
}

#presets {
display: contents;
}

0 comments on commit 61ab180

Please sign in to comment.