diff --git a/.editorconfig b/.editorconfig index bf7a05c1..3be144f3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,30 +1,62 @@ -# This is beautiful. - -root = true - [*] charset = utf-8 -end_of_line = lf +end_of_line = crlf indent_size = 4 indent_style = space -insert_final_newline = true +insert_final_newline = false +max_line_length = 120 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 + +[*.css] +ij_css_align_closing_brace_with_properties = false +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_brace_placement = end_of_line +ij_css_enforce_quotes_on_format = false +ij_css_hex_color_long_format = false +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = false +ij_css_keep_blank_lines_in_code = 2 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = false +ij_css_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_use_double_quotes = true +ij_css_value_alignment = do_not_align + +[*.feature] +indent_size = 2 +ij_gherkin_keep_indents_on_empty_lines = false + +[*.gsp] +ij_gsp_keep_indents_on_empty_lines = false + +[*.haml] +indent_size = 2 +ij_haml_keep_indents_on_empty_lines = false [*.java] 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 = true +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 = true +ij_java_align_multiline_binary_operation = false ij_java_align_multiline_chained_methods = false ij_java_align_multiline_extends_list = false ij_java_align_multiline_for = true ij_java_align_multiline_method_parentheses = false -ij_java_align_multiline_parameters = false +ij_java_align_multiline_parameters = true ij_java_align_multiline_parameters_in_calls = false ij_java_align_multiline_parenthesized_expression = false ij_java_align_multiline_records = true @@ -34,7 +66,7 @@ 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_annotation_parameter_wrap = normal +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 = off @@ -98,10 +130,10 @@ ij_java_entity_lhi_suffix = Home ij_java_entity_li_prefix = Local ij_java_entity_pk_class = java.lang.String ij_java_entity_vo_suffix = VO -ij_java_enum_constants_wrap = split_into_lines +ij_java_enum_constants_wrap = off ij_java_extends_keyword_wrap = off ij_java_extends_list_wrap = off -ij_java_field_annotation_wrap = on_every_item +ij_java_field_annotation_wrap = split_into_lines ij_java_finally_on_new_line = false ij_java_for_brace_force = never ij_java_for_statement_new_line_after_left_paren = false @@ -110,7 +142,7 @@ 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_imports_layout = *, |, javax.**, java.**, |, $* ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = false ij_java_insert_override_annotation = true @@ -124,9 +156,9 @@ ij_java_keep_indents_on_empty_lines = true ij_java_keep_line_breaks = true ij_java_keep_multiple_expressions_in_one_line = false 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_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false ij_java_label_indent_absolute = false ij_java_label_indent_size = 0 ij_java_lambda_brace_style = end_of_line @@ -144,7 +176,8 @@ ij_java_method_parameters_wrap = off ij_java_modifier_list_wrap = false ij_java_names_count_to_use_import_on_demand = 3 ij_java_new_line_after_lparen_in_record_header = false -ij_java_parameter_annotation_wrap = normal +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 @@ -246,16 +279,919 @@ ij_java_subclass_name_suffix = Impl ij_java_ternary_operation_signs_on_next_line = false ij_java_ternary_operation_wrap = off ij_java_test_name_suffix = Test -ij_java_throws_keyword_wrap = normal +ij_java_throws_keyword_wrap = off ij_java_throws_list_wrap = off 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 = normal +ij_java_variable_annotation_wrap = off ij_java_visibility = public ij_java_while_brace_force = never ij_java_while_on_new_line = false ij_java_wrap_comments = false ij_java_wrap_first_method_in_call_chain = false ij_java_wrap_long_lines = false + +[*.less] +indent_size = 2 +ij_less_align_closing_brace_with_properties = false +ij_less_blank_lines_around_nested_selector = 1 +ij_less_blank_lines_between_blocks = 1 +ij_less_brace_placement = 0 +ij_less_enforce_quotes_on_format = false +ij_less_hex_color_long_format = false +ij_less_hex_color_lower_case = false +ij_less_hex_color_short_format = false +ij_less_hex_color_upper_case = false +ij_less_keep_blank_lines_in_code = 2 +ij_less_keep_indents_on_empty_lines = false +ij_less_keep_single_line_blocks = false +ij_less_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_less_space_after_colon = true +ij_less_space_before_opening_brace = true +ij_less_use_double_quotes = true +ij_less_value_alignment = 0 + +[*.nbtt] +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 + +[*.sass] +indent_size = 2 +ij_sass_align_closing_brace_with_properties = false +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_enforce_quotes_on_format = false +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_use_double_quotes = true +ij_sass_value_alignment = 0 + +[*.scss] +indent_size = 2 +ij_scss_align_closing_brace_with_properties = false +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_brace_placement = 0 +ij_scss_enforce_quotes_on_format = false +ij_scss_hex_color_long_format = false +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = false +ij_scss_keep_blank_lines_in_code = 2 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = false +ij_scss_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_use_double_quotes = true +ij_scss_value_alignment = 0 + +[*.styl] +indent_size = 2 +ij_stylus_align_closing_brace_with_properties = false +ij_stylus_blank_lines_around_nested_selector = 1 +ij_stylus_blank_lines_between_blocks = 1 +ij_stylus_brace_placement = 0 +ij_stylus_enforce_quotes_on_format = false +ij_stylus_hex_color_long_format = false +ij_stylus_hex_color_lower_case = false +ij_stylus_hex_color_short_format = false +ij_stylus_hex_color_upper_case = false +ij_stylus_keep_blank_lines_in_code = 2 +ij_stylus_keep_indents_on_empty_lines = false +ij_stylus_keep_single_line_blocks = false +ij_stylus_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_stylus_space_after_colon = true +ij_stylus_space_before_opening_brace = true +ij_stylus_use_double_quotes = true +ij_stylus_value_alignment = 0 + +[.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, *.pom, *.rng, *.tld, *.wadl, *.wsdd, *.wsdl, *.xjb, *.xml, *.xsd, *.xsl, *.xslt, *.xul}] +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +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 + +[{*.ats, *.ts}] +ij_continuation_indent_size = 4 +ij_typescript_align_imports = false +ij_typescript_align_multiline_array_initializer_expression = false +ij_typescript_align_multiline_binary_operation = false +ij_typescript_align_multiline_chained_methods = false +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = false +ij_typescript_align_multiline_ternary_operation = false +ij_typescript_align_object_properties = 0 +ij_typescript_align_union_types = false +ij_typescript_align_var_statements = 0 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = off +ij_typescript_assignment_wrap = off +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = off +ij_typescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = end_of_line +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = off +ij_typescript_catch_on_new_line = false +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = end_of_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = never +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_extends_keyword_wrap = off +ij_typescript_extends_list_wrap = off +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = false +ij_typescript_for_brace_force = never +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = off +ij_typescript_force_quote_style = false +ij_typescript_force_semicolon_style = false +ij_typescript_function_expression_brace_style = end_of_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = global +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = false +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = true +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = end_of_line +ij_typescript_method_call_chain_wrap = off +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = off +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false +ij_typescript_prefer_explicit_types_function_expression_returns = false +ij_typescript_prefer_explicit_types_function_returns = false +ij_typescript_prefer_explicit_types_vars_fields = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = true +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = true +ij_typescript_space_before_catch_parentheses = true +ij_typescript_space_before_class_lbrace = true +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = true +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = true +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = true +ij_typescript_space_before_for_left_brace = true +ij_typescript_space_before_for_parentheses = true +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = true +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = true +ij_typescript_space_before_if_parentheses = true +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = true +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = true +ij_typescript_space_before_switch_parentheses = true +ij_typescript_space_before_try_left_brace = true +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = true +ij_typescript_space_before_while_parentheses = true +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = off +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = global +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = never +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false + +[{*.bash, *.sh, *.zsh}] +indent_size = 2 +tab_width = 2 +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 + +[{*.cjs, *.js}] +ij_continuation_indent_size = 4 +ij_javascript_align_imports = false +ij_javascript_align_multiline_array_initializer_expression = false +ij_javascript_align_multiline_binary_operation = false +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = false +ij_javascript_align_multiline_for = true +ij_javascript_align_multiline_parameters = true +ij_javascript_align_multiline_parameters_in_calls = false +ij_javascript_align_multiline_ternary_operation = false +ij_javascript_align_object_properties = 0 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 0 +ij_javascript_array_initializer_new_line_after_left_brace = false +ij_javascript_array_initializer_right_brace_on_new_line = false +ij_javascript_array_initializer_wrap = off +ij_javascript_assignment_wrap = off +ij_javascript_binary_operation_sign_on_next_line = false +ij_javascript_binary_operation_wrap = off +ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = end_of_line +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = off +ij_javascript_catch_on_new_line = false +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = end_of_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = never +ij_javascript_else_on_new_line = false +ij_javascript_enforce_trailing_comma = keep +ij_javascript_extends_keyword_wrap = off +ij_javascript_extends_list_wrap = off +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = relaxed +ij_javascript_finally_on_new_line = false +ij_javascript_for_brace_force = never +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = off +ij_javascript_force_quote_style = false +ij_javascript_force_semicolon_style = false +ij_javascript_function_expression_brace_style = end_of_line +ij_javascript_if_brace_force = never +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = global +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = false +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = true +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 2 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = true +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = end_of_line +ij_javascript_method_call_chain_wrap = off +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = off +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = false +ij_javascript_prefer_as_type_cast = false +ij_javascript_prefer_explicit_types_function_expression_returns = false +ij_javascript_prefer_explicit_types_function_returns = false +ij_javascript_prefer_explicit_types_vars_fields = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_reformat_c_style_comments = false +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = false +ij_javascript_space_before_async_arrow_lparen = true +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = true +ij_javascript_space_before_catch_parentheses = true +ij_javascript_space_before_class_lbrace = true +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = true +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = true +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = true +ij_javascript_space_before_for_left_brace = true +ij_javascript_space_before_for_parentheses = true +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = true +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = true +ij_javascript_space_before_if_parentheses = true +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = true +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = true +ij_javascript_space_before_switch_parentheses = true +ij_javascript_space_before_try_left_brace = true +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = true +ij_javascript_space_before_while_parentheses = true +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = false +ij_javascript_spaces_within_interpolation_expressions = false +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = false +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = false +ij_javascript_ternary_operation_wrap = off +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = false +ij_javascript_use_double_quotes = true +ij_javascript_use_explicit_js_extension = global +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = normal +ij_javascript_while_brace_force = never +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false + +[{*.cjsx, *.coffee}] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 2 +ij_coffeescript_align_function_body = false +ij_coffeescript_align_imports = false +ij_coffeescript_align_multiline_array_initializer_expression = true +ij_coffeescript_align_multiline_parameters = true +ij_coffeescript_align_multiline_parameters_in_calls = false +ij_coffeescript_align_object_properties = 0 +ij_coffeescript_align_union_types = false +ij_coffeescript_align_var_statements = 0 +ij_coffeescript_array_initializer_new_line_after_left_brace = false +ij_coffeescript_array_initializer_right_brace_on_new_line = false +ij_coffeescript_array_initializer_wrap = normal +ij_coffeescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_coffeescript_blank_lines_around_function = 1 +ij_coffeescript_call_parameters_new_line_after_left_paren = false +ij_coffeescript_call_parameters_right_paren_on_new_line = false +ij_coffeescript_call_parameters_wrap = normal +ij_coffeescript_chained_call_dot_on_new_line = true +ij_coffeescript_comma_on_new_line = false +ij_coffeescript_enforce_trailing_comma = keep +ij_coffeescript_field_prefix = _ +ij_coffeescript_file_name_style = relaxed +ij_coffeescript_force_quote_style = false +ij_coffeescript_force_semicolon_style = false +ij_coffeescript_function_expression_brace_style = end_of_line +ij_coffeescript_import_merge_members = global +ij_coffeescript_import_prefer_absolute_path = global +ij_coffeescript_import_sort_members = true +ij_coffeescript_import_sort_module_name = false +ij_coffeescript_import_use_node_resolution = true +ij_coffeescript_imports_wrap = on_every_item +ij_coffeescript_indent_chained_calls = true +ij_coffeescript_indent_package_children = 0 +ij_coffeescript_jsx_attribute_value = braces +ij_coffeescript_keep_blank_lines_in_code = 2 +ij_coffeescript_keep_first_column_comment = true +ij_coffeescript_keep_indents_on_empty_lines = false +ij_coffeescript_keep_line_breaks = true +ij_coffeescript_keep_simple_methods_in_one_line = false +ij_coffeescript_method_parameters_new_line_after_left_paren = false +ij_coffeescript_method_parameters_right_paren_on_new_line = false +ij_coffeescript_method_parameters_wrap = off +ij_coffeescript_object_literal_wrap = on_every_item +ij_coffeescript_prefer_as_type_cast = false +ij_coffeescript_prefer_explicit_types_function_expression_returns = false +ij_coffeescript_prefer_explicit_types_function_returns = false +ij_coffeescript_prefer_explicit_types_vars_fields = false +ij_coffeescript_reformat_c_style_comments = false +ij_coffeescript_space_after_comma = true +ij_coffeescript_space_after_dots_in_rest_parameter = false +ij_coffeescript_space_after_generator_mult = true +ij_coffeescript_space_after_property_colon = true +ij_coffeescript_space_after_type_colon = true +ij_coffeescript_space_after_unary_not = false +ij_coffeescript_space_before_async_arrow_lparen = true +ij_coffeescript_space_before_class_lbrace = true +ij_coffeescript_space_before_comma = false +ij_coffeescript_space_before_function_left_parenth = true +ij_coffeescript_space_before_generator_mult = false +ij_coffeescript_space_before_property_colon = false +ij_coffeescript_space_before_type_colon = false +ij_coffeescript_space_before_unary_not = false +ij_coffeescript_spaces_around_additive_operators = true +ij_coffeescript_spaces_around_arrow_function_operator = true +ij_coffeescript_spaces_around_assignment_operators = true +ij_coffeescript_spaces_around_bitwise_operators = true +ij_coffeescript_spaces_around_equality_operators = true +ij_coffeescript_spaces_around_logical_operators = true +ij_coffeescript_spaces_around_multiplicative_operators = true +ij_coffeescript_spaces_around_relational_operators = true +ij_coffeescript_spaces_around_shift_operators = true +ij_coffeescript_spaces_around_unary_operator = false +ij_coffeescript_spaces_within_array_initializer_braces = false +ij_coffeescript_spaces_within_array_initializer_brackets = false +ij_coffeescript_spaces_within_imports = false +ij_coffeescript_spaces_within_index_brackets = false +ij_coffeescript_spaces_within_interpolation_expressions = false +ij_coffeescript_spaces_within_method_call_parentheses = false +ij_coffeescript_spaces_within_method_parentheses = false +ij_coffeescript_spaces_within_object_braces = false +ij_coffeescript_spaces_within_object_literal_braces = false +ij_coffeescript_spaces_within_object_type_braces = true +ij_coffeescript_spaces_within_range_brackets = false +ij_coffeescript_spaces_within_type_assertion = false +ij_coffeescript_spaces_within_union_types = true +ij_coffeescript_union_types_wrap = on_every_item +ij_coffeescript_use_chained_calls_group_indents = false +ij_coffeescript_use_double_quotes = true +ij_coffeescript_use_explicit_js_extension = global +ij_coffeescript_use_path_mapping = always +ij_coffeescript_use_public_modifier = false +ij_coffeescript_use_semicolon_after_statement = false +ij_coffeescript_var_declaration_wrap = normal + +[{*.ft, *.vm, *.vsl}] +ij_vtl_keep_indents_on_empty_lines = false + +[{*.gant, *.gradle, *.groovy, *.gson, *.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_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_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_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_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_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_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_long_lines = false + +[{*.har, *.jsb2, *.jsb3, *.json, .babelrc, .eslintrc, .stylelintrc, bowerrc, jest.config, mcmod.info, pack.mcmeta}] +indent_size = 2 +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +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, *.ng, *.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_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 +ij_html_uniform_ident = false + +[{*.jsf, *.jsp, *.jspf, *.tag, *.tagf, *.xjsp}] +ij_jsp_jsp_prefer_comma_separated_import_list = false +ij_jsp_keep_indents_on_empty_lines = false + +[{*.jspx, *.tagx}] +ij_jspx_keep_indents_on_empty_lines = false + +[{*.kt, *.kts, *.main.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_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_comment_add_space = 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_keep_indents_on_empty_lines = false +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 + +[{*.properties, spring.handlers, spring.schemas}] +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 + +[{*.toml, Cargo.lock, Cargo.toml.orig, Gopkg.lock, Pipfile, poetry.lock}] +ij_toml_keep_indents_on_empty_lines = false + +[{*.yaml, *.yml}] +indent_size = 2 +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 diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 5c242449..cc9127c3 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1,2 @@ -patreon: shedaniel \ No newline at end of file +patreon: shedaniel +github: [ shedaniel, MaxNeedsSnacks ] diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..b166a6b5 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,137 @@ +name: Build PR snapshot + +on: + pull_request: + paths: + - '**.gradle' + - '**.properties' + - '**/src/**' + types: [ opened, synchronize, reopened ] +jobs: + validate-gradle: + name: "Validate Gradle wrapper" + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: gradle/wrapper-validation-action@v1 + license: + name: "Verify License integrity" + runs-on: ubuntu-20.04 + if: | + !contains(github.event.head_commit.message, '[ci skip]') + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: 8 + distribution: 'adopt' + + - name: Cache Gradle wrapper + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper + key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/**/*') }} + restore-keys: gradle-wrapper-${{ runner.os }}- + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: gradle-packages-${{ runner.os }}- + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Verify license using Licenser + run: | + ./gradlew licenseCheck + + # Remove some potentially problematic files from the Gradle cache, + # so that GitHub Actions doesn't cache them. + - name: Cleanup Gradle Cache + if: steps.cache-packages.outputs.cache-hit != 'true' + run: | + rm -f $HOME/.gradle/caches/*/*.lock + rm -rf $HOME/.gradle/caches/*/plugin-resolution/ + rm -rf $HOME/.gradle/caches/*/scripts/ + rm -rf $HOME/.gradle/caches/*/scripts-remapped/ + rm -rf $HOME/.gradle/caches/*/fileHashes/ + rm -f $HOME/.gradle/caches/journal-1/file-access.bin + build: + name: "Build" + strategy: + matrix: + java: [ 8, 15 ] # Build on Java 8 (version shipped with MC 1.16) and Java 15 (iirc the latest version supported by both loaders on 1.16) + runs-on: ubuntu-20.04 + if: | + !contains(github.event.head_commit.message, '[ci skip]') + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java }} + distribution: 'adopt' + + - name: Cache Gradle wrapper + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper + key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/**/*') }} + restore-keys: gradle-wrapper-${{ runner.os }}- + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: gradle-packages-${{ runner.os }}- + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build with Gradle + run: | + ./gradlew build --stacktrace --no-daemon + + # Remove some potentially problematic files from the Gradle cache, + # so that GitHub Actions doesn't cache them. + - name: Cleanup Gradle Cache + if: steps.cache-packages.outputs.cache-hit != 'true' + run: | + rm -f $HOME/.gradle/caches/*/*.lock + rm -rf $HOME/.gradle/caches/*/plugin-resolution/ + rm -rf $HOME/.gradle/caches/*/scripts/ + rm -rf $HOME/.gradle/caches/*/scripts-remapped/ + rm -rf $HOME/.gradle/caches/*/fileHashes/ + rm -f $HOME/.gradle/caches/journal-1/file-access.bin + + - name: Setting mod version + if: ${{ matrix.java == '8' }} # Only upload Java 8 artifacts for MC 1.16 + run: | + cat $GITHUB_WORKSPACE/gradle.properties | grep ^archives_base_name= >> $GITHUB_ENV + cat $GITHUB_WORKSPACE/gradle.properties | grep ^minecraft_version= >> $GITHUB_ENV + cat $GITHUB_WORKSPACE/gradle.properties | grep ^base_version= >> $GITHUB_ENV + - name: Create package name + if: ${{ matrix.java == '8' }} # Only upload Java 8 artifacts for MC 1.16 + run: echo "package_name=[$minecraft_version] $archives_base_name-$base_version.${{ github.run_number }}" >> $GITHUB_ENV + - uses: actions/upload-artifact@v2 + if: ${{ matrix.java == '8' }} # Only upload Java 8 artifacts for MC 1.16 + with: + name: ${{ env.package_name }} + path: | + **/build/libs/ + !build/libs/ + !**/*-dev.jar + !**/*-shadow.jar + !**/*-transformProduction*.jar + !**/testmod*/ diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index e30a2eee..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Java CI - -on: - push: - paths: - - '**.gradle' - - '**.properties' - - '**/src/**' - branches: - - "1.16" - - "1.17" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 16 - uses: actions/setup-java@v1 - with: - java-version: 16 - - name: Upload to Maven - run: ./gradlew publish curseforgePublish --stacktrace - if: | - !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.pull_request.title, '[ci skip]') - env: - MAVEN_PASS: ${{ secrets.MAVEN_PASS }} - curse_api_key: ${{ secrets.CURSE_API_KEY }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 00000000..530cf998 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,202 @@ +name: Build and Release + +on: + push: + paths: + - '**.gradle' + - '**.properties' + - '**/src/**' + branches: + - "1.16" + - "1.17" + workflow_dispatch: + inputs: + norelease: + description: 'Do not publish' + required: true + default: 'false' + +jobs: + validate-gradle: + name: "Validate Gradle wrapper" + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: gradle/wrapper-validation-action@v1 + license: + name: "Verify License integrity" + runs-on: ubuntu-20.04 + if: | + !contains(github.event.head_commit.message, '[ci skip]') + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: 8 + distribution: 'adopt' + + - name: Cache Gradle wrapper + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper + key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/**/*') }} + restore-keys: gradle-wrapper-${{ runner.os }}- + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: gradle-packages-${{ runner.os }}- + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Verify license using Licenser + run: | + ./gradlew licenseCheck + + # Remove some potentially problematic files from the Gradle cache, + # so that GitHub Actions doesn't cache them. + - name: Cleanup Gradle Cache + if: steps.cache-packages.outputs.cache-hit != 'true' + run: | + rm -f $HOME/.gradle/caches/*/*.lock + rm -rf $HOME/.gradle/caches/*/plugin-resolution/ + rm -rf $HOME/.gradle/caches/*/scripts/ + rm -rf $HOME/.gradle/caches/*/scripts-remapped/ + rm -rf $HOME/.gradle/caches/*/fileHashes/ + rm -f $HOME/.gradle/caches/journal-1/file-access.bin + + build: + name: "Build" + strategy: + matrix: + java: [ 8, 15 ] # Build on Java 8 (version shipped with MC 1.16) and Java 15 (iirc the latest version supported by both loaders on 1.16) + runs-on: ubuntu-20.04 + if: | + !contains(github.event.head_commit.message, '[ci skip]') + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java }} + distribution: 'adopt' + + - name: Cache Gradle wrapper + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper + key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/**/*') }} + restore-keys: gradle-wrapper-${{ runner.os }}- + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: gradle-packages-${{ runner.os }}- + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build with Gradle + run: | + ./gradlew build --stacktrace --no-daemon + + # Remove some potentially problematic files from the Gradle cache, + # so that GitHub Actions doesn't cache them. + - name: Cleanup Gradle Cache + if: steps.cache-packages.outputs.cache-hit != 'true' + run: | + rm -f $HOME/.gradle/caches/*/*.lock + rm -rf $HOME/.gradle/caches/*/plugin-resolution/ + rm -rf $HOME/.gradle/caches/*/scripts/ + rm -rf $HOME/.gradle/caches/*/scripts-remapped/ + rm -rf $HOME/.gradle/caches/*/fileHashes/ + rm -f $HOME/.gradle/caches/journal-1/file-access.bin + + - name: Setting mod version + if: ${{ matrix.java == '8' }} # Only upload Java 8 artifacts for MC 1.16 + run: | + cat $GITHUB_WORKSPACE/gradle.properties | grep ^archives_base_name= >> $GITHUB_ENV + cat $GITHUB_WORKSPACE/gradle.properties | grep ^minecraft_version= >> $GITHUB_ENV + cat $GITHUB_WORKSPACE/gradle.properties | grep ^base_version= >> $GITHUB_ENV + - name: Create package name + if: ${{ matrix.java == '8' }} # Only upload Java 8 artifacts for MC 1.16 + run: echo "package_name=[$minecraft_version] $archives_base_name-$base_version.${{ github.run_number }}" >> $GITHUB_ENV + - uses: actions/upload-artifact@v2 + if: ${{ matrix.java == '8' }} # Only upload Java 8 artifacts for MC 1.16 + with: + name: ${{ env.package_name }} + path: | + **/build/libs/ + !build/libs/ + !**/*-dev.jar + !**/*-shadow.jar + !**/*-transformProduction*.jar + !**/testmod*/ + + publish: + needs: + - validate-gradle + - license + - build + runs-on: ubuntu-20.04 + if: | + !contains(github.event.head_commit.message, '[norelease]') && github.event.inputs.norelease != 'true' + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: 8 + distribution: 'adopt' + + - name: Cache Gradle wrapper + uses: actions/cache@v2 + with: + path: ~/.gradle/wrapper + key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/**/*') }} + restore-keys: gradle-wrapper-${{ runner.os }}- + + - name: Cache packages + id: cache-packages + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: gradle-packages-${{ runner.os }}- + + - name: Release to Maven and CurseForge + env: + # currently unused, may want to use these for changelogs though! + # GIT_COMMIT: ${{ github.event.after }} + # GIT_PREVIOUS_COMMIT: ${{ github.event.before }} + MAVEN_PASS: ${{ secrets.MAVEN_PASS }} + CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }} + # TODO: make this use the artifacts from the previous build step + run: | + ./gradlew build publish curseforgePublish --stacktrace --no-daemon + + # Remove some potentially problematic files from the Gradle cache, + # so that GitHub Actions doesn't cache them. + - name: Cleanup Gradle Cache + if: steps.cache-packages.outputs.cache-hit != 'true' + run: | + rm -f $HOME/.gradle/caches/*/*.lock + rm -rf $HOME/.gradle/caches/*/plugin-resolution/ + rm -rf $HOME/.gradle/caches/*/scripts/ + rm -rf $HOME/.gradle/caches/*/scripts-remapped/ + rm -rf $HOME/.gradle/caches/*/fileHashes/ + rm -f $HOME/.gradle/caches/journal-1/file-access.bin diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml deleted file mode 100644 index 30c7107f..00000000 --- a/.github/workflows/snapshot.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Snapshot Compile & Release - -on: - pull_request: - paths: - - '**.gradle' - - '**.properties' - - '**/src/**' - types: [ opened, synchronize, reopened ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 16 - uses: actions/setup-java@v1 - with: - java-version: 16 - - name: Upload to Maven - run: ./gradlew publish --stacktrace - if: | - !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.pull_request.title, '[ci skip]') - env: - MAVEN_PASS: ${{ secrets.MAVEN_PASS }} - PR_NUM: ${{github.event.number}} diff --git a/LICENSE.md b/LICENSE.md index ba5f0497..751e50da 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -4,160 +4,116 @@ GNU Lesser General Public License _Version 3, 29 June 2007_ _Copyright © 2007 Free Software Foundation, Inc. <>_ -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - -This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. +This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU +General Public License, supplemented by the additional permissions listed below. ### 0. Additional Definitions -As used herein, “this License” refers to version 3 of the GNU Lesser -General Public License, and the “GNU GPL” refers to version 3 of the GNU -General Public License. +As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to +version 3 of the GNU General Public License. -“The Library” refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. +“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined +below. -An “Application” is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. +An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on +the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by +the Library. -A “Combined Work” is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the “Linked -Version”. +A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of +the Library with which the Combined Work was made is also called the “Linked Version”. -The “Minimal Corresponding Source” for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. +The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding +any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not +on the Linked Version. -The “Corresponding Application Code” for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. +The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, +including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the +System Libraries of the Combined Work. ### 1. Exception to Section 3 of the GNU GPL -You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. +You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. ### 2. Conveying Modified Versions -If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: +If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied +by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may +convey a copy of the modified version: -* **a)** under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or +* **a)** under this License, provided that you make a good faith effort to ensure that, in the event an Application does + not supply the function or data, the facility still operates, and performs whatever part of its purpose remains + meaningful, or -* **b)** under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. +* **b)** under the GNU GPL, with none of the additional permissions of this License applicable to that copy. ### 3. Object Code Incorporating Material from Library Header Files -The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates +The object code form of an Application may incorporate material from a header file that is part of the Library. You may +convey such object code under terms of your choice, provided that, if the incorporated material is not limited to +numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: -* **a)** Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. -* **b)** Accompany the object code with a copy of the GNU GPL and this license - document. +* **a)** Give prominent notice with each copy of the object code that the Library is used in it and that the Library and + its use are covered by this License. +* **b)** Accompany the object code with a copy of the GNU GPL and this license document. ### 4. Combined Works -You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: +You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification +of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, +if you also do each of the following: -* **a)** Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. +* **a)** Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library + and its use are covered by this License. -* **b)** Accompany the Combined Work with a copy of the GNU GPL and this license +* **b)** Accompany the Combined Work with a copy of the GNU GPL and this license document. + +* **c)** For a Combined Work that displays copyright notices during execution, include the copyright notice for the + Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. -* **c)** For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - * **d)** Do one of the following: - - **0)** Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - **1)** Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that **(a)** uses at run time - a copy of the Library already present on the user's computer - system, and **(b)** will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. + - **0)** Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application + Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a + modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 + of the GNU GPL for conveying Corresponding Source. + - **1)** Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that **( + a)** uses at run time a copy of the Library already present on the user's computer system, and **(b)** will + operate properly with a modified version of the Library that is interface-compatible with the Linked Version. -* **e)** Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option **4d0**, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option **4d1**, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) +* **e)** Provide Installation Information, but only if you would otherwise be required to provide such information under + section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified + version of the Combined Work produced by recombining or relinking the Application with a modified version of the + Linked Version. (If you use option **4d0**, the Installation Information must accompany the Minimal Corresponding + Source and Corresponding Application Code. If you use option **4d1**, you must provide the Installation Information in + the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) ### 5. Combined Libraries -You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: +You may place library facilities that are a work based on the Library side by side in a single library together with +other library facilities that are not Applications and are not covered by this License, and convey such a combined +library under terms of your choice, if you do both of the following: -* **a)** Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. -* **b)** Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. +* **a)** Accompany the combined library with a copy of the same work based on the Library, uncombined with any other + library facilities, conveyed under the terms of this License. +* **b)** Give prominent notice with the combined library that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. ### 6. Revised Versions of the GNU Lesser General Public License -The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. +The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time +to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new +problems or concerns. -Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License “or any later version” -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. +Each version is given a distinguishing version number. If the Library as you received it specifies that a certain +numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of +following the terms and conditions either of that published version or of any later version published by the Free +Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General +Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software +Foundation. -If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. \ No newline at end of file +If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General +Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for +you to choose that version for the Library. \ No newline at end of file diff --git a/README.md b/README.md index 0ce54cff..bfe62716 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,38 @@ # Architectury API + Talk to us on [Discord](https://discord.gg/C2RdJDpRBP)! An intermediary api aimed to ease developing multiplatform mods. ### What is Architectury API -Architectury API is an api to abstract calls to fabric api and forge api as both loader has different implementations of what can be perceived as the same thing. -Architectury API updates regularly, with new hooks and features. Currently contains over **90** events hooks, networking abstraction, loader calls abstraction, game registry abstraction and an easy to use @ExpectPlatform annotation (Only works on static methods). +Architectury API is an api to abstract calls to fabric api and forge api as both loader has different implementations of +what can be perceived as the same thing. + +Architectury API updates regularly, with new hooks and features. Currently contains over **90** events hooks, networking +abstraction, loader calls abstraction, game registry abstraction and an easy to use @ExpectPlatform annotation (Only +works on static methods). ### Do I really need this API? -Architectury API is only one part of the architectury ecosystem, **Architectury Plugin** is the gradle plugin enabling all this multiplatform actions. -Architectury API is optional for projects built on architectury, you may create your architectury project with just Architectury Plugin. +Architectury API is only one part of the architectury ecosystem, **Architectury Plugin** is the gradle plugin enabling +all this multiplatform actions. + +Architectury API is optional for projects built on architectury, you may create your architectury project with just +Architectury Plugin. ### Advantages of Architectury + - Open sourced - Less boilerplate for your multiplatform mod ### Getting started with making multiplatform mods + Gradle Plugin: https://github.com/architectury/architectury-plugin Example Mod: https://github.com/architectury/architectury-example-mod ### Credits -This library bundles typetools, which you can find its license [here](https://github.com/jhalterman/typetools/blob/master/LICENSE.txt "") + +This library bundles typetools, which you can find its +license [here](https://github.com/jhalterman/typetools/blob/master/LICENSE.txt "") diff --git a/build.gradle b/build.gradle index 135fd185..34c91537 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id "architectury-plugin" version "3.1-SNAPSHOT" + id "architectury-plugin" version "3.2-SNAPSHOT" id "dev.architectury.loom" version "0.7.2-SNAPSHOT" apply false id "org.cadixdev.licenser" version "0.5.0" id "com.matthewprenger.cursegradle" version "1.4.0" apply false @@ -23,11 +23,11 @@ allprojects { apply plugin: "java" apply plugin: "architectury-plugin" apply plugin: "org.cadixdev.licenser" - + ext { isSnapshot = System.getenv("PR_NUM") != null } - + def runNumber = (System.getenv("GITHUB_RUN_NUMBER") == null ? "9999" : System.getenv("GITHUB_RUN_NUMBER")) if (!ext.isSnapshot) { @@ -37,7 +37,7 @@ allprojects { version = rootProject.base_version + "-PR." + System.getenv("PR_NUM") + "." + runNumber archivesBaseName = rootProject.archives_base_name_snapshot } - + group = rootProject.maven_group tasks.withType(JavaCompile) { diff --git a/common/src/main/java/me/shedaniel/architectury/PlatformMethods.java b/common/src/main/java/me/shedaniel/architectury/PlatformMethods.java index 458c3a2d..1f774330 100644 --- a/common/src/main/java/me/shedaniel/architectury/PlatformMethods.java +++ b/common/src/main/java/me/shedaniel/architectury/PlatformMethods.java @@ -32,23 +32,23 @@ public class PlatformMethods { String lookupType = lookupClass.getName().replace("$", "") + "Impl"; String platformExpectedClass = lookupType.substring(0, lookupType.lastIndexOf('.')) + "." + ArchitecturyTarget.getCurrentTarget() + "." + - lookupType.substring(lookupType.lastIndexOf('.') + 1); + lookupType.substring(lookupType.lastIndexOf('.') + 1); Class newClass; try { newClass = Class.forName(platformExpectedClass, false, lookupClass.getClassLoader()); } catch (ClassNotFoundException exception) { throw new PlatformExpectedError(lookupClass.getName() + "#" + name + " expected platform implementation in " + platformExpectedClass + - "#" + name + ", but the class doesn't exist!", exception); + "#" + name + ", but the class doesn't exist!", exception); } MethodHandle platformMethod; try { platformMethod = lookup.findStatic(newClass, name, type); } catch (NoSuchMethodException exception) { throw new PlatformExpectedError(lookupClass.getName() + "#" + name + " expected platform implementation in " + platformExpectedClass + - "#" + name + ", but the method doesn't exist!", exception); + "#" + name + ", but the method doesn't exist!", exception); } catch (IllegalAccessException exception) { throw new PlatformExpectedError(lookupClass.getName() + "#" + name + " expected platform implementation in " + platformExpectedClass + - "#" + name + ", but the method's modifier doesn't match the access requirements!", exception); + "#" + name + ", but the method's modifier doesn't match the access requirements!", exception); } return new ConstantCallSite(platformMethod); } diff --git a/common/src/main/java/me/shedaniel/architectury/event/EventFactory.java b/common/src/main/java/me/shedaniel/architectury/event/EventFactory.java index 792b454b..0831735d 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/EventFactory.java +++ b/common/src/main/java/me/shedaniel/architectury/event/EventFactory.java @@ -37,7 +37,8 @@ import java.util.function.Consumer; import java.util.function.Function; public final class EventFactory { - private EventFactory() {} + private EventFactory() { + } public static Event of(Function, T> function) { return new EventImpl<>(function); diff --git a/common/src/main/java/me/shedaniel/architectury/event/EventHandler.java b/common/src/main/java/me/shedaniel/architectury/event/EventHandler.java index aa7bd970..bf7ad139 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/EventHandler.java +++ b/common/src/main/java/me/shedaniel/architectury/event/EventHandler.java @@ -29,7 +29,8 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; public final class EventHandler { - private EventHandler() {} + private EventHandler() { + } private static boolean initialized = false; diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java index 0794edca..b71c07ba 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java +++ b/common/src/main/java/me/shedaniel/architectury/event/events/LifecycleEvent.java @@ -63,11 +63,13 @@ public interface LifecycleEvent { void stateChanged(T instance); } - interface ServerState extends InstanceState {} + interface ServerState extends InstanceState { + } interface WorldState { void act(T world); } - interface ServerWorldState extends WorldState {} + interface ServerWorldState extends WorldState { + } } diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/TickEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/TickEvent.java index 1e132dc5..6179d956 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/TickEvent.java +++ b/common/src/main/java/me/shedaniel/architectury/event/events/TickEvent.java @@ -35,11 +35,15 @@ public interface TickEvent { void tick(T instance); - interface Server extends TickEvent {} + interface Server extends TickEvent { + } - interface WorldTick extends TickEvent {} + interface WorldTick extends TickEvent { + } - interface ServerWorld extends WorldTick {} + interface ServerWorld extends WorldTick { + } - interface Player extends TickEvent {} + interface Player extends TickEvent { + } } diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientLifecycleEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientLifecycleEvent.java index 86ed4bc9..574ad093 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientLifecycleEvent.java +++ b/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientLifecycleEvent.java @@ -32,11 +32,13 @@ public interface ClientLifecycleEvent { /** * Invoked when client has been initialised, not available in forge. */ - @Deprecated Event CLIENT_STARTED = EventFactory.createLoop(); + @Deprecated + Event CLIENT_STARTED = EventFactory.createLoop(); /** * Invoked when client is stopping, not available in forge. */ - @Deprecated Event CLIENT_STOPPING = EventFactory.createLoop(); + @Deprecated + Event CLIENT_STOPPING = EventFactory.createLoop(); /** * Invoked after a world is loaded only on client, equivalent to forge's {@code WorldEvent.Load}. */ @@ -44,8 +46,10 @@ public interface ClientLifecycleEvent { Event CLIENT_SETUP = EventFactory.createLoop(); @Environment(EnvType.CLIENT) - interface ClientState extends LifecycleEvent.InstanceState {} + interface ClientState extends LifecycleEvent.InstanceState { + } @Environment(EnvType.CLIENT) - interface ClientWorldState extends LifecycleEvent.WorldState {} + interface ClientWorldState extends LifecycleEvent.WorldState { + } } diff --git a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientTickEvent.java b/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientTickEvent.java index 319f80b6..4695ed7d 100644 --- a/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientTickEvent.java +++ b/common/src/main/java/me/shedaniel/architectury/event/events/client/ClientTickEvent.java @@ -36,8 +36,10 @@ public interface ClientTickEvent { void tick(T instance); @Environment(EnvType.CLIENT) - interface Client extends ClientTickEvent {} + interface Client extends ClientTickEvent { + } @Environment(EnvType.CLIENT) - interface ClientWorld extends ClientTickEvent {} + interface ClientWorld extends ClientTickEvent { + } } diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/BlockEntityHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/BlockEntityHooks.java index f44de4c3..b8720687 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/BlockEntityHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/BlockEntityHooks.java @@ -23,7 +23,8 @@ import me.shedaniel.architectury.annotations.ExpectPlatform; import net.minecraft.world.level.block.entity.BlockEntity; public class BlockEntityHooks { - private BlockEntityHooks() {} + private BlockEntityHooks() { + } /** * Sync data to the clients. diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/DyeColorHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/DyeColorHooks.java index 5b378a07..bf70a331 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/DyeColorHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/DyeColorHooks.java @@ -23,7 +23,8 @@ import me.shedaniel.architectury.annotations.ExpectPlatform; import net.minecraft.world.item.DyeColor; public class DyeColorHooks { - private DyeColorHooks() {} + private DyeColorHooks() { + } @ExpectPlatform public static int getColorValue(DyeColor color) { diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java index 2113543d..51527e1b 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java @@ -25,7 +25,8 @@ import net.minecraft.world.phys.shapes.CollisionContext; import org.jetbrains.annotations.Nullable; public final class EntityHooks { - private EntityHooks() {} + private EntityHooks() { + } @ExpectPlatform public static String getEncodeId(Entity entity) { diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java index 60221be7..74ad3a90 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java @@ -26,7 +26,8 @@ import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; public final class ExplosionHooks { - private ExplosionHooks() {} + private ExplosionHooks() { + } @ExpectPlatform public static Vec3 getPosition(Explosion explosion) { diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/FluidStackHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/FluidStackHooks.java index d170a611..ce752f15 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/FluidStackHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/FluidStackHooks.java @@ -34,7 +34,8 @@ import net.minecraft.world.level.material.FluidState; import org.jetbrains.annotations.Nullable; public class FluidStackHooks { - private FluidStackHooks() {} + private FluidStackHooks() { + } @ExpectPlatform public static Component getName(FluidStack stack) { diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/ItemEntityHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/ItemEntityHooks.java index 18ac127c..e140f29f 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/ItemEntityHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/ItemEntityHooks.java @@ -24,7 +24,8 @@ import me.shedaniel.architectury.utils.IntValue; import net.minecraft.world.entity.item.ItemEntity; public final class ItemEntityHooks { - private ItemEntityHooks() {} + private ItemEntityHooks() { + } /** * The lifespan of an {@link ItemEntity}. diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/ItemStackHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/ItemStackHooks.java index 4ea35c01..95dfbd68 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/ItemStackHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/ItemStackHooks.java @@ -26,7 +26,8 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemStack; public final class ItemStackHooks { - private ItemStackHooks() {} + private ItemStackHooks() { + } public static ItemStack copyWithCount(ItemStack stack, int count) { ItemStack copy = stack.copy(); diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java index 23487e36..d47b486a 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java @@ -22,7 +22,8 @@ package me.shedaniel.architectury.hooks; import net.minecraft.world.level.storage.LevelResource; public class LevelResourceHooks { - private LevelResourceHooks() {} + private LevelResourceHooks() { + } public static LevelResource create(String id) { return new LevelResource(id); diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/PackRepositoryHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/PackRepositoryHooks.java index f7bf8182..afb842ce 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/PackRepositoryHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/PackRepositoryHooks.java @@ -24,7 +24,8 @@ import net.minecraft.server.packs.repository.PackRepository; import net.minecraft.server.packs.repository.RepositorySource; public class PackRepositoryHooks { - private PackRepositoryHooks() {} + private PackRepositoryHooks() { + } @ExpectPlatform public static void addSource(PackRepository repository, RepositorySource source) { diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java index 573b2209..3ff8bed4 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java @@ -23,7 +23,8 @@ import me.shedaniel.architectury.annotations.ExpectPlatform; import net.minecraft.world.entity.player.Player; public final class PlayerHooks { - private PlayerHooks() {} + private PlayerHooks() { + } @ExpectPlatform public static boolean isFake(Player player) { diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/ScreenHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/ScreenHooks.java index 471eb86e..4bb1d79b 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/ScreenHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/ScreenHooks.java @@ -30,7 +30,8 @@ import java.util.List; @Environment(EnvType.CLIENT) public final class ScreenHooks { - private ScreenHooks() {} + private ScreenHooks() { + } @ExpectPlatform public static List getButtons(Screen screen) { diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/TagHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/TagHooks.java index 40e5492f..ac732333 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/TagHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/TagHooks.java @@ -31,7 +31,8 @@ import net.minecraft.world.level.material.Fluid; import java.util.function.Supplier; public final class TagHooks { - private TagHooks() {} + private TagHooks() { + } @ExpectPlatform public static Tag.Named getOptional(ResourceLocation id, Supplier> collection) { diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeHooks.java index a3e38746..6c4a6887 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/biome/BiomeHooks.java @@ -31,7 +31,6 @@ import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import net.minecraft.world.level.levelgen.surfacebuilders.ConfiguredSurfaceBuilder; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -61,10 +60,10 @@ public final class BiomeHooks { } public BiomeWrapped(Biome biome, - ClimateProperties climateProperties, - EffectsProperties effectsProperties, - GenerationProperties generationProperties, - SpawnProperties spawnProperties) { + ClimateProperties climateProperties, + EffectsProperties effectsProperties, + GenerationProperties generationProperties, + SpawnProperties spawnProperties) { this.biome = biome; this.climateProperties = climateProperties; this.effectsProperties = effectsProperties; @@ -110,8 +109,8 @@ public final class BiomeHooks { public static class MutableBiomeWrapped extends BiomeWrapped implements BiomeProperties.Mutable { public MutableBiomeWrapped(Biome biome, - GenerationProperties.Mutable generationProperties, - SpawnProperties.Mutable spawnProperties) { + GenerationProperties.Mutable generationProperties, + SpawnProperties.Mutable spawnProperties) { this(biome, new ClimateWrapped(biome.climateSettings), new EffectsWrapped(biome.getSpecialEffects()), @@ -120,10 +119,10 @@ public final class BiomeHooks { } public MutableBiomeWrapped(Biome biome, - ClimateProperties.Mutable climateProperties, - EffectsProperties.Mutable effectsProperties, - GenerationProperties.Mutable generationProperties, - SpawnProperties.Mutable spawnProperties) { + ClimateProperties.Mutable climateProperties, + EffectsProperties.Mutable effectsProperties, + GenerationProperties.Mutable generationProperties, + SpawnProperties.Mutable spawnProperties) { super(biome, climateProperties, effectsProperties, diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/biome/ClimateProperties.java b/common/src/main/java/me/shedaniel/architectury/hooks/biome/ClimateProperties.java index 218572df..270c7e60 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/biome/ClimateProperties.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/biome/ClimateProperties.java @@ -21,7 +21,6 @@ package me.shedaniel.architectury.hooks.biome; import net.minecraft.world.level.biome.Biome.Precipitation; import net.minecraft.world.level.biome.Biome.TemperatureModifier; -import org.jetbrains.annotations.NotNull; public interface ClimateProperties { Precipitation getPrecipitation(); diff --git a/common/src/main/java/me/shedaniel/architectury/platform/Platform.java b/common/src/main/java/me/shedaniel/architectury/platform/Platform.java index ed98685d..e85f3327 100644 --- a/common/src/main/java/me/shedaniel/architectury/platform/Platform.java +++ b/common/src/main/java/me/shedaniel/architectury/platform/Platform.java @@ -32,14 +32,15 @@ import java.util.Collection; import java.util.Optional; public final class Platform { - private Platform() {} + private Platform() { + } private static int simpleLoaderCache = -1; /** * @return the current mod loader, either "fabric" or "forge" * @deprecated does not reflect the true mod loader, "quilt" is never returned, - * use {@link ArchitecturyTarget#getCurrentTarget()} instead. + * use {@link ArchitecturyTarget#getCurrentTarget()} instead. */ @Deprecated @ApiStatus.ScheduledForRemoval(inVersion = "2.0") diff --git a/common/src/main/java/me/shedaniel/architectury/registry/BlockEntityRenderers.java b/common/src/main/java/me/shedaniel/architectury/registry/BlockEntityRenderers.java index 8fd1c96d..67eb88ff 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/BlockEntityRenderers.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/BlockEntityRenderers.java @@ -32,7 +32,8 @@ import java.util.function.Function; @Environment(EnvType.CLIENT) public final class BlockEntityRenderers { - private BlockEntityRenderers() {} + private BlockEntityRenderers() { + } @ExpectPlatform public static void registerRenderer(BlockEntityType type, BlockEntityRendererProvider provider) { diff --git a/common/src/main/java/me/shedaniel/architectury/registry/ColorHandlers.java b/common/src/main/java/me/shedaniel/architectury/registry/ColorHandlers.java index 908d179b..8a4abb80 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/ColorHandlers.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/ColorHandlers.java @@ -32,7 +32,8 @@ import java.util.function.Supplier; @Environment(EnvType.CLIENT) public final class ColorHandlers { - private ColorHandlers() {} + private ColorHandlers() { + } public static void registerItemColors(ItemColor color, ItemLike... items) { Supplier[] array = new Supplier[items.length]; diff --git a/common/src/main/java/me/shedaniel/architectury/registry/CreativeTabs.java b/common/src/main/java/me/shedaniel/architectury/registry/CreativeTabs.java index 3e285dd8..41726c1b 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/CreativeTabs.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/CreativeTabs.java @@ -27,7 +27,8 @@ import net.minecraft.world.item.ItemStack; import java.util.function.Supplier; public final class CreativeTabs { - private CreativeTabs() {} + private CreativeTabs() { + } // I am sorry, fabric wants a resource location instead of the translation key for whatever reason @ExpectPlatform diff --git a/common/src/main/java/me/shedaniel/architectury/registry/CriteriaTriggersRegistry.java b/common/src/main/java/me/shedaniel/architectury/registry/CriteriaTriggersRegistry.java index dbd0dab1..9d4e4995 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/CriteriaTriggersRegistry.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/CriteriaTriggersRegistry.java @@ -23,7 +23,8 @@ import me.shedaniel.architectury.annotations.ExpectPlatform; import net.minecraft.advancements.CriterionTrigger; public final class CriteriaTriggersRegistry { - private CriteriaTriggersRegistry() {} + private CriteriaTriggersRegistry() { + } /** * Invokes {@link net.minecraft.advancements.CriteriaTriggers#register(CriterionTrigger)}. diff --git a/common/src/main/java/me/shedaniel/architectury/registry/GameRuleFactory.java b/common/src/main/java/me/shedaniel/architectury/registry/GameRuleFactory.java index 72a77484..a4928ec4 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/GameRuleFactory.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/GameRuleFactory.java @@ -29,8 +29,9 @@ import java.util.function.BiConsumer; * A utility class for creating game rule types. */ public final class GameRuleFactory { - private GameRuleFactory() {} - + private GameRuleFactory() { + } + /** * Creates a boolean rule type. * @@ -41,7 +42,7 @@ public final class GameRuleFactory { public static GameRules.Type createBooleanRule(boolean defaultValue) { throw new AssertionError(); } - + /** * Creates a boolean rule type. * @@ -53,7 +54,7 @@ public final class GameRuleFactory { public static GameRules.Type createBooleanRule(boolean defaultValue, BiConsumer changedCallback) { throw new AssertionError(); } - + /** * Creates an integer rule type. * @@ -64,7 +65,7 @@ public final class GameRuleFactory { public static GameRules.Type createIntRule(int defaultValue) { throw new AssertionError(); } - + /** * Creates an integer rule type. * diff --git a/common/src/main/java/me/shedaniel/architectury/registry/GameRuleRegistry.java b/common/src/main/java/me/shedaniel/architectury/registry/GameRuleRegistry.java index c6a4946c..3e291d35 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/GameRuleRegistry.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/GameRuleRegistry.java @@ -26,15 +26,16 @@ import net.minecraft.world.level.GameRules; * A registry for registering game rules. */ public final class GameRuleRegistry { - private GameRuleRegistry() {} - + private GameRuleRegistry() { + } + /** * Registers a game rule. * * @param name the rule's name * @param category the rule category * @param type the type of the rule - * @param the type of the rule value + * @param the type of the rule value * @return a key for the registered rule */ @ExpectPlatform diff --git a/common/src/main/java/me/shedaniel/architectury/registry/KeyBindings.java b/common/src/main/java/me/shedaniel/architectury/registry/KeyBindings.java index c774a2fc..27f66a46 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/KeyBindings.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/KeyBindings.java @@ -26,7 +26,8 @@ import net.minecraft.client.KeyMapping; @Environment(EnvType.CLIENT) public final class KeyBindings { - private KeyBindings() {} + private KeyBindings() { + } @ExpectPlatform public static void registerKeyBinding(KeyMapping binding) { diff --git a/common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java b/common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java index f3696b35..7376597b 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/MenuRegistry.java @@ -41,7 +41,8 @@ import java.util.function.Consumer; * A utility class to register {@link MenuType}s and {@link Screen}s for containers */ public final class MenuRegistry { - private MenuRegistry() {} + private MenuRegistry() { + } /** * Opens the menu. diff --git a/common/src/main/java/me/shedaniel/architectury/registry/ReloadListeners.java b/common/src/main/java/me/shedaniel/architectury/registry/ReloadListeners.java index 1cc90a48..9e176e70 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/ReloadListeners.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/ReloadListeners.java @@ -24,7 +24,8 @@ import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.resources.PreparableReloadListener; public final class ReloadListeners { - private ReloadListeners() {} + private ReloadListeners() { + } @ExpectPlatform public static void registerReloadListener(PackType type, PreparableReloadListener listener) { diff --git a/common/src/main/java/me/shedaniel/architectury/registry/RenderTypes.java b/common/src/main/java/me/shedaniel/architectury/registry/RenderTypes.java index a91729d5..a293c853 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/RenderTypes.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/RenderTypes.java @@ -28,7 +28,8 @@ import net.minecraft.world.level.material.Fluid; @Environment(EnvType.CLIENT) public final class RenderTypes { - private RenderTypes() {} + private RenderTypes() { + } @ExpectPlatform public static void register(RenderType type, Block... blocks) { diff --git a/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityAttributes.java b/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityAttributes.java index fe919dc9..c17b8958 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityAttributes.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityAttributes.java @@ -27,7 +27,8 @@ import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import java.util.function.Supplier; public final class EntityAttributes { - private EntityAttributes() {} + private EntityAttributes() { + } /** * Registers default attributes to entities. diff --git a/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityRenderers.java b/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityRenderers.java index 437e9cd4..5ecd1967 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityRenderers.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/entity/EntityRenderers.java @@ -32,7 +32,8 @@ import java.util.function.Function; @Environment(EnvType.CLIENT) public final class EntityRenderers { - private EntityRenderers() {} + private EntityRenderers() { + } @ExpectPlatform public static void register(EntityType type, EntityRendererProvider provider) { diff --git a/common/src/main/java/me/shedaniel/architectury/registry/fuel/FuelRegistry.java b/common/src/main/java/me/shedaniel/architectury/registry/fuel/FuelRegistry.java index b2b0a0dd..32bc7cbd 100644 --- a/common/src/main/java/me/shedaniel/architectury/registry/fuel/FuelRegistry.java +++ b/common/src/main/java/me/shedaniel/architectury/registry/fuel/FuelRegistry.java @@ -24,7 +24,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; public final class FuelRegistry { - private FuelRegistry() {} + private FuelRegistry() { + } /** * Registers a burn time for items. diff --git a/common/src/main/java/me/shedaniel/architectury/registry/trade/SimpleTrade.java b/common/src/main/java/me/shedaniel/architectury/registry/trade/SimpleTrade.java new file mode 100644 index 00000000..4a532bf9 --- /dev/null +++ b/common/src/main/java/me/shedaniel/architectury/registry/trade/SimpleTrade.java @@ -0,0 +1,73 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.registry.trade; + +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.npc.VillagerTrades; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.trading.MerchantOffer; +import org.jetbrains.annotations.Nullable; + +import java.util.Random; + +/** + * This class is the easiest implementation of a trade object. + * All trades added by vanilla do have custom classes like {@link VillagerTrades.EmeraldForItems}, but they aren't accessible. + *

+ * Instead of widening the access of those classes or recreating them, this class was added to serve a basic trading implementation. + * To register a trade, just call + * {@link TradeRegistry#registerVillagerTrade(net.minecraft.world.entity.npc.VillagerProfession, int, VillagerTrades.ItemListing...)} + * or + * {@link TradeRegistry#registerTradeForWanderingTrader(boolean, VillagerTrades.ItemListing...)}. + */ +public class SimpleTrade implements VillagerTrades.ItemListing { + private final ItemStack primaryPrice; + private final ItemStack secondaryPrice; + private final ItemStack sale; + private final int maxTrades; + private final int experiencePoints; + private final float priceMultiplier; + + /** + * Constructor for creating the trade. + * You can take a look at all the values the vanilla game uses right here {@link VillagerTrades#TRADES}. + * + * @param primaryPrice The first price a player has to pay to get the 'sale' stack. + * @param secondaryPrice A optional, secondary price to pay as well as the primary one. If not needed just use {@link ItemStack#EMPTY}. + * @param sale The ItemStack which a player can purchase in exchange for the two prices. + * @param maxTrades The amount of trades one villager or wanderer can do. When the amount is surpassed, the trade can't be purchased anymore. + * @param experiencePoints How much experience points does the player get, when trading. Vanilla uses between 2 and 30 for this. + * @param priceMultiplier How much should the price rise, after the trade is used. It is added to the stack size of the primary price. Vanilla uses between 0.05 and 0.2. + */ + public SimpleTrade(ItemStack primaryPrice, ItemStack secondaryPrice, ItemStack sale, int maxTrades, int experiencePoints, float priceMultiplier) { + this.primaryPrice = primaryPrice; + this.secondaryPrice = secondaryPrice; + this.sale = sale; + this.maxTrades = maxTrades; + this.experiencePoints = experiencePoints; + this.priceMultiplier = priceMultiplier; + } + + @Nullable + @Override + public MerchantOffer getOffer(Entity entity, Random random) { + return new MerchantOffer(this.primaryPrice, this.secondaryPrice, this.sale, this.maxTrades, this.experiencePoints, this.priceMultiplier); + } +} diff --git a/common/src/main/java/me/shedaniel/architectury/registry/trade/TradeRegistry.java b/common/src/main/java/me/shedaniel/architectury/registry/trade/TradeRegistry.java new file mode 100644 index 00000000..c5d96efa --- /dev/null +++ b/common/src/main/java/me/shedaniel/architectury/registry/trade/TradeRegistry.java @@ -0,0 +1,62 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.registry.trade; + +import me.shedaniel.architectury.annotations.ExpectPlatform; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerTrades; + +public class TradeRegistry { + private TradeRegistry() { + } + + /** + * Register a trade ({@link VillagerTrades.ItemListing}) for a villager by its profession and level. + * When the mod loader is Forge, the {@code VillagerTradesEvent} event is used. + * + * @param profession The Profession the villager needs to have this trade. + * @param level The level the villager needs. Vanilla range is 1 to 5, however mods may extend that upper limit further. + * @param trades The trades to add to this profession at the specified level. + */ + public static void registerVillagerTrade(VillagerProfession profession, int level, VillagerTrades.ItemListing... trades) { + if (level < 1) { + throw new IllegalArgumentException("Villager Trade level has to be at least 1!"); + } + registerVillagerTrade0(profession, level, trades); + } + + @ExpectPlatform + private static void registerVillagerTrade0(VillagerProfession profession, int level, VillagerTrades.ItemListing... trades) { + throw new AssertionError(); + } + + /** + * Register a trade ({@link VillagerTrades.ItemListing}) to a wandering trader by its rarity. + * When the mod loader is Forge, the {@code WandererTradesEvent} event is used. + * + * @param rare Whether this trade is "rare". Rare trades have a five times lower chance of being used. + * @param trades The trades to add to the wandering trader. + */ + @ExpectPlatform + public static void registerTradeForWanderingTrader(boolean rare, VillagerTrades.ItemListing... trades) { + throw new AssertionError(); + } + +} diff --git a/common/src/main/java/me/shedaniel/architectury/utils/EnvExecutor.java b/common/src/main/java/me/shedaniel/architectury/utils/EnvExecutor.java index 088a51ce..59de5923 100644 --- a/common/src/main/java/me/shedaniel/architectury/utils/EnvExecutor.java +++ b/common/src/main/java/me/shedaniel/architectury/utils/EnvExecutor.java @@ -56,5 +56,6 @@ public final class EnvExecutor { } } - private EnvExecutor() {} + private EnvExecutor() { + } } diff --git a/common/src/main/java/me/shedaniel/architectury/utils/NbtType.java b/common/src/main/java/me/shedaniel/architectury/utils/NbtType.java index 0a9161b6..7d3d3f42 100644 --- a/common/src/main/java/me/shedaniel/architectury/utils/NbtType.java +++ b/common/src/main/java/me/shedaniel/architectury/utils/NbtType.java @@ -40,5 +40,6 @@ public final class NbtType { */ public static final int NUMBER = 99; - private NbtType() {} + private NbtType() { + } } diff --git a/common/src/main/java/me/shedaniel/architectury/utils/PlatformExpectedError.java b/common/src/main/java/me/shedaniel/architectury/utils/PlatformExpectedError.java index 96bf0d67..e62cb9b4 100644 --- a/common/src/main/java/me/shedaniel/architectury/utils/PlatformExpectedError.java +++ b/common/src/main/java/me/shedaniel/architectury/utils/PlatformExpectedError.java @@ -22,19 +22,19 @@ package me.shedaniel.architectury.utils; public class PlatformExpectedError extends Error { public PlatformExpectedError() { } - + public PlatformExpectedError(String message) { super(message); } - + public PlatformExpectedError(String message, Throwable cause) { super(message, cause); } - + public PlatformExpectedError(Throwable cause) { super(cause); } - + public PlatformExpectedError(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } diff --git a/common/src/main/java/me/shedaniel/architectury/utils/Value.java b/common/src/main/java/me/shedaniel/architectury/utils/Value.java index ecb63d70..27e65a29 100644 --- a/common/src/main/java/me/shedaniel/architectury/utils/Value.java +++ b/common/src/main/java/me/shedaniel/architectury/utils/Value.java @@ -22,4 +22,5 @@ package me.shedaniel.architectury.utils; import java.util.function.Consumer; import java.util.function.Supplier; -public interface Value extends Supplier, Consumer {} +public interface Value extends Supplier, Consumer { +} diff --git a/common/src/main/resources/architectury-common.mixins.json b/common/src/main/resources/architectury-common.mixins.json index 565d6978..403934b2 100644 --- a/common/src/main/resources/architectury-common.mixins.json +++ b/common/src/main/resources/architectury-common.mixins.json @@ -5,7 +5,11 @@ "minVersion": "0.7.11", "client": [ ], - "mixins": ["MixinFallingBlockEntity", "FluidTagsAccessor", "MixinLightningBolt"], + "mixins": [ + "MixinFallingBlockEntity", + "FluidTagsAccessor", + "MixinLightningBolt" + ], "injectors": { "maxShiftBy": 5, "defaultRequire": 1 diff --git a/fabric/src/main/java/me/shedaniel/architectury/compat/fabric/ModMenuCompatibility.java b/fabric/src/main/java/me/shedaniel/architectury/compat/fabric/ModMenuCompatibility.java index 065305be..2d3128ac 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/compat/fabric/ModMenuCompatibility.java +++ b/fabric/src/main/java/me/shedaniel/architectury/compat/fabric/ModMenuCompatibility.java @@ -22,8 +22,8 @@ package me.shedaniel.architectury.compat.fabric; import com.google.common.collect.Maps; import io.github.prospector.modmenu.api.ConfigScreenFactory; import io.github.prospector.modmenu.api.ModMenuApi; -import me.shedaniel.architectury.platform.fabric.PlatformImpl; import me.shedaniel.architectury.platform.Mod; +import me.shedaniel.architectury.platform.fabric.PlatformImpl; import java.util.Map; diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/BlockEntityHooksImpl.java b/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/BlockEntityHooksImpl.java index 9df256a3..867ec8d5 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/BlockEntityHooksImpl.java +++ b/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/BlockEntityHooksImpl.java @@ -19,7 +19,6 @@ package me.shedaniel.architectury.hooks.fabric; -import com.google.common.base.Preconditions; import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/ExplosionPreInvoker.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/ExplosionPreInvoker.java index d6d352bd..ad00385d 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/ExplosionPreInvoker.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/ExplosionPreInvoker.java @@ -35,10 +35,10 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(value = {Level.class, ServerLevel.class}) public class ExplosionPreInvoker { - @Inject(method = "explode(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;)Lnet/minecraft/world/level/Explosion;", + @Inject(method = "explode(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Explosion$BlockInteraction;)Lnet/minecraft/world/level/Explosion;", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Explosion;explode()V"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) private void explodePre(Entity entity, DamageSource damageSource, ExplosionDamageCalculator explosionDamageCalculator, double d, double e, double f, float g, boolean bl, Explosion.BlockInteraction blockInteraction, CallbackInfoReturnable cir, Explosion explosion) { - if (ExplosionEvent.PRE.invoker().explode((Level)(Object) this, explosion) == InteractionResult.FAIL) { + if (ExplosionEvent.PRE.invoker().explode((Level) (Object) this, explosion) == InteractionResult.FAIL) { cir.setReturnValue(explosion); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockItem.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockItem.java index 70c31fb9..04405873 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockItem.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinBlockItem.java @@ -32,7 +32,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; public abstract class MixinBlockItem { @Inject(method = "place", at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/item/context/BlockPlaceContext;getClickedPos()Lnet/minecraft/core/BlockPos;"), + target = "Lnet/minecraft/world/item/context/BlockPlaceContext;getClickedPos()Lnet/minecraft/core/BlockPos;"), cancellable = true) private void place(BlockPlaceContext context, CallbackInfoReturnable cir) { InteractionResult result = BlockEvent.PLACE.invoker().placeBlock(context.getLevel(), context.getClickedPos(), context.getLevel().getBlockState(context.getClickedPos()), context.getPlayer()); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCommands.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCommands.java index 70de43ae..af5d3be2 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCommands.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinCommands.java @@ -35,7 +35,7 @@ import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(Commands.class) public class MixinCommands { @Redirect(method = "performCommand", - at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/CommandDispatcher;execute(Lcom/mojang/brigadier/StringReader;Ljava/lang/Object;)I", remap = false)) + at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/CommandDispatcher;execute(Lcom/mojang/brigadier/StringReader;Ljava/lang/Object;)I", remap = false)) private int performCommand(CommandDispatcher dispatcher, StringReader input, Object source) throws CommandSyntaxException { CommandSourceStack stack = (CommandSourceStack) source; ParseResults parse = dispatcher.parse(input, stack); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java index ce4b5d14..a777903f 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java @@ -38,13 +38,28 @@ import java.util.Set; @Mixin(Explosion.class) public class MixinExplosion implements ExplosionHooksImpl.ExplosionExtensions { - @Shadow @Final private Level level; - @Shadow @Final private double x; - @Shadow @Final private double y; - @Shadow @Final private double z; - @Shadow @Final @Nullable private Entity source; - @Shadow @Final @Mutable private float radius; - @Unique Vec3 position; + @Shadow + @Final + private Level level; + @Shadow + @Final + private double x; + @Shadow + @Final + private double y; + @Shadow + @Final + private double z; + @Shadow + @Final + @Nullable + private Entity source; + @Shadow + @Final + @Mutable + private float radius; + @Unique + Vec3 position; @Inject(method = "explode", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/phys/Vec3;(DDD)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFarmBlock.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFarmBlock.java index c2e27c85..422df92b 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFarmBlock.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFarmBlock.java @@ -21,19 +21,15 @@ package me.shedaniel.architectury.mixin.fabric; import me.shedaniel.architectury.event.events.InteractionEvent; import net.minecraft.core.BlockPos; -import net.minecraft.util.Tuple; -import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.FarmBlock; import net.minecraft.world.level.block.state.BlockState; import org.apache.commons.lang3.tuple.Triple; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(FarmBlock.class) diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFurnaceResultSlot.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFurnaceResultSlot.java index 27692b9d..fcd89347 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFurnaceResultSlot.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinFurnaceResultSlot.java @@ -32,7 +32,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(FurnaceResultSlot.class) public class MixinFurnaceResultSlot { - @Shadow @Final private Player player; + @Shadow + @Final + private Player player; @Inject(method = "checkTakeAchievements", at = @At("RETURN")) private void checkTakeAchievements(ItemStack itemStack, CallbackInfo ci) { diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinNaturalSpawner.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinNaturalSpawner.java index 65977ee8..c068200f 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinNaturalSpawner.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinNaturalSpawner.java @@ -22,7 +22,8 @@ package me.shedaniel.architectury.mixin.fabric; import me.shedaniel.architectury.event.EventResult; import me.shedaniel.architectury.event.events.EntityEvent; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.*; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.NaturalSpawner; import org.spongepowered.asm.mixin.Mixin; diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPhantomSpawner.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPhantomSpawner.java index 322b79e6..8c5a5a09 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPhantomSpawner.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPhantomSpawner.java @@ -53,8 +53,8 @@ public abstract class MixinPhantomSpawner { locals = LocalCapture.CAPTURE_FAILSOFT // SOFT, because this will break in 2 seconds ) private void checkPhantomSpawn(ServerLevel level, boolean bl, boolean bl2, CallbackInfoReturnable cir, - Random random, int i, Iterator it, Player player, BlockPos pos, DifficultyInstance diff, BlockPos pos2, - SpawnGroupData sgd, int l, int m, Phantom entity) { + Random random, int i, Iterator it, Player player, BlockPos pos, DifficultyInstance diff, BlockPos pos2, + SpawnGroupData sgd, int l, int m, Phantom entity) { if (EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(entity, level, pos.getX(), pos.getY(), pos.getZ(), MobSpawnType.NATURAL, null).value() == Boolean.FALSE) { cir.setReturnValue(0); cir.cancel(); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayer.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayer.java index 1af6979c..07fd34ad 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayer.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayer.java @@ -54,8 +54,8 @@ public class MixinPlayer { } @Inject(method = "interactOn", at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/entity/player/Player;getItemInHand(Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/world/item/ItemStack;", - ordinal = 0), + target = "Lnet/minecraft/world/entity/player/Player;getItemInHand(Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/world/item/ItemStack;", + ordinal = 0), cancellable = true) private void entityInteract(Entity entity, InteractionHand interactionHand, CallbackInfoReturnable cir) { InteractionResult result = InteractionEvent.INTERACT_ENTITY.invoker().interact((Player) (Object) this, entity, interactionHand); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerAdvancements.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerAdvancements.java index 5edda21d..4cb98a2c 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerAdvancements.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinPlayerAdvancements.java @@ -31,11 +31,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(PlayerAdvancements.class) public class MixinPlayerAdvancements { - @Shadow private ServerPlayer player; + @Shadow + private ServerPlayer player; @Inject(method = "award", at = @At(value = "INVOKE", target = "Lnet/minecraft/advancements/AdvancementRewards;grant(Lnet/minecraft/server/level/ServerPlayer;)V", - shift = At.Shift.AFTER)) + shift = At.Shift.AFTER)) private void award(Advancement advancement, String string, CallbackInfoReturnable cir) { PlayerEvent.PLAYER_ADVANCEMENT.invoker().award(player, advancement); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinResultSlot.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinResultSlot.java index 7fd0ca1c..ba839b75 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinResultSlot.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinResultSlot.java @@ -33,13 +33,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ResultSlot.class) public class MixinResultSlot { - @Shadow @Final private Player player; + @Shadow + @Final + private Player player; - @Shadow @Final private CraftingContainer craftSlots; + @Shadow + @Final + private CraftingContainer craftSlots; @Inject(method = "checkTakeAchievements", at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/item/ItemStack;onCraftedBy(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;I)V", - shift = At.Shift.AFTER)) + target = "Lnet/minecraft/world/item/ItemStack;onCraftedBy(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;I)V", + shift = At.Shift.AFTER)) private void craft(ItemStack itemStack, CallbackInfo ci) { PlayerEvent.CRAFT_ITEM.invoker().craft(player, itemStack, craftSlots); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java index 3c2c5b45..fdf7fbab 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerGamePacketListenerImpl.java @@ -24,14 +24,12 @@ import me.shedaniel.architectury.impl.fabric.ChatComponentImpl; import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TranslatableComponent; -import net.minecraft.network.protocol.game.ServerboundChatPacket; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.server.network.TextFilter; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; -import org.apache.commons.lang3.StringUtils; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -44,11 +42,15 @@ import java.util.Objects; @Mixin(ServerGamePacketListenerImpl.class) public abstract class MixinServerGamePacketListenerImpl { - @Shadow public ServerPlayer player; + @Shadow + public ServerPlayer player; - @Shadow @Final private MinecraftServer server; + @Shadow + @Final + private MinecraftServer server; - @Shadow private int chatSpamTickCount; + @Shadow + private int chatSpamTickCount; @Shadow public abstract void disconnect(Component component); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayer.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayer.java index eb1a2802..746ed323 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayer.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayer.java @@ -54,7 +54,7 @@ public class MixinServerPlayer { @Inject(method = "doCloseContainer", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/inventory/AbstractContainerMenu;removed(Lnet/minecraft/world/entity/player/Player;)V", - shift = At.Shift.AFTER)) + shift = At.Shift.AFTER)) private void doCloseContainer(CallbackInfo ci) { PlayerEvent.CLOSE_MENU.invoker().close((ServerPlayer) (Object) this, ((ServerPlayer) (Object) this).containerMenu); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayerGameMode.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayerGameMode.java index 6e8620a6..8d6188a6 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayerGameMode.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinServerPlayerGameMode.java @@ -35,13 +35,15 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(ServerPlayerGameMode.class) public class MixinServerPlayerGameMode { - @Shadow public ServerLevel level; + @Shadow + public ServerLevel level; - @Shadow public ServerPlayer player; + @Shadow + public ServerPlayer player; @Inject(method = "destroyBlock", at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/level/block/state/BlockState;getBlock()Lnet/minecraft/world/level/block/Block;", - ordinal = 0), + target = "Lnet/minecraft/world/level/block/state/BlockState;getBlock()Lnet/minecraft/world/level/block/Block;", + ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) private void onBreak(BlockPos blockPos, CallbackInfoReturnable cir, BlockState state) { if (BlockEvent.BREAK.invoker().breakBlock(this.level, blockPos, state, this.player, null) == InteractionResult.FAIL) { diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientPacketListener.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientPacketListener.java index 766ba948..c17c5f2e 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientPacketListener.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinClientPacketListener.java @@ -43,9 +43,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ClientPacketListener.class) public class MixinClientPacketListener { - @Shadow private Minecraft minecraft; - @Shadow @Final private RecipeManager recipeManager; - @Unique private LocalPlayer tmpPlayer; + @Shadow + private Minecraft minecraft; + @Shadow + @Final + private RecipeManager recipeManager; + @Unique + private LocalPlayer tmpPlayer; @Inject(method = "handleLogin", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Options;broadcastOptions()V")) private void handleLogin(ClientboundLoginPacket packet, CallbackInfo ci) { @@ -58,14 +62,14 @@ public class MixinClientPacketListener { } @Inject(method = "handleRespawn", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/multiplayer/ClientLevel;addPlayer(ILnet/minecraft/client/player/AbstractClientPlayer;)V")) + target = "Lnet/minecraft/client/multiplayer/ClientLevel;addPlayer(ILnet/minecraft/client/player/AbstractClientPlayer;)V")) private void handleRespawn(ClientboundRespawnPacket packet, CallbackInfo ci) { ClientPlayerEvent.CLIENT_PLAYER_RESPAWN.invoker().respawn(tmpPlayer, minecraft.player); this.tmpPlayer = null; } @Inject(method = "handleChat", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/Gui;handleChat(Lnet/minecraft/network/chat/ChatType;Lnet/minecraft/network/chat/Component;Ljava/util/UUID;)V"), + target = "Lnet/minecraft/client/gui/Gui;handleChat(Lnet/minecraft/network/chat/ChatType;Lnet/minecraft/network/chat/Component;Ljava/util/UUID;)V"), cancellable = true) private void handleChat(ClientboundChatPacket packet, CallbackInfo ci) { InteractionResultHolder process = ClientChatEvent.CLIENT_RECEIVED.invoker().process(packet.getType(), packet.getMessage(), packet.getSender()); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinGameRenderer.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinGameRenderer.java index a04a291d..f874f9e7 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinGameRenderer.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinGameRenderer.java @@ -34,11 +34,13 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(GameRenderer.class) public abstract class MixinGameRenderer { - @Shadow @Final private Minecraft minecraft; + @Shadow + @Final + private Minecraft minecraft; @Inject(method = "render(FJZ)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;render(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V", - ordinal = 0), locals = LocalCapture.CAPTURE_FAILEXCEPTION, cancellable = true) + ordinal = 0), locals = LocalCapture.CAPTURE_FAILEXCEPTION, cancellable = true) public void renderScreenPre(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, PoseStack matrices) { if (GuiEvent.RENDER_PRE.invoker().render(minecraft.screen, matrices, mouseX, mouseY, minecraft.getDeltaFrameTime()) == InteractionResult.FAIL) { ci.cancel(); @@ -47,7 +49,7 @@ public abstract class MixinGameRenderer { @Inject(method = "render(FJZ)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;render(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V", - shift = At.Shift.AFTER, ordinal = 0), locals = LocalCapture.CAPTURE_FAILEXCEPTION) + shift = At.Shift.AFTER, ordinal = 0), locals = LocalCapture.CAPTURE_FAILEXCEPTION) public void renderScreenPost(float tickDelta, long startTime, boolean tick, CallbackInfo ci, int mouseX, int mouseY, PoseStack matrices) { GuiEvent.RENDER_POST.invoker().render(minecraft.screen, matrices, mouseX, mouseY, minecraft.getDeltaFrameTime()); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinKeyboardHandler.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinKeyboardHandler.java index ab7e3169..bb63b077 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinKeyboardHandler.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinKeyboardHandler.java @@ -78,8 +78,8 @@ public class MixinKeyboardHandler { } @Inject(method = "keyPress", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/screens/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V", - ordinal = 0), cancellable = true) + target = "Lnet/minecraft/client/gui/screens/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V", + ordinal = 0), cancellable = true) public void onKey(long long_1, int int_1, int int_2, int int_3, int int_4, CallbackInfo info) { if (!info.isCancelled()) { if (int_3 != 1 && (int_3 != 2 || !this.sendRepeatsToGui)) { @@ -97,8 +97,8 @@ public class MixinKeyboardHandler { } @Inject(method = "keyPress", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/screens/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V", - ordinal = 0, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD, + target = "Lnet/minecraft/client/gui/screens/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V", + ordinal = 0, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) public void onKeyAfter(long long_1, int int_1, int int_2, int int_3, int int_4, CallbackInfo info, ContainerEventHandler containerEventHandler, boolean bls[]) { if (!info.isCancelled() && !bls[0]) { diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMinecraft.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMinecraft.java index aa36a7a9..25d818c0 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMinecraft.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMinecraft.java @@ -43,9 +43,13 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Unique @Mixin(Minecraft.class) public abstract class MixinMinecraft { - @Shadow @Nullable public LocalPlayer player; + @Shadow + @Nullable + public LocalPlayer player; - @Shadow @Nullable public HitResult hitResult; + @Shadow + @Nullable + public HitResult hitResult; @Shadow public abstract void setScreen(@Nullable Screen screen); @@ -75,10 +79,10 @@ public abstract class MixinMinecraft { @ModifyVariable( method = "setScreen", at = @At(value = "FIELD", - opcode = Opcodes.PUTFIELD, - target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;", - shift = At.Shift.BY, - by = -1), + opcode = Opcodes.PUTFIELD, + target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;", + shift = At.Shift.BY, + by = -1), argsOnly = true ) public Screen modifyScreen(Screen screen) { @@ -102,10 +106,10 @@ public abstract class MixinMinecraft { @Inject( method = "setScreen", at = @At(value = "FIELD", - opcode = Opcodes.PUTFIELD, - target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;", - shift = At.Shift.BY, - by = -1), + opcode = Opcodes.PUTFIELD, + target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;", + shift = At.Shift.BY, + by = -1), cancellable = true ) public void cancelSetScreen(@Nullable Screen screen, CallbackInfo ci) { diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMouseHandler.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMouseHandler.java index a39bccc6..3fcd138b 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMouseHandler.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMouseHandler.java @@ -52,7 +52,7 @@ public class MixinMouseHandler { @Inject(method = "onScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDD)Z", - ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) + ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) public void onMouseScrolled(long handle, double xOffset, double yOffset, CallbackInfo info, double amount, double x, double y) { if (!info.isCancelled()) { InteractionResult result = ClientScreenInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount); @@ -63,7 +63,7 @@ public class MixinMouseHandler { @Inject(method = "onScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDD)Z", - ordinal = 0, shift = At.Shift.AFTER), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) + ordinal = 0, shift = At.Shift.AFTER), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) public void onMouseScrolledPost(long handle, double xOffset, double yOffset, CallbackInfo info, double amount, double x, double y) { if (!info.isCancelled()) { InteractionResult result = ClientScreenInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount); @@ -72,7 +72,7 @@ public class MixinMouseHandler { @Inject(method = "onScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z", - ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) + ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) public void onRawMouseScrolled(long handle, double xOffset, double yOffset, CallbackInfo info, double amount) { if (!info.isCancelled()) { InteractionResult result = ClientRawInputEvent.MOUSE_SCROLLED.invoker().mouseScrolled(minecraft, amount); @@ -107,7 +107,7 @@ public class MixinMouseHandler { @Inject(method = "onPress", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getOverlay()Lnet/minecraft/client/gui/screens/Overlay;", - ordinal = 0), cancellable = true) + ordinal = 0), cancellable = true) public void onRawMouseClicked(long handle, int button, int action, int mods, CallbackInfo info) { if (!info.isCancelled()) { InteractionResult result = ClientRawInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(minecraft, button, action, mods); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java index ccb9edb0..653706af 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinMultiPlayerGameMode.java @@ -34,7 +34,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; public class MixinMultiPlayerGameMode { @Inject(method = "interact", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientPacketListener;send(Lnet/minecraft/network/protocol/Packet;)V", - shift = At.Shift.AFTER), + shift = At.Shift.AFTER), cancellable = true) private void entityInteract(Player player, Entity entity, InteractionHand interactionHand, CallbackInfoReturnable cir) { InteractionResult result = InteractionEvent.INTERACT_ENTITY.invoker().interact(player, entity, interactionHand); diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinScreen.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinScreen.java index ce3f0f0a..1aaea406 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinScreen.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinScreen.java @@ -44,9 +44,13 @@ import java.util.List; @Mixin(Screen.class) public abstract class MixinScreen implements ScreenInputDelegate { - @Shadow @Final public List buttons; - @Unique private static ThreadLocal tooltipPositionContext = ThreadLocal.withInitial(TooltipEventPositionContextImpl::new); - @Unique private static ThreadLocal tooltipColorContext = ThreadLocal.withInitial(TooltipEventColorContextImpl::new); + @Shadow + @Final + public List buttons; + @Unique + private static ThreadLocal tooltipPositionContext = ThreadLocal.withInitial(TooltipEventPositionContextImpl::new); + @Unique + private static ThreadLocal tooltipColorContext = ThreadLocal.withInitial(TooltipEventColorContextImpl::new); @Shadow public abstract List children(); @@ -102,13 +106,13 @@ public abstract class MixinScreen implements ScreenInputDelegate { } @ModifyVariable(method = "renderTooltipInternal", - at = @At(value = "HEAD"), ordinal = 0) + at = @At(value = "HEAD"), ordinal = 0) private int modifyTooltipX(int original) { return tooltipPositionContext.get().getTooltipX(); } @ModifyVariable(method = "renderTooltipInternal", - at = @At(value = "HEAD"), ordinal = 1) + at = @At(value = "HEAD"), ordinal = 1) private int modifyTooltipY(int original) { return tooltipPositionContext.get().getTooltipY(); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinTextureAtlas.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinTextureAtlas.java index f2cc8ae9..adcd07e5 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinTextureAtlas.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/client/MixinTextureAtlas.java @@ -38,7 +38,7 @@ import java.util.stream.Stream; public class MixinTextureAtlas { @Inject(method = "prepareToStitch", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V", ordinal = 0, - shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) + shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) private void preStitch(ResourceManager resourceManager, Stream stream, ProfilerFiller profilerFiller, int i, CallbackInfoReturnable cir, Set set) { TextureStitchEvent.PRE.invoker().stitch((TextureAtlas) (Object) this, set::add); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BiomeModificationsImpl.java b/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BiomeModificationsImpl.java index 8a88317c..3dcfa077 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BiomeModificationsImpl.java +++ b/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BiomeModificationsImpl.java @@ -79,13 +79,13 @@ public class BiomeModificationsImpl { static { BiomeModification modification = net.fabricmc.fabric.api.biome.v1.BiomeModifications.create(FABRIC_MODIFICATION); - registerModification(modification,ModificationPhase.ADDITIONS, ADDITIONS); - registerModification(modification,ModificationPhase.POST_PROCESSING, POST_PROCESSING); - registerModification(modification,ModificationPhase.REMOVALS, REMOVALS); - registerModification(modification,ModificationPhase.REPLACEMENTS, REPLACEMENTS); + registerModification(modification, ModificationPhase.ADDITIONS, ADDITIONS); + registerModification(modification, ModificationPhase.POST_PROCESSING, POST_PROCESSING); + registerModification(modification, ModificationPhase.REMOVALS, REMOVALS); + registerModification(modification, ModificationPhase.REPLACEMENTS, REPLACEMENTS); } - private static void registerModification( BiomeModification modification, ModificationPhase phase, List, BiConsumer>> list ) { + private static void registerModification(BiomeModification modification, ModificationPhase phase, List, BiConsumer>> list) { modification.add(phase, Predicates.alwaysTrue(), (biomeSelectionContext, biomeModificationContext) -> { BiomeContext biomeContext = wrapSelectionContext(biomeSelectionContext); BiomeProperties.Mutable mutableBiome = wrapMutableBiome(biomeSelectionContext.getBiome(), biomeModificationContext); @@ -153,43 +153,43 @@ public class BiomeModificationsImpl { super(biome); this.context = context; } - + @Override public Mutable setSurfaceBuilder(ConfiguredSurfaceBuilder builder) { this.context.setBuiltInSurfaceBuilder(builder); return this; } - + @Override public Mutable addFeature(GenerationStep.Decoration decoration, ConfiguredFeature feature) { this.context.addBuiltInFeature(decoration, feature); return this; } - + @Override public Mutable addCarver(GenerationStep.Carving carving, ConfiguredWorldCarver feature) { context.addBuiltInCarver(carving, feature); return this; } - + @Override public Mutable addStructure(ConfiguredStructureFeature feature) { context.addBuiltInStructure(feature); return this; } - + @Override public Mutable removeFeature(GenerationStep.Decoration decoration, ConfiguredFeature feature) { context.removeBuiltInFeature(decoration, feature); return this; } - + @Override public Mutable removeCarver(GenerationStep.Carving carving, ConfiguredWorldCarver feature) { context.removeBuiltInCarver(carving, feature); return this; } - + @Override public Mutable removeStructure(ConfiguredStructureFeature feature) { context.removeBuiltInStructure(feature); @@ -199,47 +199,47 @@ public class BiomeModificationsImpl { private static class MutableSpawnProperties extends BiomeHooks.SpawnSettingsWrapped implements SpawnProperties.Mutable { protected final SpawnSettingsContext context; - + public MutableSpawnProperties(Biome biome, SpawnSettingsContext context) { super(biome); this.context = context; } - + @Override public @NotNull Mutable setCreatureProbability(float probability) { context.setCreatureSpawnProbability(probability); return this; } - + @Override public Mutable addSpawn(MobCategory category, MobSpawnSettings.SpawnerData data) { context.addSpawn(category, data); return this; } - + @Override public boolean removeSpawns(BiPredicate predicate) { return context.removeSpawns(predicate); } - + @Override public Mutable setSpawnCost(EntityType entityType, MobSpawnSettings.MobSpawnCost cost) { context.setSpawnCost(entityType, cost.getCharge(), cost.getEnergyBudget()); return this; } - + @Override public Mutable setSpawnCost(EntityType entityType, double mass, double gravityLimit) { context.setSpawnCost(entityType, mass, gravityLimit); return this; } - + @Override public Mutable clearSpawnCost(EntityType entityType) { context.clearSpawnCost(entityType); return this; } - + @Override public @NotNull Mutable setPlayerSpawnFriendly(boolean friendly) { context.setPlayerSpawnFriendly(friendly); diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleFactoryImpl.java b/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleFactoryImpl.java index 6ee405f6..0506c6d5 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleFactoryImpl.java +++ b/fabric/src/main/java/me/shedaniel/architectury/registry/fabric/GameRuleFactoryImpl.java @@ -29,15 +29,15 @@ public class GameRuleFactoryImpl { public static GameRules.Type createBooleanRule(boolean defaultValue) { return GameRuleFactory.createBooleanRule(defaultValue); } - + public static GameRules.Type createBooleanRule(boolean defaultValue, BiConsumer changedCallback) { return GameRuleFactory.createBooleanRule(defaultValue, changedCallback); } - + public static GameRules.Type createIntRule(int defaultValue) { return GameRuleFactory.createIntRule(defaultValue); } - + public static GameRules.Type createIntRule(int defaultValue, BiConsumer changedCallback) { return GameRuleFactory.createIntRule(defaultValue, changedCallback); } diff --git a/fabric/src/main/java/me/shedaniel/architectury/registry/trade/fabric/TradeRegistryImpl.java b/fabric/src/main/java/me/shedaniel/architectury/registry/trade/fabric/TradeRegistryImpl.java new file mode 100644 index 00000000..b2802972 --- /dev/null +++ b/fabric/src/main/java/me/shedaniel/architectury/registry/trade/fabric/TradeRegistryImpl.java @@ -0,0 +1,36 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.registry.trade.fabric; + +import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerTrades; + +import java.util.Collections; + +public class TradeRegistryImpl { + public static void registerVillagerTrade0(VillagerProfession profession, int level, VillagerTrades.ItemListing... trades) { + TradeOfferHelper.registerVillagerOffers(profession, level, allTradesList -> Collections.addAll(allTradesList, trades)); + } + + public static void registerTradeForWanderingTrader(boolean rare, VillagerTrades.ItemListing... trades) { + TradeOfferHelper.registerWanderingTraderOffers(rare ? 2 : 1, allTradesList -> Collections.addAll(allTradesList, trades)); + } +} diff --git a/forge/build.gradle b/forge/build.gradle index 5be4ef4b..268e33e7 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -68,7 +68,7 @@ publishing { } } } - + repositories { if (System.getenv("MAVEN_PASS") != null) { maven { diff --git a/forge/gradle.properties b/forge/gradle.properties index 82425854..32f842a6 100644 --- a/forge/gradle.properties +++ b/forge/gradle.properties @@ -1 +1 @@ -loom.platform=forge +loom.platform=forge \ No newline at end of file diff --git a/forge/src/main/java/me/shedaniel/architectury/hooks/forge/FluidStackHooksForge.java b/forge/src/main/java/me/shedaniel/architectury/hooks/forge/FluidStackHooksForge.java index 16955d58..808cf3f9 100644 --- a/forge/src/main/java/me/shedaniel/architectury/hooks/forge/FluidStackHooksForge.java +++ b/forge/src/main/java/me/shedaniel/architectury/hooks/forge/FluidStackHooksForge.java @@ -23,7 +23,8 @@ import me.shedaniel.architectury.fluid.FluidStack; import me.shedaniel.architectury.utils.Fraction; public final class FluidStackHooksForge { - private FluidStackHooksForge() {} + private FluidStackHooksForge() { + } public static FluidStack fromForge(net.minecraftforge.fluids.FluidStack stack) { return FluidStack.create(stack.getFluid().delegate, Fraction.ofWhole(stack.getAmount()), stack.getTag()); diff --git a/forge/src/main/java/me/shedaniel/architectury/networking/forge/NetworkManagerImpl.java b/forge/src/main/java/me/shedaniel/architectury/networking/forge/NetworkManagerImpl.java index 5ec26f0b..b7975911 100644 --- a/forge/src/main/java/me/shedaniel/architectury/networking/forge/NetworkManagerImpl.java +++ b/forge/src/main/java/me/shedaniel/architectury/networking/forge/NetworkManagerImpl.java @@ -33,7 +33,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; diff --git a/forge/src/main/java/me/shedaniel/architectury/platform/forge/EventBuses.java b/forge/src/main/java/me/shedaniel/architectury/platform/forge/EventBuses.java index 3fd13c9f..2709ad85 100644 --- a/forge/src/main/java/me/shedaniel/architectury/platform/forge/EventBuses.java +++ b/forge/src/main/java/me/shedaniel/architectury/platform/forge/EventBuses.java @@ -25,7 +25,8 @@ import java.util.*; import java.util.function.Consumer; public final class EventBuses { - private EventBuses() {} + private EventBuses() { + } private static final Map EVENT_BUS_MAP = new HashMap<>(); private static final Map>> ON_REGISTERED = new HashMap<>(); diff --git a/forge/src/main/java/me/shedaniel/architectury/registry/entity/forge/EntityAttributesImpl.java b/forge/src/main/java/me/shedaniel/architectury/registry/entity/forge/EntityAttributesImpl.java index 369127aa..79ff13bf 100644 --- a/forge/src/main/java/me/shedaniel/architectury/registry/entity/forge/EntityAttributesImpl.java +++ b/forge/src/main/java/me/shedaniel/architectury/registry/entity/forge/EntityAttributesImpl.java @@ -27,7 +27,6 @@ import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraftforge.event.entity.EntityAttributeCreationEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; diff --git a/forge/src/main/java/me/shedaniel/architectury/registry/forge/BiomeModificationsImpl.java b/forge/src/main/java/me/shedaniel/architectury/registry/forge/BiomeModificationsImpl.java index ca3a2b6f..83b09db6 100644 --- a/forge/src/main/java/me/shedaniel/architectury/registry/forge/BiomeModificationsImpl.java +++ b/forge/src/main/java/me/shedaniel/architectury/registry/forge/BiomeModificationsImpl.java @@ -157,7 +157,9 @@ public class BiomeModificationsImpl { private static class GenerationSettingsBuilderWrapped implements GenerationProperties { protected final BiomeGenerationSettingsBuilder generation; - public GenerationSettingsBuilderWrapped(BiomeGenerationSettingsBuilder generation) {this.generation = generation;} + public GenerationSettingsBuilderWrapped(BiomeGenerationSettingsBuilder generation) { + this.generation = generation; + } @Override public @NotNull Optional>> getSurfaceBuilder() { @@ -184,7 +186,9 @@ public class BiomeModificationsImpl { private static class SpawnSettingsBuilderWrapped implements SpawnProperties { protected final MobSpawnInfoBuilder builder; - public SpawnSettingsBuilderWrapped(MobSpawnInfoBuilder builder) {this.builder = builder;} + public SpawnSettingsBuilderWrapped(MobSpawnInfoBuilder builder) { + this.builder = builder; + } @Override public float getCreatureProbability() { diff --git a/forge/src/main/java/me/shedaniel/architectury/registry/forge/GameRuleFactoryImpl.java b/forge/src/main/java/me/shedaniel/architectury/registry/forge/GameRuleFactoryImpl.java index 3051ad01..72354bbd 100644 --- a/forge/src/main/java/me/shedaniel/architectury/registry/forge/GameRuleFactoryImpl.java +++ b/forge/src/main/java/me/shedaniel/architectury/registry/forge/GameRuleFactoryImpl.java @@ -26,7 +26,8 @@ import net.minecraft.world.level.GameRules; import java.util.function.BiConsumer; public class GameRuleFactoryImpl { - private GameRuleFactoryImpl() {} + private GameRuleFactoryImpl() { + } public static GameRules.Type createBooleanRule(boolean defaultValue) { return GameRulesAccessor.BooleanValueSimple.invokeCreateArchitectury(defaultValue); diff --git a/forge/src/main/java/me/shedaniel/architectury/registry/trade/forge/TradeRegistryImpl.java b/forge/src/main/java/me/shedaniel/architectury/registry/trade/forge/TradeRegistryImpl.java new file mode 100644 index 00000000..8cc7b2bf --- /dev/null +++ b/forge/src/main/java/me/shedaniel/architectury/registry/trade/forge/TradeRegistryImpl.java @@ -0,0 +1,75 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.registry.trade.forge; + +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import me.shedaniel.architectury.forge.ArchitecturyForge; +import net.minecraft.core.NonNullList; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerTrades; +import net.minecraftforge.event.village.VillagerTradesEvent; +import net.minecraftforge.event.village.WandererTradesEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +import java.util.*; + +@Mod.EventBusSubscriber(modid = ArchitecturyForge.MOD_ID) +public class TradeRegistryImpl { + private static final Map>> TRADES_TO_ADD = new HashMap<>(); + private static final List WANDERER_TRADER_TRADES_GENERIC = new ArrayList<>(); + private static final List WANDERER_TRADER_TRADES_RARE = new ArrayList<>(); + + public static void registerVillagerTrade0(VillagerProfession profession, int level, VillagerTrades.ItemListing... trades) { + Int2ObjectMap> tradesForProfession = TRADES_TO_ADD.computeIfAbsent(profession, $ -> new Int2ObjectOpenHashMap<>()); + List tradesForLevel = tradesForProfession.computeIfAbsent(level, $ -> new ArrayList<>()); + Collections.addAll(tradesForLevel, trades); + } + + public static void registerTradeForWanderingTrader(boolean rare, VillagerTrades.ItemListing... trades) { + if (rare) { + Collections.addAll(WANDERER_TRADER_TRADES_RARE, trades); + } else { + Collections.addAll(WANDERER_TRADER_TRADES_GENERIC, trades); + } + } + + @SubscribeEvent + public static void onTradeRegistering(VillagerTradesEvent event) { + Int2ObjectMap> trades = TRADES_TO_ADD.get(event.getType()); + + if (trades != null) { + for (Int2ObjectMap.Entry> entry : trades.int2ObjectEntrySet()) { + event.getTrades().computeIfAbsent(entry.getIntKey(), $ -> NonNullList.create()).addAll(entry.getValue()); + } + } + } + + @SubscribeEvent + public static void onWanderingTradeRegistering(WandererTradesEvent event) { + if (!WANDERER_TRADER_TRADES_GENERIC.isEmpty()) { + event.getGenericTrades().addAll(WANDERER_TRADER_TRADES_GENERIC); + } + if (!WANDERER_TRADER_TRADES_RARE.isEmpty()) { + event.getRareTrades().addAll(WANDERER_TRADER_TRADES_RARE); + } + } +} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 09091f4b..e53a223c 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -11,7 +11,7 @@ authors = "shedaniel" description = ''' A intermediary api aimed to ease developing multiplatform mods. ''' -logoFile="icon.png" +logoFile = "icon.png" license = "LGPL-3" [[dependencies.architectury]] diff --git a/forge/src/main/resources/architectury.mixins.json b/forge/src/main/resources/architectury.mixins.json index 277733fc..c8711807 100644 --- a/forge/src/main/resources/architectury.mixins.json +++ b/forge/src/main/resources/architectury.mixins.json @@ -7,9 +7,17 @@ "client": [ ], "mixins": [ - "BiomeGenerationSettingsBuilderAccessor", "GameRulesAccessor", "GameRulesAccessor$BooleanValue", "GameRulesAccessor$BooleanValueSimple", - "GameRulesAccessor$IntegerValue", "GameRulesAccessor$IntegerValueSimple", "MixinBlockEntity", "MixinBlockEntityExtension", "MixinItemExtension", - "MixinRegistryEntry", "MobSpawnSettingsBuilderAccessor" + "BiomeGenerationSettingsBuilderAccessor", + "GameRulesAccessor", + "GameRulesAccessor$BooleanValue", + "GameRulesAccessor$BooleanValueSimple", + "GameRulesAccessor$IntegerValue", + "GameRulesAccessor$IntegerValueSimple", + "MixinBlockEntity", + "MixinBlockEntityExtension", + "MixinItemExtension", + "MixinRegistryEntry", + "MobSpawnSettingsBuilderAccessor" ], "injectors": { "defaultRequire": 1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e5338d37..0f80bbf5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/TestMod.java b/testmod-common/src/main/java/me/shedaniel/architectury/test/TestMod.java index e1e87e5b..1193c342 100644 --- a/testmod-common/src/main/java/me/shedaniel/architectury/test/TestMod.java +++ b/testmod-common/src/main/java/me/shedaniel/architectury/test/TestMod.java @@ -28,6 +28,7 @@ import me.shedaniel.architectury.test.gamerule.TestGameRules; import me.shedaniel.architectury.test.registry.TestRegistries; import me.shedaniel.architectury.test.registry.client.TestKeybinds; import me.shedaniel.architectury.test.tags.TestTags; +import me.shedaniel.architectury.test.trade.TestTrades; import me.shedaniel.architectury.utils.Env; import me.shedaniel.architectury.utils.EnvExecutor; @@ -40,6 +41,7 @@ public class TestMod { TestRegistries.initialize(); TestGameRules.init(); TestTags.initialize(); + TestTrades.init(); if (Platform.getEnvironment() == Env.CLIENT) TestKeybinds.initialize(); } diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/events/DebugEvents.java b/testmod-common/src/main/java/me/shedaniel/architectury/test/events/DebugEvents.java index 3b8db67b..a530d2ad 100644 --- a/testmod-common/src/main/java/me/shedaniel/architectury/test/events/DebugEvents.java +++ b/testmod-common/src/main/java/me/shedaniel/architectury/test/events/DebugEvents.java @@ -29,7 +29,6 @@ import me.shedaniel.architectury.platform.Platform; import me.shedaniel.architectury.utils.Env; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.screens.ChatScreen; import net.minecraft.client.gui.screens.inventory.AnvilScreen; import net.minecraft.core.Position; import net.minecraft.core.Vec3i; diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/gamerule/TestGameRules.java b/testmod-common/src/main/java/me/shedaniel/architectury/test/gamerule/TestGameRules.java index d2fe1462..64baaf7a 100644 --- a/testmod-common/src/main/java/me/shedaniel/architectury/test/gamerule/TestGameRules.java +++ b/testmod-common/src/main/java/me/shedaniel/architectury/test/gamerule/TestGameRules.java @@ -28,11 +28,12 @@ import static me.shedaniel.architectury.registry.GameRuleRegistry.register; public class TestGameRules { private static final Logger LOGGER = LogManager.getLogger(); - + public static final GameRules.Key SIMPLE_BOOL = register("simpleBool", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true)); public static final GameRules.Key SIMPLE_INT = register("simpleInt", GameRules.Category.MISC, GameRuleFactory.createIntRule(10)); public static final GameRules.Key CALLBACK_BOOL = register("callbackBool", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true, (server, value) -> LOGGER.info("changed to {}", value.get()))); public static final GameRules.Key CALLBACK_INT = register("callbackInt", GameRules.Category.MISC, GameRuleFactory.createIntRule(10, (server, value) -> LOGGER.info("changed to {}", value.get()))); - - public static void init() {} + + public static void init() { + } } diff --git a/testmod-common/src/main/java/me/shedaniel/architectury/test/trade/TestTrades.java b/testmod-common/src/main/java/me/shedaniel/architectury/test/trade/TestTrades.java new file mode 100644 index 00000000..bb92779c --- /dev/null +++ b/testmod-common/src/main/java/me/shedaniel/architectury/test/trade/TestTrades.java @@ -0,0 +1,42 @@ +/* + * This file is part of architectury. + * Copyright (C) 2020, 2021 architectury + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package me.shedaniel.architectury.test.trade; + +import me.shedaniel.architectury.registry.trade.SimpleTrade; +import me.shedaniel.architectury.registry.trade.TradeRegistry; +import net.minecraft.core.Registry; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerTrades; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; + +public class TestTrades { + public static void init() { + for (VillagerProfession villagerProfession : Registry.VILLAGER_PROFESSION) { + TradeRegistry.registerVillagerTrade(villagerProfession, 1, TestTrades.createTrades()); + } + TradeRegistry.registerTradeForWanderingTrader(false, TestTrades.createTrades()); + } + + private static VillagerTrades.ItemListing[] createTrades() { + SimpleTrade trade = new SimpleTrade(Items.APPLE.getDefaultInstance(), ItemStack.EMPTY, Items.ACACIA_BOAT.getDefaultInstance(), 1, 0, 1.0F); + return new VillagerTrades.ItemListing[]{trade}; + } +} diff --git a/testmod-common/src/main/resources/data/architectury-test/tags/blocks/heart_particles2.json b/testmod-common/src/main/resources/data/architectury-test/tags/blocks/heart_particles2.json index 434965a2..e7cca299 100644 --- a/testmod-common/src/main/resources/data/architectury-test/tags/blocks/heart_particles2.json +++ b/testmod-common/src/main/resources/data/architectury-test/tags/blocks/heart_particles2.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "minecraft:emerald_block" - ] + "replace": false, + "values": [ + "minecraft:emerald_block" + ] } diff --git a/testmod-fabric/build.gradle b/testmod-fabric/build.gradle index 74127e78..d19a1741 100644 --- a/testmod-fabric/build.gradle +++ b/testmod-fabric/build.gradle @@ -12,7 +12,7 @@ dependencies { minecraft "com.mojang:minecraft:${rootProject.architectury.minecraft}" mappings loom.officialMojangMappings() modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" implementation project(path: ":fabric", configuration: "dev") implementation(project(path: ":common")) { diff --git a/testmod-forge/build.gradle b/testmod-forge/build.gradle index b8eb8568..8cd8ffb9 100644 --- a/testmod-forge/build.gradle +++ b/testmod-forge/build.gradle @@ -5,7 +5,7 @@ plugins { loom { mixinConfig "architectury.mixins.json" - + localMods { it.add(project(":forge").sourceSets.main) } diff --git a/testmod-forge/gradle.properties b/testmod-forge/gradle.properties index 82425854..32f842a6 100644 --- a/testmod-forge/gradle.properties +++ b/testmod-forge/gradle.properties @@ -1 +1 @@ -loom.platform=forge +loom.platform=forge \ No newline at end of file