Merge remote-tracking branch 'upstream-core/main'

# Conflicts:
#	core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java
#	core/src/main/java/com/seibel/distanthorizons/core/api/internal/SharedApi.java
#	core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/FullDataPointIdMap.java
#	core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/CompleteFullDataSource.java
#	core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/HighDetailIncompleteFullDataSource.java
#	core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/LowDetailIncompleteFullDataSource.java
#	core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/GeneratedFullDataFileHandler.java
#	core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/RemoteFullDataFileHandler.java
#	core/src/main/java/com/seibel/distanthorizons/core/level/ClientLevelModule.java
#	core/src/main/java/com/seibel/distanthorizons/core/level/DhClientLevel.java
#	core/src/main/java/com/seibel/distanthorizons/core/level/DhClientServerLevel.java
#	core/src/main/java/com/seibel/distanthorizons/core/level/DhServerLevel.java
#	core/src/main/java/com/seibel/distanthorizons/core/level/IDhServerLevel.java
#	core/src/main/java/com/seibel/distanthorizons/core/level/ServerLevelModule.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/NetworkEventSource.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/messages/AckMessage.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/messages/CloseReasonMessage.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/messages/HelloMessage.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/messages/PlayerUUIDMessage.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/messages/RemotePlayerConfigMessage.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/objects/RemotePlayer.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/protocol/EMessageHandlerSide.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/protocol/INetworkMessage.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/protocol/MessageRegistry.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/protocol/NetworkChannelInitializer.java
#	core/src/main/java/com/seibel/distanthorizons/core/network/protocol/NetworkExceptionHandler.java
#	core/src/main/java/com/seibel/distanthorizons/core/world/DhClientWorld.java
#	core/src/main/java/com/seibel/distanthorizons/core/world/DhServerWorld.java
#	core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/block/IBlockStateWrapper.java
#	core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/misc/IServerPlayerWrapper.java
#	core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/world/IBiomeWrapper.java
This commit is contained in:
Steveplays28
2023-08-16 11:36:00 +02:00
334 changed files with 11680 additions and 9579 deletions
+700
View File
@@ -0,0 +1,700 @@
# DH Core
# Note: please keep this and the main .editorconfig in sync
[*]
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 1000
tab_width = 4
trim_trailing_whitespace = false
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
[*.java]
indent_style = tab
ij_smart_tabs = true
ij_java_align_consecutive_assignments = false
ij_java_align_consecutive_variable_declarations = false
ij_java_align_group_field_declarations = false
ij_java_align_multiline_annotation_parameters = false
ij_java_align_multiline_array_initializer_expression = false
ij_java_align_multiline_assignment = false
ij_java_align_multiline_binary_operation = false
ij_java_align_multiline_chained_methods = false
ij_java_align_multiline_deconstruction_list_components = false
ij_java_align_multiline_extends_list = false
ij_java_align_multiline_for = false
ij_java_align_multiline_method_parentheses = false
ij_java_align_multiline_parameters = false
ij_java_align_multiline_parameters_in_calls = false
ij_java_align_multiline_parenthesized_expression = false
ij_java_align_multiline_records = false
ij_java_align_multiline_resources = false
ij_java_align_multiline_ternary_operation = false
ij_java_align_multiline_text_blocks = false
ij_java_align_multiline_throws_list = false
ij_java_align_subsequent_simple_methods = false
ij_java_align_throws_keyword = false
ij_java_align_types_in_multi_catch = false
ij_java_annotation_parameter_wrap = off
ij_java_array_initializer_new_line_after_left_brace = false
ij_java_array_initializer_right_brace_on_new_line = false
ij_java_array_initializer_wrap = normal
ij_java_assert_statement_colon_on_next_line = false
ij_java_assert_statement_wrap = off
ij_java_assignment_wrap = off
ij_java_binary_operation_sign_on_next_line = false
ij_java_binary_operation_wrap = off
ij_java_blank_lines_after_anonymous_class_header = 0
ij_java_blank_lines_after_class_header = 0
ij_java_blank_lines_after_imports = 1
ij_java_blank_lines_after_package = 1
ij_java_blank_lines_around_class = 1
ij_java_blank_lines_around_field = 0
ij_java_blank_lines_around_field_in_interface = 0
ij_java_blank_lines_around_initializer = 0
ij_java_blank_lines_around_method = 0
ij_java_blank_lines_around_method_in_interface = 0
ij_java_blank_lines_before_class_end = 1
ij_java_blank_lines_before_imports = 1
ij_java_blank_lines_before_method_body = 0
ij_java_blank_lines_before_package = 1
ij_java_block_brace_style = next_line
ij_java_block_comment_add_space = false
ij_java_block_comment_at_first_column = true
ij_java_builder_methods = none
ij_java_call_parameters_new_line_after_left_paren = false
ij_java_call_parameters_right_paren_on_new_line = false
ij_java_call_parameters_wrap = normal
ij_java_case_statement_on_separate_line = true
ij_java_catch_on_new_line = true
ij_java_class_annotation_wrap = off
ij_java_class_brace_style = next_line
ij_java_class_count_to_use_import_on_demand = 5
ij_java_class_names_in_javadoc = 1
ij_java_deconstruction_list_wrap = normal
ij_java_do_not_indent_top_level_class_members = false
ij_java_do_not_wrap_after_single_annotation = false
ij_java_do_not_wrap_after_single_annotation_in_parameter = false
ij_java_do_while_brace_force = never
ij_java_doc_add_blank_line_after_description = true
ij_java_doc_add_blank_line_after_param_comments = false
ij_java_doc_add_blank_line_after_return = false
ij_java_doc_add_p_tag_on_empty_lines = false
ij_java_doc_align_exception_comments = false
ij_java_doc_align_param_comments = false
ij_java_doc_do_not_wrap_if_one_line = true
ij_java_doc_enable_formatting = true
ij_java_doc_enable_leading_asterisks = true
ij_java_doc_indent_on_continuation = false
ij_java_doc_keep_empty_lines = true
ij_java_doc_keep_empty_parameter_tag = true
ij_java_doc_keep_empty_return_tag = false
ij_java_doc_keep_empty_throws_tag = true
ij_java_doc_keep_invalid_tags = true
ij_java_doc_param_description_on_new_line = false
ij_java_doc_preserve_line_breaks = false
ij_java_doc_use_throws_not_exception_tag = true
ij_java_else_on_new_line = true
ij_java_enum_constants_wrap = off
ij_java_extends_keyword_wrap = normal
ij_java_extends_list_wrap = normal
ij_java_field_annotation_wrap = off
ij_java_finally_on_new_line = true
ij_java_for_brace_force = always
ij_java_for_statement_new_line_after_left_paren = false
ij_java_for_statement_right_paren_on_new_line = false
ij_java_for_statement_wrap = off
ij_java_generate_final_locals = false
ij_java_generate_final_parameters = false
ij_java_if_brace_force = never
ij_java_imports_layout = *,|,javax.**,java.**,|,$*
ij_java_indent_case_from_switch = true
ij_java_insert_inner_class_imports = false
ij_java_insert_override_annotation = true
ij_java_keep_blank_lines_before_right_brace = 10
ij_java_keep_blank_lines_between_package_declaration_and_header = 2
ij_java_keep_blank_lines_in_code = 10
ij_java_keep_blank_lines_in_declarations = 10
ij_java_keep_builder_methods_indents = false
ij_java_keep_control_statement_in_one_line = true
ij_java_keep_first_column_comment = true
ij_java_keep_indents_on_empty_lines = true
ij_java_keep_line_breaks = true
ij_java_keep_multiple_expressions_in_one_line = true
ij_java_keep_simple_blocks_in_one_line = false
ij_java_keep_simple_classes_in_one_line = true
ij_java_keep_simple_lambdas_in_one_line = true
ij_java_keep_simple_methods_in_one_line = true
ij_java_label_indent_absolute = false
ij_java_label_indent_size = 0
ij_java_lambda_brace_style = end_of_line
ij_java_layout_static_imports_separately = true
ij_java_line_comment_add_space = false
ij_java_line_comment_add_space_on_reformat = false
ij_java_line_comment_at_first_column = false
ij_java_method_annotation_wrap = off
ij_java_method_brace_style = next_line
ij_java_method_call_chain_wrap = normal
ij_java_method_parameters_new_line_after_left_paren = true
ij_java_method_parameters_right_paren_on_new_line = false
ij_java_method_parameters_wrap = normal
ij_java_modifier_list_wrap = false
ij_java_multi_catch_types_wrap = normal
ij_java_names_count_to_use_import_on_demand = 3
ij_java_new_line_after_lparen_in_annotation = false
ij_java_new_line_after_lparen_in_deconstruction_pattern = true
ij_java_new_line_after_lparen_in_record_header = false
ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.*
ij_java_parameter_annotation_wrap = off
ij_java_parentheses_expression_new_line_after_left_paren = false
ij_java_parentheses_expression_right_paren_on_new_line = false
ij_java_place_assignment_sign_on_next_line = false
ij_java_prefer_longer_names = true
ij_java_prefer_parameters_wrap = false
ij_java_record_components_wrap = normal
ij_java_repeat_synchronized = true
ij_java_replace_instanceof_and_cast = false
ij_java_replace_null_check = false
ij_java_replace_sum_lambda_with_method_ref = false
ij_java_resource_list_new_line_after_left_paren = false
ij_java_resource_list_right_paren_on_new_line = false
ij_java_resource_list_wrap = on_every_item
ij_java_rparen_on_new_line_in_annotation = false
ij_java_rparen_on_new_line_in_deconstruction_pattern = true
ij_java_rparen_on_new_line_in_record_header = false
ij_java_space_after_closing_angle_bracket_in_type_argument = false
ij_java_space_after_colon = true
ij_java_space_after_comma = true
ij_java_space_after_comma_in_type_arguments = true
ij_java_space_after_for_semicolon = true
ij_java_space_after_quest = true
ij_java_space_after_type_cast = true
ij_java_space_before_annotation_array_initializer_left_brace = false
ij_java_space_before_annotation_parameter_list = false
ij_java_space_before_array_initializer_left_brace = false
ij_java_space_before_catch_keyword = true
ij_java_space_before_catch_left_brace = true
ij_java_space_before_catch_parentheses = true
ij_java_space_before_class_left_brace = true
ij_java_space_before_colon = true
ij_java_space_before_colon_in_foreach = true
ij_java_space_before_comma = false
ij_java_space_before_deconstruction_list = false
ij_java_space_before_do_left_brace = true
ij_java_space_before_else_keyword = true
ij_java_space_before_else_left_brace = true
ij_java_space_before_finally_keyword = true
ij_java_space_before_finally_left_brace = true
ij_java_space_before_for_left_brace = true
ij_java_space_before_for_parentheses = true
ij_java_space_before_for_semicolon = false
ij_java_space_before_if_left_brace = true
ij_java_space_before_if_parentheses = true
ij_java_space_before_method_call_parentheses = false
ij_java_space_before_method_left_brace = true
ij_java_space_before_method_parentheses = false
ij_java_space_before_opening_angle_bracket_in_type_parameter = false
ij_java_space_before_quest = true
ij_java_space_before_switch_left_brace = true
ij_java_space_before_switch_parentheses = true
ij_java_space_before_synchronized_left_brace = false
ij_java_space_before_synchronized_parentheses = true
ij_java_space_before_try_left_brace = true
ij_java_space_before_try_parentheses = true
ij_java_space_before_type_parameter_list = false
ij_java_space_before_while_keyword = true
ij_java_space_before_while_left_brace = true
ij_java_space_before_while_parentheses = true
ij_java_space_inside_one_line_enum_braces = false
ij_java_space_within_empty_array_initializer_braces = true
ij_java_space_within_empty_method_call_parentheses = false
ij_java_space_within_empty_method_parentheses = false
ij_java_spaces_around_additive_operators = true
ij_java_spaces_around_annotation_eq = true
ij_java_spaces_around_assignment_operators = true
ij_java_spaces_around_bitwise_operators = true
ij_java_spaces_around_equality_operators = true
ij_java_spaces_around_lambda_arrow = true
ij_java_spaces_around_logical_operators = true
ij_java_spaces_around_method_ref_dbl_colon = false
ij_java_spaces_around_multiplicative_operators = true
ij_java_spaces_around_relational_operators = true
ij_java_spaces_around_shift_operators = true
ij_java_spaces_around_type_bounds_in_type_parameters = true
ij_java_spaces_around_unary_operator = false
ij_java_spaces_within_angle_brackets = false
ij_java_spaces_within_annotation_parentheses = false
ij_java_spaces_within_array_initializer_braces = false
ij_java_spaces_within_braces = true
ij_java_spaces_within_brackets = false
ij_java_spaces_within_cast_parentheses = false
ij_java_spaces_within_catch_parentheses = false
ij_java_spaces_within_deconstruction_list = false
ij_java_spaces_within_for_parentheses = false
ij_java_spaces_within_if_parentheses = false
ij_java_spaces_within_method_call_parentheses = false
ij_java_spaces_within_method_parentheses = false
ij_java_spaces_within_parentheses = false
ij_java_spaces_within_record_header = false
ij_java_spaces_within_switch_parentheses = false
ij_java_spaces_within_synchronized_parentheses = false
ij_java_spaces_within_try_parentheses = false
ij_java_spaces_within_while_parentheses = false
ij_java_special_else_if_treatment = true
ij_java_subclass_name_suffix = Impl
ij_java_ternary_operation_signs_on_next_line = false
ij_java_ternary_operation_wrap = on_every_item
ij_java_test_name_suffix = Test
ij_java_throws_keyword_wrap = normal
ij_java_throws_list_wrap = normal
ij_java_use_external_annotations = false
ij_java_use_fq_class_names = false
ij_java_use_relative_indents = false
ij_java_use_single_class_imports = true
ij_java_variable_annotation_wrap = off
ij_java_visibility = public
ij_java_while_brace_force = always
ij_java_while_on_new_line = true
ij_java_wrap_comments = false
ij_java_wrap_first_method_in_call_chain = false
ij_java_wrap_long_lines = false
[*.nbtt]
indent_style = tab
max_line_length = 150
ij_continuation_indent_size = 4
ij_nbtt_keep_indents_on_empty_lines = false
ij_nbtt_space_after_colon = true
ij_nbtt_space_after_comma = true
ij_nbtt_space_before_colon = true
ij_nbtt_space_before_comma = false
ij_nbtt_spaces_within_brackets = false
ij_nbtt_spaces_within_parentheses = false
[*.properties]
ij_properties_align_group_field_declarations = false
ij_properties_keep_blank_lines = false
ij_properties_key_value_delimiter = equals
ij_properties_spaces_around_key_value_delimiter = false
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true
[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.jspx,*.pom,*.rng,*.tagx,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}]
ij_xml_align_attributes = true
ij_xml_align_text = false
ij_xml_attribute_wrap = normal
ij_xml_block_comment_add_space = false
ij_xml_block_comment_at_first_column = true
ij_xml_keep_blank_lines = 2
ij_xml_keep_indents_on_empty_lines = false
ij_xml_keep_line_breaks = true
ij_xml_keep_line_breaks_in_text = true
ij_xml_keep_whitespaces = false
ij_xml_keep_whitespaces_around_cdata = preserve
ij_xml_keep_whitespaces_inside_cdata = false
ij_xml_line_comment_at_first_column = true
ij_xml_space_after_tag_name = false
ij_xml_space_around_equals_in_attribute = false
ij_xml_space_inside_empty_tag = false
ij_xml_text_wrap = normal
ij_xml_use_custom_settings = false
[{*.bash,*.sh,*.zsh}]
indent_size = 4
tab_width = 4
ij_shell_binary_ops_start_line = false
ij_shell_keep_column_alignment_padding = false
ij_shell_minify_program = false
ij_shell_redirect_followed_by_space = false
ij_shell_switch_cases_indented = false
ij_shell_use_unix_line_separator = true
[{*.comp,*.frag,*.fsh,*.geom,*.glsl,*.gsh,*.tesc,*.tese,*.vert,*.vsh}]
ij_glsl_space_after_colon = true
ij_glsl_space_after_comma = true
ij_glsl_space_after_for_semicolon = true
ij_glsl_space_after_quest = true
ij_glsl_space_before_colon = false
ij_glsl_space_before_comma = false
ij_glsl_space_before_for_semicolon = false
ij_glsl_space_before_quest = true
ij_glsl_spaces_around_additive_operators = true
ij_glsl_spaces_around_assignment_operators = true
ij_glsl_spaces_around_bitwise_operators = true
ij_glsl_spaces_around_equality_operators = true
ij_glsl_spaces_around_logical_operators = true
ij_glsl_spaces_around_multiplicative_operators = true
ij_glsl_spaces_around_relational_operators = true
ij_glsl_spaces_around_shift_operators = true
ij_glsl_spaces_within_brackets = false
ij_glsl_spaces_within_parentheses = false
[{*.gant,*.groovy,*.gy}]
ij_groovy_align_group_field_declarations = false
ij_groovy_align_multiline_array_initializer_expression = false
ij_groovy_align_multiline_assignment = false
ij_groovy_align_multiline_binary_operation = false
ij_groovy_align_multiline_chained_methods = false
ij_groovy_align_multiline_extends_list = false
ij_groovy_align_multiline_for = true
ij_groovy_align_multiline_list_or_map = true
ij_groovy_align_multiline_method_parentheses = false
ij_groovy_align_multiline_parameters = true
ij_groovy_align_multiline_parameters_in_calls = false
ij_groovy_align_multiline_resources = true
ij_groovy_align_multiline_ternary_operation = false
ij_groovy_align_multiline_throws_list = false
ij_groovy_align_named_args_in_map = true
ij_groovy_align_throws_keyword = false
ij_groovy_array_initializer_new_line_after_left_brace = false
ij_groovy_array_initializer_right_brace_on_new_line = false
ij_groovy_array_initializer_wrap = off
ij_groovy_assert_statement_wrap = off
ij_groovy_assignment_wrap = off
ij_groovy_binary_operation_wrap = off
ij_groovy_blank_lines_after_class_header = 0
ij_groovy_blank_lines_after_imports = 1
ij_groovy_blank_lines_after_package = 1
ij_groovy_blank_lines_around_class = 1
ij_groovy_blank_lines_around_field = 0
ij_groovy_blank_lines_around_field_in_interface = 0
ij_groovy_blank_lines_around_method = 1
ij_groovy_blank_lines_around_method_in_interface = 1
ij_groovy_blank_lines_before_imports = 1
ij_groovy_blank_lines_before_method_body = 0
ij_groovy_blank_lines_before_package = 0
ij_groovy_block_brace_style = end_of_line
ij_groovy_block_comment_add_space = false
ij_groovy_block_comment_at_first_column = true
ij_groovy_call_parameters_new_line_after_left_paren = false
ij_groovy_call_parameters_right_paren_on_new_line = false
ij_groovy_call_parameters_wrap = off
ij_groovy_catch_on_new_line = false
ij_groovy_class_annotation_wrap = split_into_lines
ij_groovy_class_brace_style = end_of_line
ij_groovy_class_count_to_use_import_on_demand = 5
ij_groovy_do_while_brace_force = never
ij_groovy_else_on_new_line = false
ij_groovy_enable_groovydoc_formatting = true
ij_groovy_enum_constants_wrap = off
ij_groovy_extends_keyword_wrap = off
ij_groovy_extends_list_wrap = off
ij_groovy_field_annotation_wrap = split_into_lines
ij_groovy_finally_on_new_line = false
ij_groovy_for_brace_force = never
ij_groovy_for_statement_new_line_after_left_paren = false
ij_groovy_for_statement_right_paren_on_new_line = false
ij_groovy_for_statement_wrap = off
ij_groovy_ginq_general_clause_wrap_policy = 2
ij_groovy_ginq_having_wrap_policy = 1
ij_groovy_ginq_indent_having_clause = true
ij_groovy_ginq_indent_on_clause = true
ij_groovy_ginq_on_wrap_policy = 1
ij_groovy_ginq_space_after_keyword = true
ij_groovy_if_brace_force = never
ij_groovy_import_annotation_wrap = 2
ij_groovy_imports_layout = *,|,javax.**,java.**,|,$*
ij_groovy_indent_case_from_switch = true
ij_groovy_indent_label_blocks = true
ij_groovy_insert_inner_class_imports = false
ij_groovy_keep_blank_lines_before_right_brace = 2
ij_groovy_keep_blank_lines_in_code = 2
ij_groovy_keep_blank_lines_in_declarations = 2
ij_groovy_keep_control_statement_in_one_line = true
ij_groovy_keep_first_column_comment = true
ij_groovy_keep_indents_on_empty_lines = false
ij_groovy_keep_line_breaks = true
ij_groovy_keep_multiple_expressions_in_one_line = false
ij_groovy_keep_simple_blocks_in_one_line = false
ij_groovy_keep_simple_classes_in_one_line = true
ij_groovy_keep_simple_lambdas_in_one_line = true
ij_groovy_keep_simple_methods_in_one_line = true
ij_groovy_label_indent_absolute = false
ij_groovy_label_indent_size = 0
ij_groovy_lambda_brace_style = end_of_line
ij_groovy_layout_static_imports_separately = true
ij_groovy_line_comment_add_space = false
ij_groovy_line_comment_add_space_on_reformat = false
ij_groovy_line_comment_at_first_column = true
ij_groovy_method_annotation_wrap = split_into_lines
ij_groovy_method_brace_style = end_of_line
ij_groovy_method_call_chain_wrap = off
ij_groovy_method_parameters_new_line_after_left_paren = false
ij_groovy_method_parameters_right_paren_on_new_line = false
ij_groovy_method_parameters_wrap = off
ij_groovy_modifier_list_wrap = false
ij_groovy_names_count_to_use_import_on_demand = 3
ij_groovy_packages_to_use_import_on_demand = java.awt.*,javax.swing.*
ij_groovy_parameter_annotation_wrap = off
ij_groovy_parentheses_expression_new_line_after_left_paren = false
ij_groovy_parentheses_expression_right_paren_on_new_line = false
ij_groovy_prefer_parameters_wrap = false
ij_groovy_resource_list_new_line_after_left_paren = false
ij_groovy_resource_list_right_paren_on_new_line = false
ij_groovy_resource_list_wrap = off
ij_groovy_space_after_assert_separator = true
ij_groovy_space_after_colon = true
ij_groovy_space_after_comma = true
ij_groovy_space_after_comma_in_type_arguments = true
ij_groovy_space_after_for_semicolon = true
ij_groovy_space_after_quest = true
ij_groovy_space_after_type_cast = true
ij_groovy_space_before_annotation_parameter_list = false
ij_groovy_space_before_array_initializer_left_brace = false
ij_groovy_space_before_assert_separator = false
ij_groovy_space_before_catch_keyword = true
ij_groovy_space_before_catch_left_brace = true
ij_groovy_space_before_catch_parentheses = true
ij_groovy_space_before_class_left_brace = true
ij_groovy_space_before_closure_left_brace = true
ij_groovy_space_before_colon = true
ij_groovy_space_before_comma = false
ij_groovy_space_before_do_left_brace = true
ij_groovy_space_before_else_keyword = true
ij_groovy_space_before_else_left_brace = true
ij_groovy_space_before_finally_keyword = true
ij_groovy_space_before_finally_left_brace = true
ij_groovy_space_before_for_left_brace = true
ij_groovy_space_before_for_parentheses = true
ij_groovy_space_before_for_semicolon = false
ij_groovy_space_before_if_left_brace = true
ij_groovy_space_before_if_parentheses = true
ij_groovy_space_before_method_call_parentheses = false
ij_groovy_space_before_method_left_brace = true
ij_groovy_space_before_method_parentheses = false
ij_groovy_space_before_quest = true
ij_groovy_space_before_record_parentheses = false
ij_groovy_space_before_switch_left_brace = true
ij_groovy_space_before_switch_parentheses = true
ij_groovy_space_before_synchronized_left_brace = true
ij_groovy_space_before_synchronized_parentheses = true
ij_groovy_space_before_try_left_brace = true
ij_groovy_space_before_try_parentheses = true
ij_groovy_space_before_while_keyword = true
ij_groovy_space_before_while_left_brace = true
ij_groovy_space_before_while_parentheses = true
ij_groovy_space_in_named_argument = true
ij_groovy_space_in_named_argument_before_colon = false
ij_groovy_space_within_empty_array_initializer_braces = false
ij_groovy_space_within_empty_method_call_parentheses = false
ij_groovy_spaces_around_additive_operators = true
ij_groovy_spaces_around_assignment_operators = true
ij_groovy_spaces_around_bitwise_operators = true
ij_groovy_spaces_around_equality_operators = true
ij_groovy_spaces_around_lambda_arrow = true
ij_groovy_spaces_around_logical_operators = true
ij_groovy_spaces_around_multiplicative_operators = true
ij_groovy_spaces_around_regex_operators = true
ij_groovy_spaces_around_relational_operators = true
ij_groovy_spaces_around_shift_operators = true
ij_groovy_spaces_within_annotation_parentheses = false
ij_groovy_spaces_within_array_initializer_braces = false
ij_groovy_spaces_within_braces = true
ij_groovy_spaces_within_brackets = false
ij_groovy_spaces_within_cast_parentheses = false
ij_groovy_spaces_within_catch_parentheses = false
ij_groovy_spaces_within_for_parentheses = false
ij_groovy_spaces_within_gstring_injection_braces = false
ij_groovy_spaces_within_if_parentheses = false
ij_groovy_spaces_within_list_or_map = false
ij_groovy_spaces_within_method_call_parentheses = false
ij_groovy_spaces_within_method_parentheses = false
ij_groovy_spaces_within_parentheses = false
ij_groovy_spaces_within_switch_parentheses = false
ij_groovy_spaces_within_synchronized_parentheses = false
ij_groovy_spaces_within_try_parentheses = false
ij_groovy_spaces_within_tuple_expression = false
ij_groovy_spaces_within_while_parentheses = false
ij_groovy_special_else_if_treatment = true
ij_groovy_ternary_operation_wrap = off
ij_groovy_throws_keyword_wrap = off
ij_groovy_throws_list_wrap = off
ij_groovy_use_flying_geese_braces = false
ij_groovy_use_fq_class_names = false
ij_groovy_use_fq_class_names_in_javadoc = true
ij_groovy_use_relative_indents = false
ij_groovy_use_single_class_imports = true
ij_groovy_variable_annotation_wrap = off
ij_groovy_while_brace_force = never
ij_groovy_while_on_new_line = false
ij_groovy_wrap_chain_calls_after_dot = false
ij_groovy_wrap_long_lines = false
[{*.har,*.json,*.png.mcmeta,mcmod.info,pack.mcmeta}]
indent_size = 4
ij_json_array_wrapping = split_into_lines
ij_json_keep_blank_lines_in_code = 0
ij_json_keep_indents_on_empty_lines = false
ij_json_keep_line_breaks = true
ij_json_keep_trailing_comma = false
ij_json_object_wrapping = split_into_lines
ij_json_property_alignment = do_not_align
ij_json_space_after_colon = true
ij_json_space_after_comma = true
ij_json_space_before_colon = false
ij_json_space_before_comma = false
ij_json_spaces_within_braces = false
ij_json_spaces_within_brackets = false
ij_json_wrap_long_lines = false
[{*.htm,*.html,*.sht,*.shtm,*.shtml}]
ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3
ij_html_align_attributes = true
ij_html_align_text = false
ij_html_attribute_wrap = normal
ij_html_block_comment_add_space = false
ij_html_block_comment_at_first_column = true
ij_html_do_not_align_children_of_min_lines = 0
ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p
ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot
ij_html_enforce_quotes = false
ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var
ij_html_keep_blank_lines = 2
ij_html_keep_indents_on_empty_lines = false
ij_html_keep_line_breaks = true
ij_html_keep_line_breaks_in_text = true
ij_html_keep_whitespaces = false
ij_html_keep_whitespaces_inside = span,pre,textarea
ij_html_line_comment_at_first_column = true
ij_html_new_line_after_last_attribute = never
ij_html_new_line_before_first_attribute = never
ij_html_quote_style = double
ij_html_remove_new_line_before_tags = br
ij_html_space_after_tag_name = false
ij_html_space_around_equality_in_attribute = false
ij_html_space_inside_empty_tag = false
ij_html_text_wrap = normal
[{*.kt,*.kts}]
ij_kotlin_align_in_columns_case_branch = false
ij_kotlin_align_multiline_binary_operation = false
ij_kotlin_align_multiline_extends_list = false
ij_kotlin_align_multiline_method_parentheses = false
ij_kotlin_align_multiline_parameters = true
ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_assignment_wrap = off
ij_kotlin_blank_lines_after_class_header = 0
ij_kotlin_blank_lines_around_block_when_branches = 0
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
ij_kotlin_block_comment_add_space = false
ij_kotlin_block_comment_at_first_column = true
ij_kotlin_call_parameters_new_line_after_left_paren = false
ij_kotlin_call_parameters_right_paren_on_new_line = false
ij_kotlin_call_parameters_wrap = off
ij_kotlin_catch_on_new_line = false
ij_kotlin_class_annotation_wrap = split_into_lines
ij_kotlin_continuation_indent_for_chained_calls = true
ij_kotlin_continuation_indent_for_expression_bodies = true
ij_kotlin_continuation_indent_in_argument_lists = true
ij_kotlin_continuation_indent_in_elvis = true
ij_kotlin_continuation_indent_in_if_conditions = true
ij_kotlin_continuation_indent_in_parameter_lists = true
ij_kotlin_continuation_indent_in_supertype_lists = true
ij_kotlin_else_on_new_line = false
ij_kotlin_enum_constants_wrap = off
ij_kotlin_extends_list_wrap = off
ij_kotlin_field_annotation_wrap = split_into_lines
ij_kotlin_finally_on_new_line = false
ij_kotlin_if_rparen_on_new_line = false
ij_kotlin_import_nested_classes = false
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
ij_kotlin_keep_blank_lines_before_right_brace = 2
ij_kotlin_keep_blank_lines_in_code = 2
ij_kotlin_keep_blank_lines_in_declarations = 2
ij_kotlin_keep_first_column_comment = true
ij_kotlin_keep_indents_on_empty_lines = false
ij_kotlin_keep_line_breaks = true
ij_kotlin_lbrace_on_next_line = false
ij_kotlin_line_break_after_multiline_when_entry = true
ij_kotlin_line_comment_add_space = false
ij_kotlin_line_comment_add_space_on_reformat = false
ij_kotlin_line_comment_at_first_column = true
ij_kotlin_method_annotation_wrap = split_into_lines
ij_kotlin_method_call_chain_wrap = off
ij_kotlin_method_parameters_new_line_after_left_paren = false
ij_kotlin_method_parameters_right_paren_on_new_line = false
ij_kotlin_method_parameters_wrap = off
ij_kotlin_name_count_to_use_star_import = 5
ij_kotlin_name_count_to_use_star_import_for_members = 3
ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.**
ij_kotlin_parameter_annotation_wrap = off
ij_kotlin_space_after_comma = true
ij_kotlin_space_after_extend_colon = true
ij_kotlin_space_after_type_colon = true
ij_kotlin_space_before_catch_parentheses = true
ij_kotlin_space_before_comma = false
ij_kotlin_space_before_extend_colon = true
ij_kotlin_space_before_for_parentheses = true
ij_kotlin_space_before_if_parentheses = true
ij_kotlin_space_before_lambda_arrow = true
ij_kotlin_space_before_type_colon = false
ij_kotlin_space_before_when_parentheses = true
ij_kotlin_space_before_while_parentheses = true
ij_kotlin_spaces_around_additive_operators = true
ij_kotlin_spaces_around_assignment_operators = true
ij_kotlin_spaces_around_equality_operators = true
ij_kotlin_spaces_around_function_type_arrow = true
ij_kotlin_spaces_around_logical_operators = true
ij_kotlin_spaces_around_multiplicative_operators = true
ij_kotlin_spaces_around_range = false
ij_kotlin_spaces_around_relational_operators = true
ij_kotlin_spaces_around_unary_operator = false
ij_kotlin_spaces_around_when_arrow = true
ij_kotlin_variable_annotation_wrap = off
ij_kotlin_while_on_new_line = false
ij_kotlin_wrap_elvis_expressions = 1
ij_kotlin_wrap_expression_body_functions = 0
ij_kotlin_wrap_first_method_in_call_chain = false
[{*.markdown,*.md}]
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_format_tables = true
ij_markdown_insert_quote_arrows_on_wrap = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_keep_line_breaks_inside_text_blocks = true
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1
ij_markdown_wrap_text_if_long = true
ij_markdown_wrap_text_inside_blockquotes = true
[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}]
ij_toml_keep_indents_on_empty_lines = false
[{*.yaml,*.yml}]
indent_size = 4
ij_yaml_align_values_properties = do_not_align
ij_yaml_autoinsert_sequence_marker = true
ij_yaml_block_mapping_on_new_line = false
ij_yaml_indent_sequence_value = true
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
ij_yaml_sequence_on_new_line = false
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
ij_yaml_spaces_within_brackets = true
@@ -18,12 +18,12 @@ import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IOverri
* This is the masthead of the API, almost everything you could want to do
* can be achieved from here. <br>
* For example: you can access singletons which handle the config or event binding. <br><br>
*
*
* <strong>Q:</strong> Why should I use this class instead of just getting the API singleton I need? <br>
*
*
* <strong>A:</strong> This way there is a lower chance of your code breaking if we change something on our end.
* For example, if we realized there is a much better way of handling dependency injection we would keep the
* interface the same so your code doesn't have to change. Whereas if you were directly referencing
* interface the same so your code doesn't have to change. Whereas if you were directly referencing
* the concrete object we replaced, there would be issues.
*
* @author James Seibel
@@ -31,10 +31,10 @@ import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IOverri
*/
public class DhApi
{
/**
* <strong>WARNING:</strong>
/**
* <strong>WARNING:</strong>
* All objects in this class will be null until after DH initializes for the first time. <br><br>
*
*
* Bind a custom {@link DhApiAfterDhInitEvent DhApiAfterDhInitEvent}
* to {@link DhApi#events ApiCoreInjectors.events} in order to be notified when this class can
* be safely used.
@@ -44,8 +44,8 @@ public class DhApi
/** Used to interact with Distant Horizons' Configs. */
public static IDhApiConfig configs = null;
/**
* Used to interact with Distant Horizons' terrain data.
/**
* Used to interact with Distant Horizons' terrain data.
* Designed to be used in conjunction with {@link DhApi.Delayed#worldProxy}.
*/
public static IDhApiTerrainDataRepo terrainRepo = null;
@@ -81,8 +81,8 @@ public class DhApi
/** This version should be updated whenever non-breaking fixes are added to the Distant Horizons API. */
public static int getApiPatchVersion() { return ModInfo.API_PATH_VERSION; }
/**
* Returns the mod's semantic version number in the format: Major.Minor.Patch
/**
* Returns the mod's semantic version number in the format: Major.Minor.Patch
* with optional extensions "-a" for alpha, "-b" for beta, and -dev for unstable development builds. <br>
* Examples: "1.6.9-a", "1.7.0-a-dev", "2.1.0-b", "3.0.0", "3.1.4-dev"
*/
@@ -9,11 +9,11 @@ package com.seibel.distanthorizons.api.enums;
* is, with the smallest being 0 (1 block wide). <br>
* The width of a detail level can be calculated by putting the detail level to the power of 2. <br>
* Example for the chunk detail level (4): 2^4 = 16 blocks wide <Br><br>
*
*
* This enum doesn't contain all valid detail levels, only those most likely to be needed.
* Detail levels 1,2,3, ... 255 are all technically valid detail levels
* (although anything beyond {@link EDhApiDetailLevel#REGION} may be difficult deal with).
*
* Detail levels 1,2,3, ... 255 are all technically valid detail levels
* (although anything beyond {@link EDhApiDetailLevel#REGION} may be difficult deal with).
*
* @author James Seibel
* @version 2022-12-5
*/
@@ -23,14 +23,14 @@ public enum EDhApiDetailLevel
// when adding items up the API minor version
// when removing items up the API major version
/**
/**
* detail level: 0 <Br>
* width in Blocks: 1
* width in Blocks: 1
*/
BLOCK(0, 1),
/**
* detail level: 4 <Br>
* width in Blocks: 16
* width in Blocks: 16
*/
CHUNK(4, 16),
/**
@@ -7,8 +7,8 @@ import java.lang.annotation.RetentionPolicy;
* Add this annotation to enum values that
* are valid config options, but shouldn't be selectable
* when toggling through the options. <br><br>
*
* Example: A preset's "custom" option shouldn't be selectable
*
* Example: A preset's "custom" option shouldn't be selectable
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface DisallowSelectingViaConfigGui
@@ -26,7 +26,7 @@ package com.seibel.distanthorizons.api.enums.config;
* RARE <br> <br>
*
* Determines how fast the buffers should be regenerated
*
*
* @author Leonardo Amato
* @version 9-25-2021
*/
@@ -26,7 +26,7 @@ package com.seibel.distanthorizons.api.enums.config;
*
* Determines which LODs should have priority when generating
* outside the normal view distance.
*
*
* @author Leonardo Amato
* @version 12-1-2021
*/
@@ -34,7 +34,7 @@ public enum EGpuUploadMethod
{
/** Picks the best option based on the GPU the user has. */
AUTO(false, false),
// commented out since it isn't currently in use
//BUFFER_STORAGE_MAPPING(true, true),
@@ -43,14 +43,14 @@ public enum EGpuUploadMethod
/** Fast rendering but may stutter when uploading. */
SUB_DATA(false, false),
/**
/**
* May end up storing buffers in System memory. <br>
* Fast rending if in GPU memory, slow if in system memory, <br>
* but won't stutter when uploading.
* but won't stutter when uploading.
*/
BUFFER_MAPPING(true, false),
/** Fast rendering but may stutter when uploading. */
DATA(false, false);
@@ -52,8 +52,8 @@ public enum EHorizontalQuality
EHorizontalQuality(double quadraticBase, int distanceUnitInBlocks)
{
this.quadraticBase = quadraticBase;
this.quadraticBase = quadraticBase;
this.distanceUnitInBlocks = distanceUnitInBlocks;
}
}
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.config;
/**
@@ -16,30 +16,32 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.config;
import org.apache.logging.log4j.Level;
public enum ELoggerMode
{
DISABLED(Level.OFF, Level.OFF),
LOG_ALL_TO_FILE(Level.ALL, Level.OFF),
LOG_ERROR_TO_CHAT(Level.ALL, Level.ERROR),
LOG_WARNING_TO_CHAT(Level.ALL, Level.WARN),
LOG_INFO_TO_CHAT(Level.ALL, Level.INFO),
LOG_DEBUG_TO_CHAT(Level.ALL, Level.DEBUG),
LOG_ALL_TO_CHAT(Level.ALL, Level.ALL),
LOG_ERROR_TO_CHAT_AND_FILE(Level.ERROR, Level.ERROR),
LOG_WARNING_TO_CHAT_AND_FILE(Level.WARN, Level.WARN),
LOG_INFO_TO_CHAT_AND_FILE(Level.INFO, Level.INFO),
LOG_DEBUG_TO_CHAT_AND_FILE(Level.DEBUG, Level.DEBUG),
LOG_WARNING_TO_CHAT_AND_INFO_TO_FILE(Level.INFO, Level.WARN),
LOG_ERROR_TO_CHAT_AND_INFO_TO_FILE(Level.INFO, Level.ERROR),
;
public final Level levelForFile;
public final Level levelForChat;
ELoggerMode(Level levelForFile, Level levelForChat) {
this.levelForFile = levelForFile;
this.levelForChat = levelForChat;
}
DISABLED(Level.OFF, Level.OFF),
LOG_ALL_TO_FILE(Level.ALL, Level.OFF),
LOG_ERROR_TO_CHAT(Level.ALL, Level.ERROR),
LOG_WARNING_TO_CHAT(Level.ALL, Level.WARN),
LOG_INFO_TO_CHAT(Level.ALL, Level.INFO),
LOG_DEBUG_TO_CHAT(Level.ALL, Level.DEBUG),
LOG_ALL_TO_CHAT(Level.ALL, Level.ALL),
LOG_ERROR_TO_CHAT_AND_FILE(Level.ERROR, Level.ERROR),
LOG_WARNING_TO_CHAT_AND_FILE(Level.WARN, Level.WARN),
LOG_INFO_TO_CHAT_AND_FILE(Level.INFO, Level.INFO),
LOG_DEBUG_TO_CHAT_AND_FILE(Level.DEBUG, Level.DEBUG),
LOG_WARNING_TO_CHAT_AND_INFO_TO_FILE(Level.INFO, Level.WARN),
LOG_ERROR_TO_CHAT_AND_INFO_TO_FILE(Level.INFO, Level.ERROR),
;
public final Level levelForFile;
public final Level levelForChat;
ELoggerMode(Level levelForFile, Level levelForChat)
{
this.levelForFile = levelForFile;
this.levelForChat = levelForChat;
}
}
@@ -30,7 +30,7 @@ import com.seibel.distanthorizons.coreapi.util.MathUtil;
* FOUR_BLOCKS <br>
* HALF_CHUNK <Br>
* CHUNK <br>
*
*
* @author James Seibel
* @author Leonardo Amato
* @version 2023-6-14
@@ -27,7 +27,7 @@ package com.seibel.distanthorizons.api.enums.config;
* NAME_IP_PORT_MC_VERSION, <br> <br>
*
* Determines how the multiplayer folders should be named.
*
*
* @author James Seibel
* @version 2022-7-1
*/
@@ -41,7 +41,7 @@ public enum EServerFolderNameMode
/** Only use the server name */
NAME_ONLY,
/**
/**
* {SERVER_NAME} IP {IP} <br>
* Example: Minecraft Server IP 192.168.1.40
*/
@@ -53,10 +53,10 @@ public enum EServerFolderNameMode
*/
NAME_IP_PORT,
/**
/**
* {SERVER_NAME} IP {IP} <br>
* Example: Minecraft Server IP 192.168.1.40:25565 GameVersion 1.16.5 <Br> <br>
*
*
* Not normally recommended, since the game version can change if the
* server installs paper or some other jar. <br>
* This is just here to provide backwards compatibility.
@@ -26,7 +26,7 @@ package com.seibel.distanthorizons.api.enums.config;
*
* This represents how far the LODs should overlap with
* the vanilla Minecraft terrain.
*
*
* @author James Seibel
* @version 2022-6-30
*/
@@ -33,11 +33,11 @@ import com.seibel.distanthorizons.coreapi.util.MathUtil;
*/
public enum EVerticalQuality
{
HEIGHT_MAP(new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }),
LOW(new int[] { 4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 }),
MEDIUM(new int[] { 6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1 }),
HIGH(new int[] { 8, 6, 4, 2, 2, 2, 2, 1, 1, 1, 1 }),
EXTREME(new int[] { 16, 8, 4, 2, 2, 2, 2, 1, 1, 1, 1 });
HEIGHT_MAP(new int[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}),
LOW(new int[]{4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}),
MEDIUM(new int[]{6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1}),
HIGH(new int[]{8, 6, 4, 2, 2, 2, 2, 1, 1, 1, 1}),
EXTREME(new int[]{16, 8, 4, 2, 2, 2, 2, 1, 1, 1, 1});
/** represents how many LODs can be rendered in a single vertical slice */
public final int[] maxVerticalData;
@@ -48,11 +48,11 @@ public enum EVerticalQuality
public int calculateMaxVerticalData(byte dataDetail)
public int calculateMaxVerticalData(byte dataDetail)
{
// for detail levels lower than what the enum defines, use the lowest quality item
int index = MathUtil.clamp(0, dataDetail, this.maxVerticalData.length - 1);
return this.maxVerticalData[index];
}
}
}
@@ -23,7 +23,7 @@ import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui
/**
* CUSTOM, <br><br>
*
*
* MINIMUM, <br>
* LOW, <br>
* MEDIUM, <br>
@@ -23,7 +23,7 @@ import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui
/**
* CUSTOM, <br><br>
*
*
* MINIMAL_IMPACT, <br>
* LOW_IMPACT, <br>
* BALANCED, <br>
@@ -53,27 +53,37 @@ public enum EDebugRendering
SHOW_RENDER_SOURCE_FLAG;
public static EDebugRendering next(EDebugRendering type)
public static EDebugRendering next(EDebugRendering type)
{
switch (type)
switch (type)
{
case OFF: return SHOW_DETAIL;
case SHOW_DETAIL: return SHOW_GENMODE;
case SHOW_GENMODE: return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS: return SHOW_RENDER_SOURCE_FLAG;
default: return OFF;
case OFF:
return SHOW_DETAIL;
case SHOW_DETAIL:
return SHOW_GENMODE;
case SHOW_GENMODE:
return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS:
return SHOW_RENDER_SOURCE_FLAG;
default:
return OFF;
}
}
public static EDebugRendering previous(EDebugRendering type)
public static EDebugRendering previous(EDebugRendering type)
{
switch (type)
switch (type)
{
case OFF: return SHOW_RENDER_SOURCE_FLAG;
case SHOW_RENDER_SOURCE_FLAG: return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS: return SHOW_GENMODE;
case SHOW_GENMODE: return SHOW_DETAIL;
default: return OFF;
case OFF:
return SHOW_RENDER_SOURCE_FLAG;
case SHOW_RENDER_SOURCE_FLAG:
return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS:
return SHOW_GENMODE;
case SHOW_GENMODE:
return SHOW_DETAIL;
default:
return OFF;
}
}
}
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.api.enums.rendering;
/**
* USE_DEFAULT_FOG_COLOR, <br>
* USE_SKY_COLOR, <br>
*
*
* @author James Seibel
* @version 2022-6-9
*/
@@ -21,7 +21,7 @@ package com.seibel.distanthorizons.api.enums.rendering;
/**
* NEAR, FAR, or NEAR_AND_FAR.
*
*
* @author James Seibel
* @version 2022-6-2
*/
@@ -23,7 +23,7 @@ package com.seibel.distanthorizons.api.enums.rendering;
* USE_OPTIFINE_FOG_SETTING, <br>
* FOG_ENABLED, <br>
* FOG_DISABLED <br>
*
*
* @author James Seibel
* @version 2022-6-2
*/
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.rendering;
/**
@@ -36,14 +36,14 @@ package com.seibel.distanthorizons.api.enums.rendering;
*/
public enum EHeightFogMixMode
{
BASIC,
IGNORE_HEIGHT,
ADDITION,
MAX,
MULTIPLY,
INVERSE_MULTIPLY,
LIMITED_ADDITION,
MULTIPLY_ADDITION,
INVERSE_MULTIPLY_ADDITION,
AVERAGE,
BASIC,
IGNORE_HEIGHT,
ADDITION,
MAX,
MULTIPLY,
INVERSE_MULTIPLY,
LIMITED_ADDITION,
MULTIPLY_ADDITION,
INVERSE_MULTIPLY_ADDITION,
AVERAGE,
}
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.api.enums.rendering;
/**
@@ -28,36 +28,42 @@ package com.seibel.distanthorizons.api.enums.rendering;
*/
public enum ERendererMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
DEFAULT,
DEBUG,
DISABLED;
/** Used by the config GUI to cycle through the available rendering options */
public static ERendererMode next(ERendererMode type)
{
switch (type)
{
case DEFAULT: return DEBUG;
case DEBUG: return DISABLED;
default: return DEFAULT;
}
}
/** Used by the config GUI to cycle through the available rendering options */
public static ERendererMode previous(ERendererMode type)
{
switch (type)
{
case DEFAULT: return DISABLED;
case DEBUG: return DEFAULT;
default: return DEBUG;
}
}
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
DEFAULT,
DEBUG,
DISABLED;
/** Used by the config GUI to cycle through the available rendering options */
public static ERendererMode next(ERendererMode type)
{
switch (type)
{
case DEFAULT:
return DEBUG;
case DEBUG:
return DISABLED;
default:
return DEFAULT;
}
}
/** Used by the config GUI to cycle through the available rendering options */
public static ERendererMode previous(ERendererMode type)
{
switch (type)
{
case DEFAULT:
return DISABLED;
case DEBUG:
return DEFAULT;
default:
return DEBUG;
}
}
}
@@ -34,10 +34,10 @@ public enum ETransparency
DISABLED(false, false),
FAKE(true, true),
COMPLETE(true, false);
public final boolean transparencyEnabled;
public final boolean fakeTransparencyEnabled;
ETransparency(boolean transparencyEnabled, boolean fakeTransparencyEnabled)
{
this.transparencyEnabled = transparencyEnabled;
@@ -28,7 +28,7 @@ package com.seibel.distanthorizons.api.enums.worldGeneration;
* FULL <br><br>
*
* In order of fastest to slowest.
*
*
* @author James Seibel
* @author Leonardo Amato
* @version 2022-12-10
@@ -3,7 +3,7 @@ package com.seibel.distanthorizons.api.interfaces;
/**
* Implemented by wrappers so developers can
* access the underlying Minecraft object(s).
*
*
* @author James Seibel
* @version 2023-6-17
*/
@@ -23,11 +23,12 @@ import com.seibel.distanthorizons.api.interfaces.IDhApiUnsafeWrapper;
/**
* A Minecraft version independent way of handling Biomes.
*
*
* @author James Seibel
* @version 3-5-2022
*/
public interface IDhApiBiomeWrapper extends IDhApiUnsafeWrapper
{
String getName();
}
@@ -4,13 +4,13 @@ import com.seibel.distanthorizons.api.interfaces.IDhApiUnsafeWrapper;
/**
* A Minecraft version independent way of handling Blocks.
*
*
* @author James Seibel
* @version 2023-6-11
*/
public interface IDhApiBlockStateWrapper extends IDhApiUnsafeWrapper
{
boolean isAir();
boolean isAir();
boolean isSolid();
boolean isLiquid();
@@ -6,7 +6,7 @@ import com.seibel.distanthorizons.api.interfaces.config.client.*;
/**
* This interfaces holds all config groups
* the API has access to for easy access.
*
*
* @author James Seibel
* @version 2023-6-14
*/
@@ -5,7 +5,7 @@ import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindab
/**
* This interface is just used to organize API config groups so
* they can be more easily handled together.
*
*
* @author James Seibel
* @version 9-15-2022
*/
@@ -4,7 +4,6 @@ package com.seibel.distanthorizons.api.interfaces.config;
* An interface for Distant Horizon's Config.
*
* @param <T> The data type of this config.
*
* @author James Seibel
* @version 2022-9-15
*/
@@ -44,7 +44,7 @@ public interface IDhApiWorldGenerationConfig extends IDhApiConfigGroup
/** Defines to what level LOD chunks will be generated. */
IDhApiConfigValue<EDhApiDistantGeneratorMode> distantGeneratorMode();
/**
/**
* Defines what lighting engine will be used when
* Distant Horizons generates chunks.
*/
@@ -144,9 +144,9 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
/** If enabled vanilla chunk rendering is disabled and only fake chunks are rendered. */
IDhApiConfigValue<Boolean> lodOnlyMode();
/**
* Setting this to a non-zero number will modify vanilla Minecraft's LOD Bias,
* increasing how quickly its textures fade away.
/**
* Setting this to a non-zero number will modify vanilla Minecraft's LOD Bias,
* increasing how quickly its textures fade away.
*/
IDhApiConfigValue<Double> lodBias();
@@ -46,9 +46,9 @@ public interface IDhApiMultiThreadingConfig extends IDhApiConfigGroup
/** Defines how many file handler threads are used. */
IDhApiConfigValue<Integer> fileHandlerThreads();
/**
/**
* Defines how many Full to Render data converter threads are used. <br><br>
*
*
* <strong>Full data</strong> - Distant Horizons data based on BlockState and Biome IDs <br>
* <strong>Render data</strong> - color data used when Distant Horizons is rendering
*/
@@ -9,7 +9,7 @@ import com.seibel.distanthorizons.api.objects.data.DhApiTerrainDataPoint;
/**
* Used to interface with Distant Horizons' terrain data.
*
*
* @author James Seibel
* @version 2023-6-22
*/
@@ -25,9 +25,9 @@ public interface IDhApiTerrainDataRepo
/** Returns every datapoint in the column located at the given block X and Z position top to bottom. */
DhApiResult<DhApiTerrainDataPoint[]> getColumnDataAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosZ);
/**
/**
* Returns every datapoint in the given chunk's X and Z position. <br><br>
*
*
* The returned array is ordered: [relativeBlockX][relativeBlockZ][columnIndex] <br>
* RelativeBlockX/Z are relative to the block position closest to negative infinity in the chunk's position. <br>
* The column data is ordered from top to bottom. Note: each column may have a different number of values. <br>
@@ -46,21 +46,22 @@ public interface IDhApiTerrainDataRepo
/**
* Returns every datapoint in the column located at the given detail level and X/Z position. <br>
* This can be used to return terrain data for non-standard sizes (IE 2x2 blocks or 2x2 chunks).
*
*
* @param detailLevel a positive byte defining the detail level of the returned data. <br>
* Every increase doubles the width of the returned area. <br>
* Example values: 0 = block, 1 = 2x2 blocks, 2 = 4x4 blocks, ... 4 = chunk (16x16 blocks), ... 9 = region (512x512 blocks) <br>
* See {@link EDhApiDetailLevel} for more information.
* Every increase doubles the width of the returned area. <br>
* Example values: 0 = block, 1 = 2x2 blocks, 2 = 4x4 blocks, ... 4 = chunk (16x16 blocks), ... 9 = region (512x512 blocks) <br>
* See {@link EDhApiDetailLevel} for more information.
*/
DhApiResult<DhApiTerrainDataPoint[][][]> getAllTerrainDataAtDetailLevelAndPos(IDhApiLevelWrapper levelWrapper, byte detailLevel, int posX, int posZ);
/**
* Returns the datapoint and position of the LOD
* at the end of the given ray. <br><br>
*
*
* Will return "success" with a null datapoint if the ray reaches the max length without finding any data.
*/
DhApiResult<DhApiRaycastResult> raycast(IDhApiLevelWrapper levelWrapper,
DhApiResult<DhApiRaycastResult> raycast(
IDhApiLevelWrapper levelWrapper,
double rayOriginX, double rayOriginY, double rayOriginZ,
float rayDirectionX, float rayDirectionY, float rayDirectionZ,
int maxRayBlockLength);
@@ -73,19 +74,18 @@ public interface IDhApiTerrainDataRepo
/**
* Sets the LOD data for the given chunk at the chunk's position. <br><br>
*
*
* Notes: <br>
* - Only works if the given {@link IDhApiLevelWrapper} points to a loaded level. <br>
* - If the player travels to this chunk, or the chunk is updated in some other way; your data will be replaced
* by whatever the current chunk is. <br>
* by whatever the current chunk is. <br>
* - This method may not update the LOD data immediately. Any other chunks have
* been queued to update, they will be handled first.
* been queued to update, they will be handled first.
*
* @param levelWrapper the level wrapper that the chunk should be saved to.
* @param chunkObjectArray see {@link IDhApiWorldGenerator#generateChunks} for what objects are expected.
*
* @throws ClassCastException if chunkObjectArray doesn't contain the right objects.
* The exception will contain the expected object(s).
* @throws ClassCastException if chunkObjectArray doesn't contain the right objects.
* The exception will contain the expected object(s).
*/
public DhApiResult<Void> overwriteChunkDataAsync(IDhApiLevelWrapper levelWrapper, Object[] chunkObjectArray) throws ClassCastException;
@@ -34,8 +34,8 @@ public interface IDhApiEventInjector extends IDependencyInjector<IDhApiEvent>
/**
* Unlinks the given event handler, preventing the handler from being called in the future.
*
* @throws IllegalArgumentException if the implementation object doesn't implement the interface
* @return true if the handler was unbound, false if the handler wasn't bound.
* @throws IllegalArgumentException if the implementation object doesn't implement the interface
*/
// Note to self: Don't try adding a generic type to IDhApiEvent, the constructor won't accept it
boolean unbind(Class<? extends IDhApiEvent> dependencyInterface, Class<? extends IDhApiEvent> dependencyClassToRemove) throws IllegalArgumentException;
@@ -46,8 +46,8 @@ public interface IDhApiEventInjector extends IDependencyInjector<IDhApiEvent>
*
* @param abstractEvent event type
* @param eventParameterObject event parameter
* @return if any of bound event handlers returned that this event should be canceled.
* @param <T> the parameter type taken by the event handlers.
* @return if any of bound event handlers returned that this event should be canceled.
*/
<T, U extends IDhApiEvent<T>> boolean fireAllEvents(Class<U> abstractEvent, T eventParameterObject);
@@ -46,9 +46,9 @@ public abstract class AbstractDhApiChunkWorldGenerator implements Closeable, IDh
// TODO what does this mean?
int genChunkWidth = BitShiftUtil.powerOfTwo(granularity - 4);
for (int chunkX = chunkPosMinX; chunkX < chunkPosMinX+genChunkWidth; chunkX++)
for (int chunkX = chunkPosMinX; chunkX < chunkPosMinX + genChunkWidth; chunkX++)
{
for (int chunkZ = chunkPosMinZ; chunkZ< chunkPosMinZ+genChunkWidth; chunkZ++)
for (int chunkZ = chunkPosMinZ; chunkZ < chunkPosMinZ + genChunkWidth; chunkZ++)
{
Object[] rawMcObjectArray = this.generateChunk(chunkX, chunkZ, generatorMode);
resultConsumer.accept(rawMcObjectArray);
@@ -60,10 +60,10 @@ public abstract class AbstractDhApiChunkWorldGenerator implements Closeable, IDh
/**
* This method is called to generate terrain over a given area
* from a thread defined by Distant Horizons. <br><br>
*
* See {@link IDhApiWorldGenerator#generateChunks(int, int, byte, byte, EDhApiDistantGeneratorMode, ExecutorService, Consumer) IDhApiWorldGenerator.generateChunks}
*
* See {@link IDhApiWorldGenerator#generateChunks(int, int, byte, byte, EDhApiDistantGeneratorMode, ExecutorService, Consumer) IDhApiWorldGenerator.generateChunks}
* for the list of Object's this method should return along with additional documentation.
*
*
* @see IDhApiWorldGenerator#generateChunks(int, int, byte, byte, EDhApiDistantGeneratorMode, ExecutorService, Consumer) IDhApiWorldGenerator#generateChunks
*/
public abstract Object[] generateChunk(int chunkPosX, int chunkPosZ, EDhApiDistantGeneratorMode generatorMode);
@@ -30,10 +30,10 @@ public interface IDhApiWorldGenerator extends Closeable, IDhApiOverrideable
* Minimum detail level is 0 (1 block) <br>
* Default detail level is 0 <br>
* For more information on what detail levels represent see: {@link EDhApiDetailLevel}. <br><br>
*
*
* TODO: System currently only supports 1x1 block per data.
*
* @see EDhApiDetailLevel
*
* @see EDhApiDetailLevel
*/
default byte getSmallestDataDetailLevel() { return EDhApiDetailLevel.BLOCK.detailLevel; }
/**
@@ -41,32 +41,32 @@ public interface IDhApiWorldGenerator extends Closeable, IDhApiOverrideable
* Minimum detail level is 0 (1 block) <br>
* Default detail level is 0 <br>
* For more information on what detail levels represent see: {@link EDhApiDetailLevel}.
*
* @see EDhApiDetailLevel
*
* @see EDhApiDetailLevel
*/
default byte getLargestDataDetailLevel() { return EDhApiDetailLevel.BLOCK.detailLevel; }
/**
* When creating generation requests the system will attempt to group nearby tasks together. <br><br>
* What is the minimum size a single generation call can batch together? <br>
*
*
* Minimum detail level is 4 (the size of a MC chunk) <br>
* Default detail level is 4 <br>
* For more information on what detail levels represent see: {@link EDhApiDetailLevel}.
*
* @see EDhApiDetailLevel
*
* @see EDhApiDetailLevel
*/
default byte getMinGenerationGranularity() { return EDhApiDetailLevel.CHUNK.detailLevel; }
/**
* When creating generation requests the system will attempt to group nearby tasks together. <br><br>
* What is the maximum size a single generation call can batch together? <br>
*
*
* Minimum detail level is 4 (the size of a MC chunk) <br>
* Default detail level is 6 (4x4 chunks) <br>
* For more information on what detail levels represent see: {@link EDhApiDetailLevel}.
*
* @see EDhApiDetailLevel
*
* @see EDhApiDetailLevel
*/
default byte getMaxGenerationGranularity() { return (byte) (EDhApiDetailLevel.CHUNK.detailLevel + 2); }
@@ -82,19 +82,20 @@ public interface IDhApiWorldGenerator extends Closeable, IDhApiOverrideable
/**
* This method is called by Distant Horizons to generate terrain over a given area. <br><br>
*
* After a chunk has been generated it (and any necessary supporting objects as listed below) should be passed into the
*
* After a chunk has been generated it (and any necessary supporting objects as listed below) should be passed into the
* resultConsumer's {@link Consumer#accept} method. If the Consumer is given the wrong data
* type(s) it will disable the world generator and log an error with a list of objects it was expecting. <br>
* <strong>Note:</strong> these objects are minecraft version dependent and will change without notice!
* Please run your generator in game at least once to confirm the objects you are returning are correct. <br><br>
*
*
* Consumer expected inputs for each minecraft version (in order): <br>
* <strong>1.18:</strong> [net.minecraft.world.level.chunk.ChunkAccess] and [net.minecraft.world.level.LevelReader] <br>
* <strong>1.19:</strong> [net.minecraft.world.level.chunk.ChunkAccess] and [net.minecraft.world.level.LevelReader] <br>
* <strong>1.20:</strong> [net.minecraft.world.level.chunk.ChunkAccess] and [net.minecraft.world.level.LevelReader] <br>
*/
CompletableFuture<Void> generateChunks(int chunkPosMinX, int chunkPosMinZ,
CompletableFuture<Void> generateChunks(
int chunkPosMinX, int chunkPosMinZ,
byte granularity, byte targetDataDetail, EDhApiDistantGeneratorMode generatorMode,
ExecutorService worldGeneratorThreadPool, Consumer<Object[]> resultConsumer);
@@ -23,24 +23,24 @@ import com.seibel.distanthorizons.api.objects.DhApiResult;
/**
* Used to interact with Distant Horizons' rendering system.
*
*
* @author James Seibel
* @version 2023-2-8
*/
public interface IDhApiRenderProxy
{
/**
/**
* Forces any cached render data to be deleted and regenerated.
* This is generally called whenever resource packs are changed or specific
* rendering settings are changed in Distant Horizon's config. <Br><Br>
*
*
* If this is called on a dedicated server it won't do anything and will return {@link DhApiResult#success} = false <Br><Br>
*
*
* Background: <Br>
* Distant Horizons has two different file formats: Full data and Render data. <Br>
* - Full data files store the block, biome, etc. information and is the result of loading or generating new chunks. <Br>
* - Render data files store LOD colors and are created using the Full data and currently loaded resource packs. <Br>
* This is the data cleared by this method.
* This is the data cleared by this method.
*/
DhApiResult<Boolean> clearRenderDataCache();
@@ -25,7 +25,7 @@ import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiLevelType;
/**
* Can be either a Server or Client level.<br>
* A level is equivalent to a dimension in vanilla Minecraft.
*
*
* @author James Seibel
* @version 2022-7-14
*/
@@ -42,7 +42,7 @@ public interface IDhApiLevelWrapper extends IDhApiUnsafeWrapper
/** Returns the max block height of the level(?) */
int getHeight();
/**
/**
* Returns the lowest possible block position for the level. <br>
* For MC versions before 1.18 this will return 0.
*/
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.api.interfaces.world;
/**
* Used to interact with Distant Horizons' current world. <br>
* A world is equivalent to a single server connection or a singleplayer world.
*
*
* @author James Seibel
* @version 2022-11-20
*/
@@ -32,10 +32,10 @@ public interface IDhApiWorldProxy
boolean worldLoaded();
/**
/**
* In singleplayer this will return the level the player is currently in. <br>
* In multiplayer this will return null.
*
*
* @throws IllegalStateException if no world is loaded
*/
IDhApiLevelWrapper getSinglePlayerLevel() throws IllegalStateException;
@@ -43,18 +43,18 @@ public interface IDhApiWorldProxy
/** @throws IllegalStateException if no world is loaded */
Iterable<IDhApiLevelWrapper> getAllLoadedLevelWrappers() throws IllegalStateException;
/**
/**
* In the case of servers running multiverse there may be multiple levels for the same dimensionType.
*
* @throws IllegalStateException if no world is loaded
* @throws IllegalStateException if no world is loaded
*/
Iterable<IDhApiLevelWrapper> getAllLoadedLevelsForDimensionType(IDhApiDimensionTypeWrapper dimensionTypeWrapper) throws IllegalStateException;
/**
* Returns any dimensions that have names containing the given string (case-insensitive). <br>
* In the case of servers running multiverse there may be multiple levels for the same dimensionType.
* In the case of servers running multiverse there may be multiple levels for the same dimensionType.
*
* @throws IllegalStateException if no world is loaded
* @throws IllegalStateException if no world is loaded
*/
Iterable<IDhApiLevelWrapper> getAllLoadedLevelsWithDimensionNameLike(String dimensionName) throws IllegalStateException;
@@ -30,7 +30,7 @@ public class DhApiEventRegister
return DhApiResult.createFail(e.getMessage());
}
}
/**
* Unregisters the given event handler for this event if one has been registered. <br>
* If no eventHandler of the given class has been registered the result will return
@@ -6,7 +6,7 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
/**
* Fired after Distant Horizons finishes running its setup.
*
*
* @author James Seibel
* @version 2023-6-23
*/
@@ -8,10 +8,10 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
* Fired after Distant Horizons finishes rendering a frame. <br>
* At this point DH will have also finished cleaning up any modifications it
* did to the OpenGL state, so the state should be back to Minecraft's defaults.
*
* @see DhApiRenderParam
*
* @author James Seibel
* @version 2023-6-23
* @see DhApiRenderParam
*/
public abstract class DhApiAfterRenderEvent implements IDhApiEvent<DhApiAfterRenderEvent.EventParam>
{
@@ -37,6 +37,7 @@ public abstract class DhApiAfterRenderEvent implements IDhApiEvent<DhApiAfterRen
{
super(parent.mcProjectionMatrix, parent.mcModelViewMatrix, parent.dhProjectionMatrix, parent.dhModelViewMatrix, parent.partialTicks);
}
}
}
@@ -6,7 +6,7 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
/**
* Fired before Distant Horizons starts running its mod loader setup. <br>
* IE this is called before Forge's initClient/initServer or Fabric's init method.
*
*
* @author James Seibel
* @version 2023-6-23
*/
@@ -7,7 +7,7 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
/**
* Called before Distant Horizons starts rendering a frame. <br>
* Canceling the event will prevent DH from rendering that frame.
*
*
* @author James Seibel
* @version 2023-6-23
*/
@@ -35,6 +35,7 @@ public abstract class DhApiBeforeRenderEvent implements IDhApiCancelableEvent<Dh
{
super(parent.mcProjectionMatrix, parent.mcModelViewMatrix, parent.dhProjectionMatrix, parent.dhModelViewMatrix, parent.partialTicks);
}
}
}
@@ -10,10 +10,10 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
* that a Minecraft chunk has been modified. <br>
* By the time this event has been fired, the chunk modification should have propagated
* to DH's full data source, but may not have been updated in the render data source.
*
* @see IDhApiTerrainDataRepo
*
* @author James Seibel
* @version 2023-6-23
* @see IDhApiTerrainDataRepo
*/
public abstract class DhApiChunkModifiedEvent implements IDhApiEvent<DhApiChunkModifiedEvent.EventParam>
{
@@ -41,15 +41,16 @@ public abstract class DhApiChunkModifiedEvent implements IDhApiEvent<DhApiChunkM
/** the modified chunk's X pos in chunk coordinates */
public final int chunkX;
/** the modified chunk's Z pos in chunk coordinates */
public final int chunkZ;
public final int chunkZ;
public EventParam(IDhApiLevelWrapper newLevelWrapper, int chunkX, int chunkZ)
public EventParam(IDhApiLevelWrapper newLevelWrapper, int chunkX, int chunkZ)
{
this.levelWrapper = newLevelWrapper;
this.levelWrapper = newLevelWrapper;
this.chunkX = chunkX;
this.chunkZ = chunkZ;
}
}
}
@@ -7,7 +7,7 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
/**
* Called after Distant Horizons finishes loading a new level. <br>
* Note: this may be fired before Minecraft has loaded in the player.
*
*
* @author James Seibel
* @version 2023-6-23
*/
@@ -35,6 +35,7 @@ public abstract class DhApiLevelLoadEvent implements IDhApiEvent<DhApiLevelLoadE
public final IDhApiLevelWrapper levelWrapper;
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
}
}
@@ -7,7 +7,7 @@ import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhAp
/**
* Called after Distant Horizons has finished unloading a level.
*
*
* @author James Seibel
* @version 2023-6-23
*/
@@ -35,6 +35,7 @@ public abstract class DhApiLevelUnloadEvent implements IDhApiEvent<DhApiLevelUnl
public final IDhApiLevelWrapper levelWrapper;
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
}
}
@@ -3,7 +3,7 @@ package com.seibel.distanthorizons.api.methods.events.interfaces;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiCancelableEventParam;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
/**
/**
* If a {@link IDhApiEvent} implements this interface than the event
* can be canceled via the {@link DhApiCancelableEventParam#cancelEvent()} method.
*
@@ -17,13 +17,13 @@ public interface IDhApiCancelableEvent<T> extends IDhApiEvent<T>
/**
* <strong> Shouldn't be called. </strong> <br><br>
*
*
* The {@link IDhApiCancelableEvent#fireEvent(DhApiCancelableEventParam)} method should be used instead.
* This override method is present to prevent API users from having to implement it themselves.
*
*
* @deprecated marked as deprecated to warn that this method shouldn't be used. <br>
* <strong>DH Internal Note:</strong> Is there a better way to format the {@link IDhApiEvent} classes so we don't need this method?
* It would be better to completely hide this method so it isn't possible to accidentally call.
* <strong>DH Internal Note:</strong> Is there a better way to format the {@link IDhApiEvent} classes so we don't need this method?
* It would be better to completely hide this method so it isn't possible to accidentally call.
*/
@Deprecated
@Override
@@ -31,7 +31,7 @@ public interface IDhApiCancelableEvent<T> extends IDhApiEvent<T>
{
if (!input.getClass().isAssignableFrom(DhApiCancelableEventParam.class))
{
throw new IllegalArgumentException("Programmer error. ["+IDhApiCancelableEvent.class.getSimpleName()+"] was given a ["+DhApiEventParam.class.getSimpleName()+"] when it should only be given a ["+DhApiCancelableEventParam.class.getSimpleName()+"].");
throw new IllegalArgumentException("Programmer error. [" + IDhApiCancelableEvent.class.getSimpleName() + "] was given a [" + DhApiEventParam.class.getSimpleName() + "] when it should only be given a [" + DhApiCancelableEventParam.class.getSimpleName() + "].");
}
this.fireEvent((DhApiCancelableEventParam<T>) input);
@@ -5,9 +5,8 @@ import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindab
/**
* The interface used by all DH Api events.
*
*
* @param <T> This is the datatype that will be passed into the event handler's method.
*
* @author James Seibel
* @version 2023-6-23
*/
@@ -3,7 +3,7 @@ package com.seibel.distanthorizons.api.methods.events.interfaces;
/**
* If a {@link IDhApiEvent} implements this interface then the event will only ever be fired once. <Br>
* An example of this would be initial setup methods, DH won't run its initial setup more than once. <br><br>
*
*
* If a handler is bound to a one time event after the event has been fired, the handler will immediately fire.
*/
public interface IDhApiOneTimeEvent<T> extends IDhApiEvent<T>
@@ -9,6 +9,7 @@ public interface IDhServerMessageReceived<T> extends IDhApiEvent<T>
{
/**
* Triggered when a plugin message is received from the server.
*
* @param channel The name of the channel this was received on.
* @param message The message sent from the server.
*/
@@ -1,4 +1,5 @@
/**
* Holds objects and methods for listening to events fired by Distant Horizons'.
*/
package com.seibel.distanthorizons.api.methods.events;
@@ -16,7 +16,7 @@ public class DhApiWorldGeneratorOverrideRegister implements IDhApiWorldGenerator
{
public static DhApiWorldGeneratorOverrideRegister INSTANCE = new DhApiWorldGeneratorOverrideRegister();
private DhApiWorldGeneratorOverrideRegister() { }
private DhApiWorldGeneratorOverrideRegister() { }
@@ -1,4 +1,5 @@
/**
* The override api package holds objects and methods for overriding Distant Horizons' backend systems, so they can be replaced or improved.
*/
package com.seibel.distanthorizons.api.methods.override;
@@ -2,9 +2,8 @@ package com.seibel.distanthorizons.api.objects;
/**
* Allows for more descriptive non-critical failure states.
*
* @param <T> The payload type this result contains, can be Void if the result is just used to notify success/failure.
*
*
* @param <T> The payload type this result contains, can be Void if the result is just used to notify success/failure.
* @author James Seibel
* @version 2022-11-24
*/
@@ -19,9 +18,9 @@ public class DhApiResult<T>
*/
public final String message;
/**
/**
* Whatever object the API Method generated/returned. <br>
* Will be null/Void if this result is just used to notify success/failure.
* Will be null/Void if this result is just used to notify success/failure.
*/
public final T payload;
@@ -33,7 +32,7 @@ public class DhApiResult<T>
{
this.success = success;
// don't allow null messages, in the case of a null message return the empty string to prevent potential null pointers
this.message = (message == null) ? "" : message;
this.message = (message == null) ? "" : message;
this.payload = payload;
}
@@ -14,7 +14,6 @@ import com.seibel.distanthorizons.coreapi.util.converters.DefaultConverter;
*
* @param <apiType> The datatype you, an API dev will use.
* @param <coreType> The datatype Distant Horizons uses in the background; implementing developers can ignore this.
*
* @author James Seibel
* @version 2022-6-30
*/
@@ -6,15 +6,15 @@ import com.seibel.distanthorizons.coreapi.util.math.Vec3i;
/**
* Holds a single datapoint of terrain data
* and the block position from the raycast.
*
*
* @author James Seibel
* @version 2022-11-19
*/
public class DhApiRaycastResult
{
/**
/**
* LOD position of this raycast. <br><br>
*
*
* <strong>Note: </strong>
* This will NOT be the exact block position if the LOD the ray
* hits is more than one block tall. In that case this will
@@ -5,7 +5,7 @@ import com.seibel.distanthorizons.api.interfaces.block.IDhApiBlockStateWrapper;
/**
* Holds a single datapoint of terrain data.
*
*
* @author James Seibel
* @version 2022-11-13
*/
@@ -20,9 +20,9 @@
package com.seibel.distanthorizons.api.objects.math;
/**
* Often used to store block positions or any other
* Often used to store block positions or any other
* position in 3D space.
*
*
* @author James Seibel
* @version 2022-11-19
*/
@@ -1,7 +1,8 @@
/**
* <strong> Start Here </strong> <br>
* {@link com.seibel.distanthorizons.api.DhApi} has almost every method you would want. <br><br>
*
*
* This package contains every method and object that is safe to use within the API.
*/
package com.seibel.distanthorizons.api;
@@ -46,7 +46,7 @@ public class ApiEventInjector extends DependencyInjector<IDhApiEvent> implements
private ApiEventInjector() { super(IDhApiEvent.class, true); }
@SuppressWarnings("unchecked")
@Override
public void bind(Class<? extends IDhApiEvent> abstractEvent, IDhApiEvent eventImplementation) throws IllegalStateException, IllegalArgumentException
@@ -76,7 +76,7 @@ public class ApiEventInjector extends DependencyInjector<IDhApiEvent> implements
{
// make sure the given dependency implements the necessary interfaces
boolean implementsInterface = this.checkIfClassImplements(eventClassToRemove, abstractEvent) ||
this.checkIfClassExtends(eventClassToRemove, abstractEvent);
this.checkIfClassExtends(eventClassToRemove, abstractEvent);
boolean implementsBindable = this.checkIfClassImplements(eventClassToRemove, this.bindableInterface);
// display any errors
@@ -95,7 +95,7 @@ public class ApiEventInjector extends DependencyInjector<IDhApiEvent> implements
{
ArrayList<IDhApiEvent> dependencyList = this.dependencies.get(abstractEvent);
int indexToRemove = -1;
for(int i = 0; i < dependencyList.size(); i++)
for (int i = 0; i < dependencyList.size(); i++)
{
IBindable dependency = dependencyList.get(i);
if (dependency.getClass().equals(eventClassToRemove))
@@ -120,7 +120,7 @@ public class ApiEventInjector extends DependencyInjector<IDhApiEvent> implements
{
// if this is a one time event, record that it was called
if (IDhApiOneTimeEvent.class.isAssignableFrom(abstractEventClass) &&
!this.firedOneTimeEventParamsByEventInterface.containsKey(abstractEventClass))
!this.firedOneTimeEventParamsByEventInterface.containsKey(abstractEventClass))
{
this.firedOneTimeEventParamsByEventInterface.put(abstractEventClass, eventInput);
}
@@ -70,7 +70,7 @@ public class DependencyInjector<BindableType extends IBindable> implements IDepe
// make sure the given dependency implements the necessary interfaces
boolean implementsInterface = this.checkIfClassImplements(dependencyImplementation.getClass(), dependencyInterface) ||
this.checkIfClassExtends(dependencyImplementation.getClass(), dependencyInterface);
this.checkIfClassExtends(dependencyImplementation.getClass(), dependencyInterface);
boolean implementsBindable = this.checkIfClassImplements(dependencyImplementation.getClass(), this.bindableInterface);
// display any errors
@@ -35,7 +35,7 @@ import java.util.HashMap;
public class OverrideInjector implements IOverrideInjector<IDhApiOverrideable>
{
public static final OverrideInjector INSTANCE = new OverrideInjector();
private final HashMap<Class<? extends IDhApiOverrideable>, OverridePriorityListContainer> overrideContainerByInterface = new HashMap<>();
@@ -61,7 +61,7 @@ public class OverrideInjector implements IOverrideInjector<IDhApiOverrideable>
@Override
public void bind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException
public void bind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException
{
// make sure a override container exists
OverridePriorityListContainer overrideContainer = this.overrideContainerByInterface.get(dependencyInterface);
@@ -7,8 +7,8 @@ import java.util.ArrayList;
/**
* Contains a list of overrides and their priorities.
*
* @author James Seibel
*
* @author James Seibel
* @version 2022-9-5
*/
public class OverridePriorityListContainer implements IBindable
@@ -98,7 +98,7 @@ public class OverridePriorityListContainer implements IBindable
// utils //
/** sort the list so the highest priority item is first in the list */
private void sortList() { this.overridePairList.sort((x,y) -> Integer.compare(y.priority, x.priority)); }
private void sortList() { this.overridePairList.sort((x, y) -> Integer.compare(y.priority, x.priority)); }
@@ -112,5 +112,7 @@ public class OverridePriorityListContainer implements IBindable
this.override = newOverride;
this.priority = newPriority;
}
}
}
@@ -29,6 +29,7 @@ import java.util.HashMap;
/**
* This class takes care of dependency injection for world generators. <Br>
* This is done so other mods can override our world generator(s) to improve or replace them.
*
* @author James Seibel
* @version 2022-12-10
*/
@@ -65,10 +66,9 @@ public class WorldGeneratorInjector
/**
* Binds a world generator to the given level. <Br>
* See {@link DependencyInjector#bind(Class, IBindable) bind(Class, IBindable)} for full documentation.
*
*
* @throws NullPointerException if any parameter is null
* @throws IllegalArgumentException if a non-Distant Horizons world generator with the priority CORE is passed in
*
* @see DependencyInjector#bind(Class, IBindable)
*/
public void bind(IDhApiLevelWrapper levelForWorldGenerator, IDhApiWorldGenerator worldGeneratorImplementation) throws NullPointerException, IllegalArgumentException
@@ -98,8 +98,9 @@ public class WorldGeneratorInjector
/**
* Returns the bound world generator with the highest priority. <br>
* Returns null if no world generators have been bound for this specific level. <br><br>
*
*
* See {@link OverrideInjector#get(Class) get(Class)} for full documentation.
*
* @see OverrideInjector#get(Class)
*/
public IDhApiWorldGenerator get(IDhApiLevelWrapper levelForWorldGenerator) throws ClassCastException
@@ -19,8 +19,8 @@
package com.seibel.distanthorizons.coreapi;
/**
* This file is similar to mcmod.info
/**
* This file is similar to mcmod.info
* and contains most meta-information related to Distant Horizons.
*/
public final class ModInfo
@@ -37,7 +37,7 @@ public final class ModInfo
public static final String VERSION = "2.0.0-a-dev";
/** Returns true if the current build is an unstable developer build, false otherwise. */
public static boolean IS_DEV_BUILD = VERSION.toLowerCase().contains("dev");
/** This version should only be updated when breaking changes are introduced to the DH API */
public static final int API_MAJOR_VERSION = 1;
/** This version should be updated whenever new methods are added to the DH API */
@@ -45,7 +45,7 @@ public final class ModInfo
/** This version should be updated whenever non-breaking fixes are added to the DH API */
public static final int API_PATH_VERSION = 0;
public static final String NETWORKING_RESOURCE_NAMESPACE = "distant_horizons";
public static final String NETWORKING_RESOURCE_NAMESPACE = "distant_horizons";
public static final String MULTIVERSE_PLUGIN_NAMESPACE = "world_control";
@@ -10,50 +10,50 @@ package com.seibel.distanthorizons.coreapi.interfaces.config;
public interface IConfigEntry<T>
{
/** Gets the default value of the option */
T getDefaultValue();
/** Gets the default value of the option */
T getDefaultValue();
void setApiValue(T newApiValue);
T getApiValue();
void setApiValue(T newApiValue);
T getApiValue();
/** Returns true if this config can be set via the API. */
boolean getAllowApiOverride();
void set(T newValue);
T get();
T getTrueValue();
void set(T newValue);
T get();
T getTrueValue();
/** Sets the value without saving */
void setWithoutSaving(T newValue);
/** Sets the value without saving */
void setWithoutSaving(T newValue);
/** Gets the min value */
T getMin();
/** Sets the min value */
void setMin(T newMin);
/** Gets the max value */
T getMax();
/** Sets the max value */
void setMax(T newMax);
/** Sets the min and max in 1 setter */
void setMinMax(T newMin, T newMax);
/** Gets the min value */
T getMin();
/** Sets the min value */
void setMin(T newMin);
/** Gets the max value */
T getMax();
/** Sets the max value */
void setMax(T newMax);
/** Sets the min and max in 1 setter */
void setMinMax(T newMin, T newMax);
/** Gets the comment */
String getComment();
/** Sets the comment */
void setComment(String newComment);
/** Gets the comment */
String getComment();
/** Sets the comment */
void setComment(String newComment);
/**
* Checks if the option is valid
*
* 0 == valid
* 1 == number too high
* -1 == number too low
*/
byte isValid();
/** Checks if a value is valid */
byte isValid(T value);
/**
* Checks if the option is valid
*
* 0 == valid
* 1 == number too high
* -1 == number too low
*/
byte isValid();
/** Checks if a value is valid */
byte isValid(T value);
/** Is the value of this equal to another */
boolean equals(IConfigEntry<?> obj);
/** Is the value of this equal to another */
boolean equals(IConfigEntry<?> obj);
}
@@ -16,12 +16,12 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection;
/**
* Necessary for all singletons that can be dependency injected.
*
*
* @author James Seibel
* @version 2022-7-16
*/
@@ -29,12 +29,12 @@ public interface IBindable
{
/**
* Finish initializing this object. <br> <br>
*
*
* Generally this should just be used for getting other objects through
* dependency injection and is specifically designed to allow
* dependency injection and is specifically designed to allow
* for circular references. <br><br>
*
* If no circular dependencies are required this method
*
* If no circular dependencies are required this method
* doesn't have to be implemented.
*/
default void finishDelayedSetup() { }
@@ -30,19 +30,18 @@ public interface IDependencyInjector<BindableType extends IBindable>
*
* @see #get(Class, boolean)
*/
@SuppressWarnings("unchecked")
<T extends BindableType> T get(Class<T> interfaceClass) throws ClassCastException;
@SuppressWarnings("unchecked") <T extends BindableType> T get(Class<T> interfaceClass) throws ClassCastException;
/**
* Returns all dependencies of type T that have been bound. <br>
* Returns an empty list if no dependencies have been bound.
*
* @param <T> class of the dependency
* (inferred from the objectClass parameter)
* (inferred from the objectClass parameter)
* @param interfaceClass Interface of the dependency
* @return the dependency of type T
* @throws ClassCastException If the dependency isn't able to be cast to type T.
* (this shouldn't normally happen, unless the bound object changed somehow)
* (this shouldn't normally happen, unless the bound object changed somehow)
*/
<T extends BindableType> ArrayList<T> getAll(Class<T> interfaceClass) throws ClassCastException;
@@ -53,15 +52,14 @@ public interface IDependencyInjector<BindableType extends IBindable>
* If the handler allows duplicate bindings, this will return the first bound dependency.
*
* @param <T> class of the dependency
* (inferred from the interfaceClass parameter)
* (inferred from the interfaceClass parameter)
* @param interfaceClass Interface of the dependency
* @param allowIncompleteDependencies If true this method will also return dependencies that haven't completed their delayed setup.
* @return the dependency of type T
* @throws ClassCastException If the dependency isn't able to be cast to type T.
* (this shouldn't normally happen, unless the bound object changed somehow)
* (this shouldn't normally happen, unless the bound object changed somehow)
*/
@SuppressWarnings("unchecked")
<T extends BindableType> T get(Class<T> interfaceClass, boolean allowIncompleteDependencies) throws ClassCastException;
@SuppressWarnings("unchecked") <T extends BindableType> T get(Class<T> interfaceClass, boolean allowIncompleteDependencies) throws ClassCastException;
@@ -72,4 +70,5 @@ public interface IDependencyInjector<BindableType extends IBindable>
/** Runs delayed setup for any dependencies that require it. */
void runDelayedSetup();
}
@@ -27,7 +27,7 @@ public interface IOverrideInjector<BindableType extends IBindable>
* @throws IllegalStateException if another override with the given priority already has been bound.
* @see IDependencyInjector#bind(Class, IBindable)
*/
void bind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException;
void bind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException;
/**
* Returns the bound dependency with the highest priority. <br>
@@ -1,11 +1,12 @@
/**
* <strong> Only For Internal Use </strong> <br> <!-- don't appear -->
* Everything in here for DH internally use. <br><br>
*
*
* You can use objects and methods from here if you want, (I'm a javaDoc, not the cops)
* but using anything from this package is unsupported and may change at any time. <br><br>
*
*
* When in doubt, if a method starts with "DhApi" it is safe to use, and we will
* do our best to avoid breaking changes.
*/
package com.seibel.distanthorizons.coreapi;
@@ -3,20 +3,20 @@ package com.seibel.distanthorizons.coreapi.util;
/**
* A list of helper methods to make code easier to read. <br>
* Specifically written because bit shifts short circuit James' brain.
*
*
* @author James Seibel
* @version 2022-11-6
*/
public class BitShiftUtil
{
/**
/**
* Equivalent to: <br>
* {@literal 1 << value0, } <br>
* 2^value, <br>
* Math.pow(2, value) <br><br>
*
*
* Note: Math.pow() isn't identical for large values where bits would be lost in the shift, however for medium to small values they function the same. <br><br>
*
*
* Can also be used to replace bit shifts in the format: <br>
* {@literal multiplier << value; } <br>
* multiplier * powerOfTwo(value);
@@ -30,7 +30,7 @@ public class BitShiftUtil
* Equivalent to: <br>
* value >> 1, <br>
* value / 2 <br><br>
*
*
* Note: value / 2 isn't identical for negative values
*/
public static int half(int value) { return value >> 1; }
@@ -42,7 +42,7 @@ public class BitShiftUtil
* Equivalent to: <br>
* value >> power, <br>
* value / 2^power <br><br>
*
*
* Note: value / 2^power isn't identical for negative values
*/
public static int divideByPowerOfTwo(int value, int power) { return value >> power; }
@@ -55,7 +55,7 @@ public class BitShiftUtil
* {@literal value << 1, } <br>
* value^2, <br>
* Math.pow(value, 2) <br><br>
*
*
* Note: Math.pow() isn't identical for large values where bits would be lost in the shift, however for medium to small values they function the same.
*/
public static int square(int value) { return value << 1; }
@@ -68,7 +68,7 @@ public class BitShiftUtil
* {@literal value << power, } <br>
* value^power, <br>
* Math.pow(value, power) <br><br>
*
*
* Note: Math.pow() isn't identical for large values where bits would be lost in the shift, however for medium to small values they function the same.
*/
public static int pow(int value, int power) { return value << power; }
@@ -49,7 +49,7 @@ public class MathUtil
public static int log2(int numb)
{
// properties of logs allow us to use the base Log_e() method
return (int)(Math.log(numb) / Math.log(2));
return (int) (Math.log(numb) / Math.log(2));
}
}
@@ -36,7 +36,9 @@ public class StringUtil
{
int pos = str.indexOf(substr);
while (--n > 0 && pos != -1)
{
pos = str.indexOf(substr, pos + 1);
}
return pos;
}
@@ -23,4 +23,5 @@ public class DefaultConverter<T> implements IConverter<T, T>
{
return coreObject;
}
}
@@ -24,7 +24,7 @@ import java.nio.FloatBuffer;
/**
* An (almost) exact copy of Minecraft's 1.16.5
* implementation of a 4x4 float matrix.
*
*
* @author James Seibel
* @version 11-11-2021
*/
@@ -394,8 +394,8 @@ public class Mat4f
}
*/
/**
* TODO: what kind of translation is this?
/**
* TODO: what kind of translation is this?
* and how is this different from "multiplyTranslationMatrix"?
* Answer: This is faster and direct (but only if this is pure translation matrix without rotate)
*/
@@ -409,7 +409,7 @@ public class Mat4f
/** originally "translate" from Minecraft's MatrixStack */
public void multiplyTranslationMatrix(double x, double y, double z)
{
multiply(createTranslateMatrix((float)x, (float)y, (float)z));
multiply(createTranslateMatrix((float) x, (float) y, (float) z));
}
public Mat4f copy()
@@ -450,30 +450,31 @@ public class Mat4f
/** Returns the values of this matrix in row major order (AKA rows then columns) */
public float[] getValuesAsArray()
{
return new float[] {
this.m00,
this.m01,
this.m02,
this.m03,
this.m10,
this.m11,
this.m12,
this.m13,
this.m20,
this.m21,
this.m22,
this.m23,
this.m30,
this.m31,
this.m32,
this.m33,
return new float[]{
this.m00,
this.m01,
this.m02,
this.m03,
this.m10,
this.m11,
this.m12,
this.m13,
this.m20,
this.m21,
this.m22,
this.m23,
this.m30,
this.m31,
this.m32,
this.m33,
};
}
public Vec3f asNonNormalizedLookForwardVector() {
public Vec3f asNonNormalizedLookForwardVector()
{
return new Vec3f(this.m02, this.m12, this.m22);
}
@@ -505,7 +506,7 @@ public class Mat4f
{
this(buffer.array());
}
public void set(Mat4f mat)
{
this.m00 = mat.m00;
@@ -563,7 +564,7 @@ public class Mat4f
this.m13 = y;
this.m23 = z;
}
/**
* Changes the values that store the clipping planes.
* Formula for calculating matrix values is the same that OpenGL uses when making matrices.
@@ -571,7 +572,7 @@ public class Mat4f
* @param nearClip New near clipping plane value.
* @param farClip New far clipping plane value.
*/
public void setClipPlanes(float nearClip,float farClip)
public void setClipPlanes(float nearClip, float farClip)
{
//convert to matrix values, formula copied from a textbook / openGL specification.
float matNearClip = -((farClip + nearClip) / (farClip - nearClip));
@@ -22,10 +22,10 @@ package com.seibel.distanthorizons.coreapi.util.math;
import com.seibel.distanthorizons.coreapi.util.MathUtil;
/**
* This is closer to MC's implementation of a
* This is closer to MC's implementation of a
* 3 element float vector than a 3 element double
* vector. Hopefully that shouldn't cause any issues.
*
*
* @author James Seibel
* @version 11-18-2021
*/
@@ -254,4 +254,5 @@ public class Vec3d
this.y = values[1];
this.z = values[2];
}
}
@@ -24,7 +24,7 @@ import com.seibel.distanthorizons.coreapi.util.MathUtil;
/**
* A (almost) exact copy of Minecraft's 1.16.5
* implementation of a 3 element float vector.
*
*
* @author James Seibel
* @version 11-11-2021
*/
@@ -259,4 +259,5 @@ public class Vec3f
this.y = values[1];
this.z = values[2];
}
}
@@ -25,7 +25,7 @@ import com.seibel.distanthorizons.api.objects.math.DhApiVec3i;
/**
* A (almost) exact copy of Minecraft's 1.16.5
* implementation of a 3 element integer vector.
*
*
* @author James Seibel
* @version 2022-11-19
*/
@@ -134,8 +134,8 @@ public class Vec3i extends DhApiVec3i // extends the API object so it can be ret
public Vec3i cross(Vec3i otherVec)
{
return new Vec3i(
(this.y * otherVec.z) - (this.z * otherVec.y),
(this.z * otherVec.x) - (this.x * otherVec.z),
(this.y * otherVec.z) - (this.z * otherVec.y),
(this.z * otherVec.x) - (this.x * otherVec.z),
(this.x * otherVec.y) - (this.y * otherVec.x));
}
@@ -25,7 +25,7 @@ public abstract class AbstractDhApiCancelableOneTimeTestEvent implements IDhApiC
//=========================//
@Override
public final void fireEvent(DhApiCancelableEventParam<Boolean> input)
public final void fireEvent(DhApiCancelableEventParam<Boolean> input)
{
this.onTestEvent(input);
if (input.value)
@@ -133,7 +133,7 @@ public class EventInjectorTest
oneTimeEventList = TEST_EVENT_HANDLER.getAll(AbstractDhApiCancelableOneTimeTestEvent.class);
for (int i = 0; i < oneTimeEventList.size(); i++)
{
Assert.assertEquals("Event not fired for object ["+i+"].", true, oneTimeEventList.get(i).getTestValue());
Assert.assertEquals("Event not fired for object [" + i + "].", true, oneTimeEventList.get(i).getTestValue());
}
+1 -1
View File
@@ -24,7 +24,7 @@ import org.junit.Test;
/**
* This is just a quick demo to confirm the testing system is set up correctly.
*
*
* @author James Seibel
* @version 2022-9-5
*/
@@ -23,7 +23,7 @@ import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindab
/**
* A singleton used to get variables from methods
* where they are private or potentially absent.
* where they are private or potentially absent.
* Specifically the fog setting used by Optifine or the
* presence/absence of other mods.
* <p>
@@ -32,7 +32,7 @@ import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindab
* passing in interfaces), and it may be needed in the future if
* we find that reflection handlers need to be different for
* different MC versions.
*
*
* @author James Seibel
* @version 2022-11-24
*/
@@ -40,7 +40,7 @@ public interface IReflectionHandler extends IBindable
{
/** @return if Sodium (or a sodium like) mod is present. */
boolean sodiumPresent();
boolean optifinePresent();
}
@@ -17,9 +17,9 @@ import org.apache.logging.log4j.Logger;
/** Handles first time Core setup. */
public class Initializer
{
private static final Logger LOGGER = LogManager.getLogger(ModInfo.NAME+"-"+Initializer.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger(ModInfo.NAME + "-" + Initializer.class.getSimpleName());
public static void init()
public static void init()
{
// confirm that all referenced libraries are available to use
try
@@ -33,15 +33,15 @@ public class Initializer
}
catch (NoClassDefFoundError e)
{
LOGGER.fatal("Critical programmer error: One or more libraries aren't present. Error: ["+e.getMessage()+"].");
LOGGER.fatal("Critical programmer error: One or more libraries aren't present. Error: [" + e.getMessage() + "].");
throw e;
}
CompleteFullDataSourceLoader unused2 = new CompleteFullDataSourceLoader(); // Auto register into the loader system
HighDetailIncompleteFullDataSourceLoader unused3 = new HighDetailIncompleteFullDataSourceLoader(); // Auto register
LowDetailIncompleteFullDataSourceLoader unused4 = new LowDetailIncompleteFullDataSourceLoader(); // Auto register
CompleteFullDataSourceLoader unused2 = new CompleteFullDataSourceLoader(); // Auto register into the loader system
HighDetailIncompleteFullDataSourceLoader unused3 = new HighDetailIncompleteFullDataSourceLoader(); // Auto register
LowDetailIncompleteFullDataSourceLoader unused4 = new LowDetailIncompleteFullDataSourceLoader(); // Auto register
// link Core's config to the API
DhApi.Delayed.configs = DhApiConfig.INSTANCE;
@@ -49,5 +49,6 @@ public class Initializer
DhApi.Delayed.worldProxy = DhApiWorldProxy.INSTANCE;
DhApi.Delayed.renderProxy = DhApiRenderProxy.INSTANCE;
}
}
}
@@ -26,12 +26,12 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.AbstractOpt
import org.apache.logging.log4j.Logger;
/**
* A singleton used to determine if a class is present or
* access variables from methods where they are private
* A singleton used to determine if a class is present or
* access variables from methods where they are private
* or potentially absent. <br><br>
*
*
* For example: presence/absence of Optifine.
*
*
* @author James Seibel
* @version 2022-11-24
*/
@@ -10,21 +10,21 @@ public class DhApiConfig implements IDhApiConfig
{
public static final DhApiConfig INSTANCE = new DhApiConfig();
private DhApiConfig() { }
private DhApiConfig() { }
@Override
public IDhApiGraphicsConfig graphics() { return DhApiGraphicsConfig.INSTANCE; }
@Override
@Override
public IDhApiWorldGenerationConfig worldGenerator() { return DhApiWorldGenerationConfig.INSTANCE; }
@Override
public IDhApiMultiplayerConfig multiplayer() { return DhApiMultiplayerConfig.INSTANCE; }
@Override
public IDhApiMultiThreadingConfig multiThreading() { return DhApiMultiThreadingConfig.INSTANCE; }
@Override
@Override
public IDhApiGpuBuffersConfig gpuBuffers() { return DhApiGpuBuffersConfig.INSTANCE; }
@Override
@Override
public IDhApiDebuggingConfig debugging() { return DhApiDebuggingConfig.INSTANCE; }
}
@@ -106,7 +106,7 @@ public class DhApiGraphicsConfig implements IDhApiGraphicsConfig
//===========================//
// advanced graphic settings //
//===========================//
// @Override
// public IDhApiConfigValue<Boolean> getDisableDirectionalCulling()
// { return new DhApiConfigValue<Boolean, Boolean>(AdvancedGraphics.disableDirectionalCulling); }
@@ -36,7 +36,7 @@ import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiDistantGenerat
*/
public class DhApiWorldGenerationConfig implements IDhApiWorldGenerationConfig
{
public static DhApiWorldGenerationConfig INSTANCE = new DhApiWorldGenerationConfig();
public static DhApiWorldGenerationConfig INSTANCE = new DhApiWorldGenerationConfig();
private DhApiWorldGenerationConfig() { }
@@ -55,7 +55,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
private DhApiTerrainDataRepo()
private DhApiTerrainDataRepo()
{
}
@@ -67,12 +67,12 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
//================//
@Override
public DhApiResult<DhApiTerrainDataPoint> getSingleDataPointAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosY, int blockPosZ)
public DhApiResult<DhApiTerrainDataPoint> getSingleDataPointAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosY, int blockPosZ)
{
return getTerrainDataAtBlockYPos(levelWrapper, new DhLodPos(LodUtil.BLOCK_DETAIL_LEVEL, blockPosX, blockPosZ), blockPosY);
}
@Override
public DhApiResult<DhApiTerrainDataPoint[]> getColumnDataAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosZ)
public DhApiResult<DhApiTerrainDataPoint[]> getColumnDataAtBlockPos(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosZ)
{
return getTerrainDataColumnArray(levelWrapper, new DhLodPos(LodUtil.BLOCK_DETAIL_LEVEL, blockPosX, blockPosZ), null);
}
@@ -112,14 +112,14 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
}
}
/**
/**
* Returns all the block columns represented by the given {@link DhLodPos}. <br>
* IE, A position with the detail level: <br>
* 0 (block): will return a 1x1 matrix of data. (don't do this, we have a specific method for that.) <br>
* 1 (2 blocks): will return a 2x2 matrix of data. <br>
* 4 (chunk): will return a 16x16 matrix of data. <br> <br>
*
* will stop and return the in progress data if any errors are encountered.
*
* will stop and return the in progress data if any errors are encountered.
*/
private static DhApiResult<DhApiTerrainDataPoint[][][]> getTerrainDataOverAreaForPositionDetailLevel(IDhApiLevelWrapper levelWrapper, DhLodPos requestedAreaPos)
{
@@ -151,10 +151,10 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
return dataColumnsReturned != 0 ? DhApiResult.createSuccess("[" + dataColumnsReturned + "] columns returned.", returnArray) : DhApiResult.createSuccess("No data found.", returnArray);
}
/**
/**
* If nullableBlockYPos is null: returns every datapoint in the column defined by the DhLodPos. <br>
* If nullableBlockYPos is NOT null: returns a single datapoint in the column defined by the DhLodPos which contains the block Y position. <br><br>
*
*
* If the ApiResult is successful there will be an array of data. <br>
* The returned array will be empty if no data could be retrieved.
*/
@@ -170,7 +170,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
{
// custom level wrappers aren't supported,
// the API user must get a level wrapper from our code somewhere
return DhApiResult.createFail("Unsupported ["+IDhApiLevelWrapper.class.getSimpleName()+"] implementation, only the core class ["+ IDhLevel.class.getSimpleName()+"] is a valid parameter.");
return DhApiResult.createFail("Unsupported [" + IDhApiLevelWrapper.class.getSimpleName() + "] implementation, only the core class [" + IDhLevel.class.getSimpleName() + "] is a valid parameter.");
}
ILevelWrapper coreLevelWrapper = (ILevelWrapper) levelWrapper;
@@ -256,7 +256,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
catch (InterruptedException | ExecutionException e)
{
// shouldn't normally happen, but just in case
LOGGER.error("Unexpected exception in getTerrainDataColumnArray. Error: ["+e.getMessage()+"]", e);
LOGGER.error("Unexpected exception in getTerrainDataColumnArray. Error: [" + e.getMessage() + "]", e);
return DhApiResult.createFail("Unexpected exception: [" + e.getMessage() + "].");
}
}
@@ -270,7 +270,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
int height = FullDataPointUtil.getHeight(dataPoint);
int topY = bottomY + height;
return new DhApiTerrainDataPoint(detailLevel,
return new DhApiTerrainDataPoint(detailLevel,
FullDataPointUtil.getLight(dataPoint), topY, bottomY,
blockState, biomeWrapper);
}
@@ -282,7 +282,8 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
//====================//
@Override
public DhApiResult<DhApiRaycastResult> raycast(IDhApiLevelWrapper levelWrapper,
public DhApiResult<DhApiRaycastResult> raycast(
IDhApiLevelWrapper levelWrapper,
double rayOriginX, double rayOriginY, double rayOriginZ,
float rayDirectionX, float rayDirectionY, float rayDirectionZ,
int maxRayBlockLength)
@@ -340,7 +341,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
{
// does this LOD contain the given Y position?
Vec3i dataPointPos = new Vec3i(columnPos.x, dataPoint.bottomYBlockPos, columnPos.z);
if (exactPos.y >= dataPoint.bottomYBlockPos && exactPos.y <= dataPoint.topYBlockPos)
if (exactPos.y >= dataPoint.bottomYBlockPos && exactPos.y <= dataPoint.topYBlockPos)
{
if (closetFoundDataPoint == null)
{
@@ -423,7 +424,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
{
if (!(levelWrapper instanceof ILevelWrapper))
{
return DhApiResult.createFail("Level wrapper needs to be an instance of ["+IDhApiLevelWrapper.class.getSimpleName()+"].");
return DhApiResult.createFail("Level wrapper needs to be an instance of [" + IDhApiLevelWrapper.class.getSimpleName() + "].");
}
AbstractDhWorld dhWorld = SharedApi.getAbstractDhWorld();
if (dhWorld == null)
@@ -452,8 +453,8 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
// debug methods //
//===============//
/**
* This method is here for debugging the repo and isn't intended for normal use.
/**
* This method is here for debugging the repo and isn't intended for normal use.
* The method need to be async because pausing the main thread with a breakpoint and hot swapping will crash the program
*/
public static void asyncDebugMethod(IDhApiLevelWrapper levelWrapper, int blockPosX, int blockPosY, int blockPosZ)
@@ -476,7 +477,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
if (rayCast.payload != null && !rayCast.payload.pos.equals(currentDebugVec3i))
{
currentDebugVec3i = rayCast.payload.pos;
// get a string for the block
String blockString = "[NULL BLOCK]"; // shouldn't normally happen unless there is an issue with getting the terrain at the given position
if (rayCast.payload.dataPoint.blockStateWrapper != null)
@@ -487,10 +488,10 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
}
else
{
blockString = "[AIR]";
blockString = "[AIR]";
}
}
LOGGER.info("raycast: " + currentDebugVec3i + "\t block: " + blockString);
}
else if (rayCast.payload == null && currentDebugVec3i != null)
@@ -504,7 +505,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
}
catch (Exception e)
{
LOGGER.error("Test method Error: ["+e.getMessage()+"]", e);
LOGGER.error("Test method Error: [" + e.getMessage() + "]", e);
}
finally
{
@@ -106,7 +106,7 @@ public class ClientApi
// world events //
//==============//
/**
/**
* May be fired slightly before or after the associated
* {@link ClientApi#clientLevelLoadEvent(IClientLevelWrapper)} event
* depending on how the host mod loader functions.
@@ -123,7 +123,7 @@ public class ClientApi
SharedApi.setDhWorld(new DhClientWorld());
LOGGER.info("Loading ["+this.waitingClientLevels.size()+"] waiting client level wrappers.");
LOGGER.info("Loading [" + this.waitingClientLevels.size() + "] waiting client level wrappers.");
for (IClientLevelWrapper level : this.waitingClientLevels)
{
this.clientLevelLoadEvent(level);
@@ -132,7 +132,7 @@ public class ClientApi
this.waitingClientLevels.clear();
}
}
public void onClientOnlyDisconnected()
{
if (MC.clientConnectedToDedicatedServer())
@@ -141,7 +141,7 @@ public class ClientApi
if (world != null)
{
LOGGER.info("Client on ClientOnly mode disconnecting.");
world.close();
SharedApi.setDhWorld(null);
}
@@ -166,7 +166,7 @@ public class ClientApi
public void clientLevelUnloadEvent(IClientLevelWrapper level)
{
LOGGER.info("Unloading client level ["+level+"].");
LOGGER.info("Unloading client level [" + level + "].");
AbstractDhWorld world = SharedApi.getAbstractDhWorld();
if (world != null)
@@ -191,7 +191,7 @@ public class ClientApi
}
LOGGER.info("Loading "+(isServerCommunication ? "Multiverse" : "")+" client level [" + level + "].");
LOGGER.info("Loading " + (isServerCommunication ? "Multiverse" : "") + " client level [" + level + "].");
AbstractDhWorld world = SharedApi.getAbstractDhWorld();
if (world != null)
@@ -220,7 +220,7 @@ public class ClientApi
keysToRemove.add(levelChunkPair);
}
}
LOGGER.info("Loaded ["+keysToRemove.size()+"] waiting chunk wrappers.");
LOGGER.info("Loaded [" + keysToRemove.size() + "] waiting chunk wrappers.");
for (Pair<IClientLevelWrapper, DhChunkPos> keyToRemove : keysToRemove)
{
@@ -263,8 +263,8 @@ public class ClientApi
{
for (int zOffset = -1; zOffset <= 1; zOffset++)
{
DhChunkPos neighbourPos = new DhChunkPos(chunk.getChunkPos().x+xOffset, chunk.getChunkPos().z+zOffset);
IChunkWrapper neighbourChunk = dhLevel.getLevelWrapper().tryGetChunk(neighbourPos);
DhChunkPos neighbourPos = new DhChunkPos(chunk.getChunkPos().x + xOffset, chunk.getChunkPos().z + zOffset);
IChunkWrapper neighbourChunk = dhLevel.getLevelWrapper().tryGetChunk(neighbourPos);
if (neighbourChunk != null)
{
dhLevel.updateChunkAsync(neighbourChunk);
@@ -282,20 +282,20 @@ public class ClientApi
public void rendererShutdownEvent()
{
LOGGER.info("Renderer shutting down.");
IProfilerWrapper profiler = MC.getProfiler();
profiler.push("DH-RendererShutdown");
profiler.pop();
}
public void rendererStartupEvent()
{
LOGGER.info("Renderer starting up.");
IProfilerWrapper profiler = MC.getProfiler();
profiler.push("DH-RendererStartup");
// make sure the GLProxy is created before the LodBufferBuilder needs it
GLProxy.getInstance();
profiler.pop();
@@ -305,7 +305,7 @@ public class ClientApi
{
IProfilerWrapper profiler = MC.getProfiler();
profiler.push("DH-ClientTick");
boolean doFlush = System.nanoTime() - this.lastFlushNanoTime >= SPAM_LOGGER_FLUSH_NS;
if (doFlush)
{
@@ -314,7 +314,7 @@ public class ClientApi
}
ConfigBasedLogger.updateAll();
ConfigBasedSpamLogger.updateAll(doFlush);
IDhClientWorld clientWorld = SharedApi.getIDhClientWorld();
if (clientWorld != null)
{
@@ -384,7 +384,7 @@ public class ClientApi
short commandLength = byteBuf.readShort();
if (commandLength < 1 || commandLength > 32)
{
LOGGER.error("Server command length ["+commandLength+"] outside the expected range of 1 to 32 (inclusive).");
LOGGER.error("Server command length [" + commandLength + "] outside the expected range of 1 to 32 (inclusive).");
ClientApi.INSTANCE.serverNetworkingIsMalformed = true;
return;
}
@@ -397,7 +397,7 @@ public class ClientApi
}
catch (Exception e)
{
LOGGER.error("Server sent un-parsable command. Error: "+e.getMessage());
LOGGER.error("Server sent un-parsable command. Error: " + e.getMessage());
return;
}
@@ -407,7 +407,7 @@ public class ClientApi
LOGGER.info("Server supports DH multiverse protocol.");
ClientApi.INSTANCE.isServerCommunicationEnabled = true;
KEYED_CLIENT_LEVEL_MANAGER.setUseOverrideWrapper(true);
MC.executeOnRenderThread(() ->
MC.executeOnRenderThread(() ->
{
// Unload the current world, since it may be wrong.
// A followup WorldChanged event should be received from the server soon after this.
@@ -420,7 +420,7 @@ public class ClientApi
short levelKeyLength = byteBuf.readShort();
if (levelKeyLength < 1 || levelKeyLength > 128) // TODO 128 should be put into a constant somewhere
{
LOGGER.error("Server [LevelChanged] command length ["+commandLength+"] outside the expected range of 1 to 128 (inclusive).");
LOGGER.error("Server [LevelChanged] command length [" + commandLength + "] outside the expected range of 1 to 128 (inclusive).");
this.serverNetworkingIsMalformed = true;
return;
}
@@ -434,7 +434,7 @@ public class ClientApi
return;
}
LOGGER.info("Server level change event received, changing the level to ["+levelKey+"].");
LOGGER.info("Server level change event received, changing the level to [" + levelKey + "].");
MC.executeOnRenderThread(() -> {
if (MC.getWrappedClientWorld() != null)
{
@@ -464,8 +464,8 @@ public class ClientApi
MC.sendChatMessage("Here be dragons!");
this.configOverrideReminderPrinted = true;
}
IProfilerWrapper profiler = MC.getProfiler();
profiler.pop(); // get out of "terrain"
profiler.push("DH-RenderLevel");
@@ -475,20 +475,20 @@ public class ClientApi
{
return;
}
//FIXME: Improve class hierarchy of DhWorld, IClientWorld, IServerWorld to fix all this hard casting
// (also in RenderUtil)
IDhClientWorld dhClientWorld = SharedApi.getIDhClientWorld();
IDhClientLevel level = dhClientWorld.getOrLoadClientLevel(levelWrapper);
if (prefLoggerEnabled)
{
level.dumpRamUsage();
}
try
{
@@ -496,9 +496,9 @@ public class ClientApi
{
DhApiRenderParam renderEventParam =
new DhApiRenderParam(mcProjectionMatrix, mcModelViewMatrix,
RenderUtil.createLodProjectionMatrix(mcProjectionMatrix, partialTicks),
RenderUtil.createLodModelViewMatrix(mcModelViewMatrix), partialTicks);
RenderUtil.createLodProjectionMatrix(mcProjectionMatrix, partialTicks),
RenderUtil.createLodModelViewMatrix(mcModelViewMatrix), partialTicks);
boolean renderingCanceled = ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeRenderEvent.class, new DhApiBeforeRenderEvent.EventParam(renderEventParam));
if (!this.rendererDisabledBecauseOfExceptions && !renderingCanceled)
{
@@ -518,7 +518,7 @@ public class ClientApi
{
this.rendererDisabledBecauseOfExceptions = true;
LOGGER.error("Renderer thrown an uncaught exception: ", e);
MC.sendChatMessage("\u00A74\u00A7l\u00A7uERROR: Distant Horizons"
+ " renderer has encountered an exception!");
MC.sendChatMessage("\u00A74Renderer is now disabled to prevent further issues.");
@@ -535,13 +535,13 @@ public class ClientApi
profiler.push("terrain"); // go back into "terrain"
}
}
//=================//
// DEBUG USE //
//=================//
/** Trigger once on key press, with CLIENT PLAYER. */
public void keyPressedEvent(int glfwKey)
{
@@ -550,8 +550,8 @@ public class ClientApi
// keybindings are disabled
return;
}
if (glfwKey == GLFW.GLFW_KEY_F8)
{
Config.Client.Advanced.Debugging.debugRendering.set(EDebugRendering.next(Config.Client.Advanced.Debugging.debugRendering.get()));
@@ -568,6 +568,4 @@ public class ClientApi
MC.sendChatMessage("P: Debug Pref Logger is " + (prefLoggerEnabled ? "enabled" : "disabled"));
}
}
}
@@ -22,6 +22,7 @@ package com.seibel.distanthorizons.core.api.internal;
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiLevelLoadEvent;
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiLevelUnloadEvent;
import com.seibel.distanthorizons.core.generation.DhLightingEngine;
import com.seibel.distanthorizons.core.util.ThreadUtil;
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IServerPlayerWrapper;
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
import com.seibel.distanthorizons.core.level.IDhLevel;
@@ -37,6 +38,7 @@ import org.apache.logging.log4j.Logger;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
/**
* This holds the methods that should be called by the host mod loader (Fabric,
@@ -48,6 +50,14 @@ public class ServerApi
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
private static final ThreadPoolExecutor LIGHT_POPULATOR_THREAD_POOL = ThreadUtil.makeRateLimitedThreadPool(
// thread count doesn't need to be very high since the player can only move so fast, 1 should be plenty
(Runtime.getRuntime().availableProcessors() <= 12) ? 1 : 2,
"Server Light Populator",
// only run the thread 50% of the time to prevent lagging the server thread
0.5,
ThreadUtil.MINIMUM_RELATIVE_PRIORITY);
private int lastWorldGenTickDelta = 0;
@@ -56,9 +66,9 @@ public class ServerApi
// =============//
// tick events //
// =============//
//=============//
// tick events //
//=============//
public void serverTickEvent()
{
@@ -74,23 +84,23 @@ public class ServerApi
catch (Exception e)
{
// try catch is necessary to prevent crashing the internal server when an exception is thrown
LOGGER.error("ServerTickEvent error: "+e.getMessage(), e);
LOGGER.error("ServerTickEvent error: " + e.getMessage(), e);
}
}
public void serverLevelTickEvent(IServerLevelWrapper level)
{
//TODO
}
public void serverLoadEvent(boolean isDedicatedEnvironment)
{
LOGGER.debug("Server World loading with (dedicated?:"+isDedicatedEnvironment+")");
LOGGER.debug("Server World loading with (dedicated?:" + isDedicatedEnvironment + ")");
SharedApi.setDhWorld(isDedicatedEnvironment ? new DhServerWorld() : new DhClientServerWorld());
}
public void serverUnloadEvent()
{
LOGGER.debug("Server World "+SharedApi.getAbstractDhWorld()+" unloading");
LOGGER.debug("Server World " + SharedApi.getAbstractDhWorld() + " unloading");
SharedApi.getAbstractDhWorld().close();
SharedApi.setDhWorld(null);
@@ -98,7 +108,7 @@ public class ServerApi
public void serverLevelLoadEvent(IServerLevelWrapper level)
{
LOGGER.debug("Server Level "+level+" loading");
LOGGER.debug("Server Level " + level + " loading");
AbstractDhWorld serverWorld = SharedApi.getAbstractDhWorld();
if (serverWorld != null)
@@ -109,7 +119,7 @@ public class ServerApi
}
public void serverLevelUnloadEvent(IServerLevelWrapper level)
{
LOGGER.debug("Server Level "+level+" unloading");
LOGGER.debug("Server Level " + level + " unloading");
AbstractDhWorld serverWorld = SharedApi.getAbstractDhWorld();
if (serverWorld != null)
@@ -118,11 +128,11 @@ public class ServerApi
ApiEventInjector.INSTANCE.fireAllEvents(DhApiLevelUnloadEvent.class, new DhApiLevelUnloadEvent.EventParam(level));
}
}
@Deprecated // TODO not implemented, remove
public void serverSaveEvent()
{
LOGGER.debug("Server world "+SharedApi.getAbstractDhWorld()+" saving");
LOGGER.debug("Server world " + SharedApi.getAbstractDhWorld() + " saving");
AbstractDhWorld serverWorld = SharedApi.getAbstractDhWorld();
if (serverWorld != null)
@@ -130,7 +140,7 @@ public class ServerApi
serverWorld.saveAndFlush();
}
}
public void serverChunkLoadEvent(IChunkWrapper chunk, ILevelWrapper level)
{
// the world should always be non-null, this != null is just in case the world was removed accidentally
@@ -147,40 +157,48 @@ public class ServerApi
public void serverChunkSaveEvent(IChunkWrapper chunk, ILevelWrapper level)
{
AbstractDhWorld dhWorld = SharedApi.getAbstractDhWorld();
if (dhWorld != null)
if (dhWorld == null)
{
IDhLevel dhLevel = SharedApi.getAbstractDhWorld().getLevel(level);
if (dhLevel != null)
return;
}
IDhLevel dhLevel = SharedApi.getAbstractDhWorld().getLevel(level);
if (dhLevel == null)
{
return;
}
// lighting the chunk needs to be done outside the event thread to prevent lagging the server thread
LIGHT_POPULATOR_THREAD_POOL.execute(() ->
{
// Save or populate the chunk wrapper's lighting
// this is done so we don't have to worry about MC unloading the lighting data for this chunk
if (chunk.isLightCorrect())
{
// Save or populate the chunk wrapper's lighting
// this is done so we don't have to worry about MC unloading the lighting data for this chunk
if (chunk.isLightCorrect())
try
{
try
{
chunk.bakeDhLightingUsingMcLightingEngine();
chunk.setUseDhLighting(true);
}
catch (IllegalStateException e)
{
LOGGER.warn(e.getMessage(), e);
}
}
else
{
// generate the chunk's lighting, ignoring neighbors.
// not a perfect solution, but should prevent chunks from having completely broken lighting
List<IChunkWrapper> nearbyChunkList = new LinkedList<>();
nearbyChunkList.add(chunk);
DhLightingEngine.INSTANCE.lightChunks(chunk, nearbyChunkList, level.hasSkyLight() ? 15 : 0);
// If MC's lighting engine isn't thread safe this may cause the server thread to lag
chunk.bakeDhLightingUsingMcLightingEngine();
chunk.setUseDhLighting(true);
}
dhLevel.updateChunkAsync(chunk);
catch (IllegalStateException e)
{
LOGGER.warn(e.getMessage(), e);
}
}
}
else
{
// generate the chunk's lighting, ignoring neighbors.
// not a perfect solution, but should prevent chunks from having completely broken lighting
List<IChunkWrapper> nearbyChunkList = new LinkedList<>();
nearbyChunkList.add(chunk);
DhLightingEngine.INSTANCE.lightChunks(chunk, nearbyChunkList, level.hasSkyLight() ? 15 : 0);
chunk.setUseDhLighting(true);
}
dhLevel.updateChunkAsync(chunk);
});
}
public void serverPlayerJoinEvent(IServerPlayerWrapper player)
@@ -11,22 +11,16 @@ import com.seibel.distanthorizons.core.world.*;
/** Contains code and variables used by both {@link ClientApi} and {@link ServerApi} */
public class SharedApi
{
private static AbstractDhWorld currentWorld;
private static AbstractDhWorld currentWorld;
private static int lastWorldGenTickDelta = 0;
public static void init() { Initializer.init(); }
public static void init() { Initializer.init(); }
public static EWorldEnvironment getEnvironment() { return (currentWorld == null) ? null : currentWorld.environment; }
public static void setDhWorld(AbstractDhWorld newWorld)
public static void setDhWorld(AbstractDhWorld newWorld)
{
currentWorld = newWorld;
currentWorld = newWorld;
// starting and stopping the DataRenderTransformer is necessary to prevent attempting to
// access the MC level at inappropriate times, which can cause exceptions
@@ -5,31 +5,31 @@ import com.seibel.distanthorizons.core.config.types.ConfigEntry;
// TODO: Make this intergrate with the config system
public class AppliedConfigState<T>
{
final ConfigEntry<T> entry;
T activeValue;
final ConfigEntry<T> entry;
T activeValue;
public AppliedConfigState(ConfigEntry<T> entryToWatch)
public AppliedConfigState(ConfigEntry<T> entryToWatch)
{
this.entry = entryToWatch;
this.activeValue = entryToWatch.get();
}
this.entry = entryToWatch;
this.activeValue = entryToWatch.get();
}
/** Returns true if the value was changed */
public boolean pollNewValue()
public boolean pollNewValue()
{
T newValue = this.entry.get();
if (newValue.equals(this.activeValue))
T newValue = this.entry.get();
if (newValue.equals(this.activeValue))
{
return false;
}
return false;
}
this.activeValue = newValue;
return true;
}
return true;
}
public T get() { return this.activeValue; }
public T get() { return this.activeValue; }
}
@@ -43,12 +43,12 @@ import java.util.*;
/**
* This handles any configuration the user has access to. <br><br>
*
*
* Note: <br>
* Only add simpler listeners here (IE listeners that only depend on 1 config entry).
* For listeners that depend on 2 or more config entries, add them before the config menu is opened.
* Otherwise, you will have issues where only some of the config entries will exist when your listener is created.
*
*
* @author coolGi
* @version 2023-7-16
*/
@@ -57,11 +57,11 @@ public class Config
{
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
public static ConfigCategory client = new ConfigCategory.Builder().set(Client.class).build();
public static ConfigCategory client = new ConfigCategory.Builder().set(Client.class).build();
public static class Client
{
public static class Client
{
public static ConfigEntry<Boolean> quickEnableRendering = new ConfigEntry.Builder<Boolean>()
.set(true)
.comment(""
@@ -105,7 +105,7 @@ public class Config
public static ConfigEntry<Boolean> optionsButton = new ConfigEntry.Builder<Boolean>()
.set(true)
.comment("" +
"Should Distant Horizon's config button appear in the options screen next to fov slider?")
"Should Distant Horizon's config button appear in the options screen next to fov slider?")
.build();
@@ -219,7 +219,7 @@ public class Config
+ "\n"
+ "True: a red flower will tint the grass below it red. \n"
+ "False: skipped blocks will not change color of surface below them. "
+"")
+ "")
.setPerformance(EConfigEntryPerformance.NONE)
.addListener(RenderCacheConfigEventHandler.INSTANCE)
.build();
@@ -310,7 +310,7 @@ public class Config
.build();
public static ConfigEntry<Double> farFogMin = new ConfigEntry.Builder<Double>()
.setMinDefaultMax(-5.0,0.0, FOG_RANGE_MAX)
.setMinDefaultMax(-5.0, 0.0, FOG_RANGE_MAX)
.comment(""
+ "What is the minimum fog thickness? \n"
+ "\n"
@@ -338,7 +338,7 @@ public class Config
.build();
public static ConfigEntry<Double> farFogDensity = new ConfigEntry.Builder<Double>()
.setMinDefaultMax(0.01,2.5, 50.0)
.setMinDefaultMax(0.01, 2.5, 50.0)
.comment(""
+ "Used in conjunction with the Fog Falloff.")
.build();
@@ -367,7 +367,7 @@ public class Config
+ EHeightFogMixMode.INVERSE_MULTIPLY_ADDITION + ": farFog + 1 - (1-heightFog) * (1-farFog) \n"
+ EHeightFogMixMode.AVERAGE + ": farFog*0.5 + heightFog*0.5 \n"
+ "\n"
+ "Note: height fog settings are ignored if '"+EHeightFogMixMode.BASIC+"' or '"+EHeightFogMixMode.IGNORE_HEIGHT+"' are selected.")
+ "Note: height fog settings are ignored if '" + EHeightFogMixMode.BASIC + "' or '" + EHeightFogMixMode.IGNORE_HEIGHT + "' are selected.")
.build();
public static ConfigEntry<EHeightFogMode> heightFogMode = new ConfigEntry.Builder<EHeightFogMode>()
@@ -440,7 +440,9 @@ public class Config
.build();
}
}
}
public static class NoiseTextureSettings
@@ -449,7 +451,7 @@ public class Config
.set(true)
.comment(""
+ "Should a noise texture be applied to LODs? \n"
+"\n"
+ "\n"
+ "This is done to simulate textures and make the LODs appear more detailed. \n"
+ "")
.build();
@@ -472,6 +474,7 @@ public class Config
+ "Defines how far should the noise texture render before it fades away. (in blocks) \n"
+ "Set to 0 to disable noise from fading away")
.build();
}
public static class AdvancedGraphics
@@ -512,7 +515,7 @@ public class Config
+ "reducing overdraw. \n"
+ "\n"
+ "Only functional on Fabric.\n"
+ "Works best with an overdraw prevention setting of "+EOverdrawPrevention.MEDIUM+" or higher \n"
+ "Works best with an overdraw prevention setting of " + EOverdrawPrevention.MEDIUM + " or higher \n"
+ " and cave culling is disabled. \n"
+ "")
.setPerformance(EConfigEntryPerformance.NONE)
@@ -553,13 +556,13 @@ public class Config
.build();
public static ConfigEntry<Integer> caveCullingHeight = new ConfigEntry.Builder<Integer>()
.setMinDefaultMax(-4096,40,4096)
.comment(""
.setMinDefaultMax(-4096, 40, 4096)
.comment(""
+ "At what Y value should cave culling start?")
.build();
public static ConfigEntry<Integer> earthCurveRatio = new ConfigEntry.Builder<Integer>()
.setMinDefaultMax(0,0,5000)
.setMinDefaultMax(0, 0, 5000)
.comment(""
+ "This is the earth size ratio when applying the curvature shader effect. \n"
+ "Note: Enabling this feature may cause rendering bugs. \n"
@@ -643,14 +646,14 @@ public class Config
+ "WARNING: This may cause world generator bugs or instability when paired with certain world generator mods. \n"
+ "- Fast \n"
+ "")
/*
// FULL isn't currently implemented
+ "\n"
+ EDhApiDistantGeneratorMode.FULL + " \n"
+ "Ask the local server to generate/load each chunk. \n"
+ "This is the most compatible, but will cause server/simulation lag. \n"
+ "- Slow (15-50 ms, with spikes up to 200 ms) \n"
*/
/*
// FULL isn't currently implemented
+ "\n"
+ EDhApiDistantGeneratorMode.FULL + " \n"
+ "Ask the local server to generate/load each chunk. \n"
+ "This is the most compatible, but will cause server/simulation lag. \n"
+ "- Slow (15-50 ms, with spikes up to 200 ms) \n"
*/
.build();
public static ConfigEntry<ELightGenerationMode> worldGenLightingEngine = new ConfigEntry.Builder<ELightGenerationMode>()
@@ -667,7 +670,7 @@ public class Config
.build();
public static ConfigEntry<Integer> worldGenerationTimeoutLengthInSeconds = new ConfigEntry.Builder<Integer>()
.setMinDefaultMax(5, 60, 60*10/*10 minutes*/)
.setMinDefaultMax(5, 60, 60 * 10/*10 minutes*/ )
.comment(""
+ "How long should a world generator thread run for before timing out? \n"
+ "Note: If you are experiencing timeout errors it is better to lower your CPU usage first \n"
@@ -695,7 +698,7 @@ public class Config
+ " fake chunks. \n"
+ "\n"
+ EGenerationPriority.BALANCED + " \n"
+ "A mix between "+ EGenerationPriority.NEAR_FIRST+"and"+ EGenerationPriority.FAR_FIRST+". \n"
+ "A mix between " + EGenerationPriority.NEAR_FIRST + "and" + EGenerationPriority.FAR_FIRST + ". \n"
+ "First prioritise completing nearby highest detail chunks, \n"
+ " then focus on filling in the low detail areas away from the player. \n"
+ "\n"
@@ -944,6 +947,7 @@ public class Config
+ "How frequently should vertex buffers (geometry) be rebuilt and sent to the GPU? \n"
+ "Higher settings may cause stuttering, but will prevent holes in the world")
.build();
}
public static class AutoUpdater
@@ -956,10 +960,11 @@ public class Config
public static ConfigEntry<Boolean> enableSilentUpdates = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment(""
.comment(""
+ "Should Distant Horizons silently, automatically download and install new versions? "
+ "")
.build();
}
public static class Logging
@@ -1028,6 +1033,7 @@ public class Config
+ "If enabled, the mod will log information about network operations. \n"
+ "This can be useful for debugging.")
.build();
}
public static class Debugging
@@ -1079,7 +1085,7 @@ public class Config
+ " This setting is only for fun and debugging. \n"
+ " Mod compatibility is not guaranteed.")
.build();
public static ConfigEntry<Boolean> debugWireframeRendering = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment(""
@@ -1089,21 +1095,21 @@ public class Config
+ " Additionally, only stuff that's loaded after you enable this \n"
+ " will render their debug wireframes.")
.build();
public static ConfigEntry<Boolean> enableWhiteWorld = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment(""
+ "Stops vertex colors from being passed. \n"
+ "Useful for debugging shaders")
.build();
// Note: This will reset on game restart, and should have a warning on the tooltip
public static ConfigEntry<Boolean> allowUnsafeValues = new ConfigEntry.Builder<Boolean>()
.set(false)
.setAppearance(EConfigEntryAppearance.ONLY_IN_GUI)
.addListener(UnsafeValuesConfigListener.INSTANCE)
.build();
// can be set to public inorder to show in the config file and UI
public static ConfigCategory exampleConfigScreen = new ConfigCategory.Builder()
@@ -1141,7 +1147,7 @@ public class Config
public static ConfigEntry<Long> longTest = new ConfigEntry.Builder<Long>()
.set(42069L)
.build();
public static ConfigEntry<Float> floatTest = new ConfigEntry.Builder<Float>()
.set(0.42069f)
.build();
@@ -1153,15 +1159,15 @@ public class Config
public static ConfigEntry<List<String>> listTest = new ConfigEntry.Builder<List<String>>()
.set(new ArrayList<String>(Arrays.asList("option 1", "option 2", "option 3")))
.build();
public static ConfigEntry<Map<String, String>> mapTest = new ConfigEntry.Builder<Map<String, String>>()
.set(new HashMap<String, String>())
.build();
public static ConfigUIButton uiButtonTest = new ConfigUIButton(() -> {
System.setProperty("java.awt.headless", "false"); // Required to make it work
JOptionPane.showMessageDialog(null, "Button pressed!", "UITester dialog", JOptionPane.INFORMATION_MESSAGE);
});
JOptionPane.showMessageDialog(null, "Button pressed!", "UITester dialog", JOptionPane.INFORMATION_MESSAGE);
});
public static ConfigCategory categoryTest = new ConfigCategory.Builder().set(CategoryTest.class).build();
@@ -1174,7 +1180,9 @@ public class Config
{
// The name of this can be anything as it will be overwritten by the name of the linked object
public static ConfigLinkedEntry linkableTest = new ConfigLinkedEntry(ExampleConfigScreen.linkableTest);
}
}
}
@@ -1195,7 +1203,7 @@ public class Config
}
}
}
@@ -1204,10 +1212,10 @@ public class Config
/**
* Runs any config setup that needs all (or most) config entries be initialized (not null),
* but doesn't necessarily require they have the right values yet. <br><br>
*
*
* Specially:
* Updates any config values that are UI only
* and adds any listeners that depend on multiple config values.
* Updates any config values that are UI only
* and adds any listeners that depend on multiple config values.
*/
public static void completeDelayedSetup()
{
@@ -1219,11 +1227,11 @@ public class Config
{
ThreadPresetConfigEventHandler.INSTANCE.setUiOnlyConfigValues();
RenderQualityPresetConfigEventHandler.INSTANCE.setUiOnlyConfigValues();
QuickRenderToggleConfigEventHandler.INSTANCE.setUiOnlyConfigValues();
QuickRenderToggleConfigEventHandler.INSTANCE.setUiOnlyConfigValues();
}
catch (Exception e)
{
LOGGER.error("Unexpected exception when setting up complicated config listeners. Error: ["+e.getMessage()+"].", e);
LOGGER.error("Unexpected exception when setting up complicated config listeners. Error: [" + e.getMessage() + "].", e);
}
}
}
@@ -20,181 +20,205 @@ import java.util.*;
* @author Ran
*/
// Init the config after singletons have been blinded
public class ConfigBase
public class ConfigBase
{
/** Our own config instance, don't modify */
public static ConfigBase INSTANCE;
public ConfigFileHandling configFileINSTANCE;
public static final Logger LOGGER = LogManager.getLogger(ConfigBase.class.getSimpleName());
public final String modID;
public final String modName;
public final int configVersion;
/** Our own config instance, don't modify */
public static ConfigBase INSTANCE;
public ConfigFileHandling configFileINSTANCE;
public static final Logger LOGGER = LogManager.getLogger(ConfigBase.class.getSimpleName());
public final String modID;
public final String modName;
public final int configVersion;
/**
* What the config works with
*
* Enum
* Boolean
* Byte
* Integer
* Double
* Short
* Long
* Float
* String
*
* // Below, "T" should be a value from above
* List<T>
* ArrayList<T>
* Map<String, T>
* HashMap<String, T>
*/
public static final List<Class<?>> acceptableInputs = new ArrayList<Class<?>>()
{{
add(Boolean.class);
add(Byte.class);
add(Integer.class);
add(Double.class);
add(Short.class);
add(Long.class);
add(Float.class);
add(String.class);
// TODO[CONFIG]: Check the type of these is valid
add(List.class);
add(ArrayList.class);
add(Map.class);
add(HashMap.class);
}};
/** Disables the minimum and maximum of any variable */
public boolean disableMinMax = false; // Very fun to use, but should always be disabled by default
public final List<AbstractConfigType<?, ?>> entries = new ArrayList<>();
public ConfigBase(String modID, String modName, Class<?> config, int configVersion)
{
LOGGER.info("Initialising config for " + modName);
this.modID = modID;
this.modName = modName;
this.configVersion = configVersion;
initNestedClass(config, ""); // Init root category
// File handling (load from file)
this.configFileINSTANCE = new ConfigFileHandling(this);
this.configFileINSTANCE.loadFromFile();
LOGGER.info("Config for " + modName + " initialised");
}
private void initNestedClass(Class<?> config, String category)
{
// Put all the entries in entries
for (Field field : config.getFields())
{
if (AbstractConfigType.class.isAssignableFrom(field.getType()))
{
try
{
entries.add((AbstractConfigType<?, ?>) field.get(field.getType()));
}
catch (IllegalAccessException exception)
{
exception.printStackTrace();
}
AbstractConfigType<?, ?> entry = entries.get(entries.size() - 1);
entry.category = category;
entry.name = field.getName();
entry.configBase = this;
if (ConfigEntry.class.isAssignableFrom(field.getType()))
{ // If item is type ConfigEntry
if (!isAcceptableType(entry.getType()))
{
LOGGER.error("Invalid variable type at [" + (category.isEmpty() ? "" : category + ".") + field.getName() + "].");
LOGGER.error("Type [" + entry.getType() + "] is not one of these types [" + acceptableInputs.toString() + "]");
entries.remove(entries.size() - 1); // Delete the entry if it is invalid so the game can still run
}
}
if (ConfigCategory.class.isAssignableFrom(field.getType()))
{ // If it's a category then init the stuff inside it and put it in the category list
assert entry instanceof ConfigCategory;
if (((ConfigCategory) entry).getDestination() == null)
((ConfigCategory) entry).destination = entry.getNameWCategory();
if (entry.get() != null)
{
initNestedClass(((ConfigCategory) entry).get(), ((ConfigCategory) entry).getDestination());
}
}
}
}
}
private static boolean isAcceptableType(Class<?> Clazz)
{
if (Clazz.isEnum())
return true;
return acceptableInputs.contains(Clazz);
}
/**
* Used for checking that all the lang files for the config exist
*
* @param onlyShowNew If disabled then it would basically remake the config lang
* @param checkEnums Checks if all the lang for the enum's exist
*/
// This is just to re-format the lang or check if there is something in the lang that is missing
public String generateLang(boolean onlyShowNew, boolean checkEnums)
{
ILangWrapper langWrapper = SingletonInjector.INSTANCE.get(ILangWrapper.class);
List<Class<? extends Enum>> enumList = new ArrayList<>();
String generatedLang = "";
String starter = " \"";
String separator = "\":\n \"";
String ending = "\",\n";
for (AbstractConfigType<?, ?> entry : this.entries)
{
String entryPrefix = "lod.config." + entry.getNameWCategory();
if (checkEnums && entry.getType().isEnum() && !enumList.contains(entry.getType()))
{ // Put it in an enum list to work with at the end
enumList.add((Class<? extends Enum>) entry.getType());
}
if (!onlyShowNew || langWrapper.langExists(entryPrefix))
{
if (!ConfigLinkedEntry.class.isAssignableFrom(entry.getClass()))
{ // If it is a linked item, dont generate the base lang
generatedLang += starter
+ entryPrefix
+ separator
+ langWrapper.getLang(entryPrefix)
+ ending
;
}
// Adds tooltips
if (langWrapper.langExists(entryPrefix + ".@tooltip"))
{
generatedLang += starter
+ entryPrefix + ".@tooltip"
+ separator
+ langWrapper.getLang(entryPrefix + ".@tooltip")
.replaceAll("\n", "\\\\n")
.replaceAll("\"", "\\\\\"")
+ ending
;
}
}
}
if (!enumList.isEmpty())
{
generatedLang += "\n"; // Separate the main lang with the enum's
for (Class<? extends Enum> anEnum : enumList)
{
for (Object enumStr : new ArrayList<>(EnumSet.allOf(anEnum)))
{
String enumPrefix = "lod.config.enum." + anEnum.getSimpleName() + "." + enumStr.toString();
if (!onlyShowNew || langWrapper.langExists(enumPrefix))
{
generatedLang += starter
+ enumPrefix
+ separator
+ langWrapper.getLang(enumPrefix)
+ ending
;
}
}
}
}
return generatedLang;
}
/**
What the config works with
Enum
Boolean
Byte
Integer
Double
Short
Long
Float
String
// Below, "T" should be a value from above
List<T>
ArrayList<T>
Map<String, T>
HashMap<String, T>
*/
public static final List<Class<?>> acceptableInputs = new ArrayList<Class<?>>() {{
add(Boolean.class);
add(Byte.class);
add(Integer.class);
add(Double.class);
add(Short.class);
add(Long.class);
add(Float.class);
add(String.class);
// TODO[CONFIG]: Check the type of these is valid
add(List.class);
add(ArrayList.class);
add(Map.class);
add(HashMap.class);
}};
/** Disables the minimum and maximum of any variable */
public boolean disableMinMax = false; // Very fun to use, but should always be disabled by default
public final List<AbstractConfigType<?, ?>> entries = new ArrayList<>();
public ConfigBase(String modID, String modName, Class<?> config, int configVersion) {
LOGGER.info("Initialising config for " + modName);
this.modID = modID;
this.modName = modName;
this.configVersion = configVersion;
initNestedClass(config, ""); // Init root category
// File handling (load from file)
this.configFileINSTANCE = new ConfigFileHandling(this);
this.configFileINSTANCE.loadFromFile();
LOGGER.info("Config for " + modName + " initialised");
}
private void initNestedClass(Class<?> config, String category) {
// Put all the entries in entries
for (Field field : config.getFields()) {
if (AbstractConfigType.class.isAssignableFrom(field.getType())) {
try {
entries.add((AbstractConfigType<?, ?>) field.get(field.getType()));
} catch (IllegalAccessException exception) {
exception.printStackTrace();
}
AbstractConfigType<?, ?> entry = entries.get(entries.size() - 1);
entry.category = category;
entry.name = field.getName();
entry.configBase = this;
if (ConfigEntry.class.isAssignableFrom(field.getType())) { // If item is type ConfigEntry
if (!isAcceptableType(entry.getType())) {
LOGGER.error("Invalid variable type at [" + (category.isEmpty() ? "" : category + ".") + field.getName() + "].");
LOGGER.error("Type [" + entry.getType() + "] is not one of these types [" + acceptableInputs.toString() + "]");
entries.remove(entries.size() -1); // Delete the entry if it is invalid so the game can still run
}
}
if (ConfigCategory.class.isAssignableFrom(field.getType())) { // If it's a category then init the stuff inside it and put it in the category list
assert entry instanceof ConfigCategory;
if (((ConfigCategory) entry).getDestination() == null)
((ConfigCategory) entry).destination = entry.getNameWCategory();
if (entry.get() != null) {
initNestedClass(((ConfigCategory) entry).get(), ((ConfigCategory) entry).getDestination());
}
}
}
}
}
private static boolean isAcceptableType(Class<?> Clazz) {
if (Clazz.isEnum())
return true;
return acceptableInputs.contains(Clazz);
}
/**
* Used for checking that all the lang files for the config exist
*
* @param onlyShowNew If disabled then it would basically remake the config lang
* @param checkEnums Checks if all the lang for the enum's exist
*/
// This is just to re-format the lang or check if there is something in the lang that is missing
public String generateLang(boolean onlyShowNew, boolean checkEnums) {
ILangWrapper langWrapper = SingletonInjector.INSTANCE.get(ILangWrapper.class);
List<Class<? extends Enum>> enumList = new ArrayList<>();
String generatedLang = "";
String starter = " \"";
String separator = "\":\n \"";
String ending = "\",\n";
for (AbstractConfigType<?, ?> entry: this.entries) {
String entryPrefix = "lod.config."+entry.getNameWCategory();
if (checkEnums && entry.getType().isEnum() && !enumList.contains(entry.getType())) { // Put it in an enum list to work with at the end
enumList.add((Class<? extends Enum>) entry.getType());
}
if (!onlyShowNew || langWrapper.langExists(entryPrefix)) {
if (!ConfigLinkedEntry.class.isAssignableFrom(entry.getClass())) { // If it is a linked item, dont generate the base lang
generatedLang += starter
+ entryPrefix
+ separator
+ langWrapper.getLang(entryPrefix)
+ ending
;
}
// Adds tooltips
if (langWrapper.langExists(entryPrefix+".@tooltip")) {
generatedLang += starter
+ entryPrefix+".@tooltip"
+ separator
+ langWrapper.getLang(entryPrefix+".@tooltip")
.replaceAll("\n", "\\\\n")
.replaceAll("\"", "\\\\\"")
+ ending
;
}
}
}
if (!enumList.isEmpty()) {
generatedLang += "\n"; // Separate the main lang with the enum's
for (Class<? extends Enum> anEnum: enumList) {
for (Object enumStr: new ArrayList<>(EnumSet.allOf(anEnum))) {
String enumPrefix = "lod.config.enum."+anEnum.getSimpleName()+"."+enumStr.toString();
if (!onlyShowNew || langWrapper.langExists(enumPrefix)) {
generatedLang += starter
+ enumPrefix
+ separator
+ langWrapper.getLang(enumPrefix)
+ ending
;
}
}
}
}
return generatedLang;
}
}
@@ -10,59 +10,67 @@ import java.util.Map;
* @version 2023-7-16
*/
// TODO: Should this be moved out of here into somewhere like the util section
public class NumberUtil {
// Is there no better way of doing this?
public static Map<Class, Number> minValues = new HashMap<Class, Number>() {{
put(Byte.class, Byte.MIN_VALUE);
put(Short.class, Short.MIN_VALUE);
put(Integer.class, Integer.MIN_VALUE);
put(Long.class, Long.MIN_VALUE);
put(Double.class, Double.MIN_VALUE);
put(Float.class, Float.MIN_VALUE);
}};
public static Map<Class, Number> maxValues = new HashMap<Class, Number>() {{
put(Byte.class, Byte.MAX_VALUE);
put(Short.class, Short.MAX_VALUE);
put(Integer.class, Integer.MAX_VALUE);
put(Long.class, Long.MAX_VALUE);
put(Double.class, Double.MAX_VALUE);
put(Float.class, Float.MAX_VALUE);
}};
public static Number getMinimum(Class c) {
return minValues.get(c);
}
public static Number getMaximum(Class c) {
return maxValues.get(c);
}
/** Does a greater than (>) operator on any number */
public static boolean greaterThan(Number a, Number b) {
if (a.getClass() != b.getClass())
return false;
Class typeClass = a.getClass();
if (typeClass == Byte.class) return a.byteValue() > b.byteValue();
if (typeClass == Short.class) return a.shortValue() > b.shortValue();
if (typeClass == Integer.class) return a.intValue() > b.intValue();
if (typeClass == Long.class) return a.longValue() > b.longValue();
if (typeClass == Double.class) return a.doubleValue() > b.doubleValue();
if (typeClass == Float.class) return a.floatValue() > b.floatValue();
return false;
}
/** Does a less than (<) operator on any number */
public static boolean lessThan(Number a, Number b) {
if (a.getClass() != b.getClass())
return false;
Class typeClass = a.getClass();
if (typeClass == Byte.class) return a.byteValue() < b.byteValue();
if (typeClass == Short.class) return a.shortValue() < b.shortValue();
if (typeClass == Integer.class) return a.intValue() < b.intValue();
if (typeClass == Long.class) return a.longValue() < b.longValue();
if (typeClass == Double.class) return a.doubleValue() < b.doubleValue();
if (typeClass == Float.class) return a.floatValue() < b.floatValue();
return false;
}
public class NumberUtil
{
// Is there no better way of doing this?
public static Map<Class, Number> minValues = new HashMap<Class, Number>()
{{
put(Byte.class, Byte.MIN_VALUE);
put(Short.class, Short.MIN_VALUE);
put(Integer.class, Integer.MIN_VALUE);
put(Long.class, Long.MIN_VALUE);
put(Double.class, Double.MIN_VALUE);
put(Float.class, Float.MIN_VALUE);
}};
public static Map<Class, Number> maxValues = new HashMap<Class, Number>()
{{
put(Byte.class, Byte.MAX_VALUE);
put(Short.class, Short.MAX_VALUE);
put(Integer.class, Integer.MAX_VALUE);
put(Long.class, Long.MAX_VALUE);
put(Double.class, Double.MAX_VALUE);
put(Float.class, Float.MAX_VALUE);
}};
public static Number getMinimum(Class c)
{
return minValues.get(c);
}
public static Number getMaximum(Class c)
{
return maxValues.get(c);
}
/** Does a greater than (>) operator on any number */
public static boolean greaterThan(Number a, Number b)
{
if (a.getClass() != b.getClass())
return false;
Class typeClass = a.getClass();
if (typeClass == Byte.class) return a.byteValue() > b.byteValue();
if (typeClass == Short.class) return a.shortValue() > b.shortValue();
if (typeClass == Integer.class) return a.intValue() > b.intValue();
if (typeClass == Long.class) return a.longValue() > b.longValue();
if (typeClass == Double.class) return a.doubleValue() > b.doubleValue();
if (typeClass == Float.class) return a.floatValue() > b.floatValue();
return false;
}
/** Does a less than (<) operator on any number */
public static boolean lessThan(Number a, Number b)
{
if (a.getClass() != b.getClass())
return false;
Class typeClass = a.getClass();
if (typeClass == Byte.class) return a.byteValue() < b.byteValue();
if (typeClass == Short.class) return a.shortValue() < b.shortValue();
if (typeClass == Integer.class) return a.intValue() < b.intValue();
if (typeClass == Long.class) return a.longValue() < b.longValue();
if (typeClass == Double.class) return a.doubleValue() < b.doubleValue();
if (typeClass == Float.class) return a.floatValue() < b.floatValue();
return false;
}
}
@@ -14,15 +14,15 @@ public class QuickRenderToggleConfigEventHandler
/** private since we only ever need one handler at a time */
private QuickRenderToggleConfigEventHandler()
private QuickRenderToggleConfigEventHandler()
{
this.quickRenderChangeListener = new ConfigChangeListener<>(Config.Client.quickEnableRendering, (val) -> { Config.Client.Advanced.Debugging.rendererMode.set(Config.Client.quickEnableRendering.get() ? ERendererMode.DEFAULT : ERendererMode.DISABLED); });
this.rendererModeChangeListener = new ConfigChangeListener<>(Config.Client.Advanced.Debugging.rendererMode, (val) -> { Config.Client.quickEnableRendering.set(Config.Client.Advanced.Debugging.rendererMode.get() != ERendererMode.DISABLED); });
}
/**
* Set the UI only config based on what is set in the file. <br>
* This should only be called once.
* Set the UI only config based on what is set in the file. <br>
* This should only be called once.
*/
public void setUiOnlyConfigValues()
{
@@ -13,7 +13,7 @@ import java.util.TimerTask;
/**
* Listens to the config and will automatically
* clear the current render cache if certain settings are changed. <br> <br>
*
*
* Note: if additional settings should clear the render cache, add those to this listener, don't create a new listener
*/
public class RenderCacheConfigEventHandler implements IConfigListener
@@ -31,11 +31,11 @@ public class RenderCacheConfigEventHandler implements IConfigListener
/** private since we only ever need one handler at a time */
private RenderCacheConfigEventHandler() { }
private RenderCacheConfigEventHandler() { }
@Override
@Override
public void onConfigValueSet()
{
// confirm a setting was actually changed
@@ -11,7 +11,7 @@ public class ResetConfigEventHandler
/** private since we only ever need one handler at a time */
private ResetConfigEventHandler()
private ResetConfigEventHandler()
{
this.configChangeListener = new ConfigChangeListener<>(Config.Client.ResetConfirmation.resetAllSettings, (resetSettings) -> { doStuff(resetSettings); });

Some files were not shown because too many files have changed in this diff Show More